001 /** 002 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved. 003 * 004 * This library is free software; you can redistribute it and/or modify it under 005 * the terms of the GNU Lesser General Public License as published by the Free 006 * Software Foundation; either version 2.1 of the License, or (at your option) 007 * any later version. 008 * 009 * This library is distributed in the hope that it will be useful, but WITHOUT 010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 011 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 012 * details. 013 */ 014 015 package com.liferay.portal.service.http; 016 017 import com.liferay.portal.kernel.log.Log; 018 import com.liferay.portal.kernel.log.LogFactoryUtil; 019 import com.liferay.portal.service.ResourcePermissionServiceUtil; 020 021 import java.rmi.RemoteException; 022 023 /** 024 * <p> 025 * This class provides a SOAP utility for the 026 * {@link com.liferay.portal.service.ResourcePermissionServiceUtil} service utility. The 027 * static methods of this class calls the same methods of the service utility. 028 * However, the signatures are different because it is difficult for SOAP to 029 * support certain types. 030 * </p> 031 * 032 * <p> 033 * ServiceBuilder follows certain rules in translating the methods. For example, 034 * if the method in the service utility returns a {@link java.util.List}, that 035 * is translated to an array of {@link com.liferay.portal.model.ResourcePermissionSoap}. 036 * If the method in the service utility returns a 037 * {@link com.liferay.portal.model.ResourcePermission}, that is translated to a 038 * {@link com.liferay.portal.model.ResourcePermissionSoap}. Methods that SOAP cannot 039 * safely wire are skipped. 040 * </p> 041 * 042 * <p> 043 * The benefits of using the SOAP utility is that it is cross platform 044 * compatible. SOAP allows different languages like Java, .NET, C++, PHP, and 045 * even Perl, to call the generated services. One drawback of SOAP is that it is 046 * slow because it needs to serialize all calls into a text format (XML). 047 * </p> 048 * 049 * <p> 050 * You can see a list of services at http://localhost:8080/api/axis. Set the 051 * property <b>axis.servlet.hosts.allowed</b> in portal.properties to configure 052 * security. 053 * </p> 054 * 055 * <p> 056 * The SOAP utility is only generated for remote services. 057 * </p> 058 * 059 * @author Brian Wing Shun Chan 060 * @see ResourcePermissionServiceHttp 061 * @see com.liferay.portal.model.ResourcePermissionSoap 062 * @see com.liferay.portal.service.ResourcePermissionServiceUtil 063 * @generated 064 */ 065 public class ResourcePermissionServiceSoap { 066 /** 067 * Grants the role permission at the scope to perform the action on 068 * resources of the type. Existing actions are retained. 069 * 070 * <p> 071 * This method cannot be used to grant individual scope permissions, but is 072 * only intended for adding permissions at the company, group, and 073 * group-template scopes. For example, this method could be used to grant a 074 * company scope permission to edit message board posts. 075 * </p> 076 * 077 * <p> 078 * If a company scope permission is granted to resources that the role 079 * already had group scope permissions to, the group scope permissions are 080 * deleted. Likewise, if a group scope permission is granted to resources 081 * that the role already had company scope permissions to, the company scope 082 * permissions are deleted. Be aware that this latter behavior can result in 083 * an overall reduction in permissions for the role. 084 * </p> 085 * 086 * <p> 087 * Depending on the scope, the value of <code>primKey</code> will have 088 * different meanings. For more information, see {@link 089 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 090 * </p> 091 * 092 * @param groupId the primary key of the group 093 * @param companyId the primary key of the company 094 * @param name the resource's name, which can be either a class name or a 095 portlet ID 096 * @param scope the scope. This method only supports company, group, and 097 group-template scope. 098 * @param primKey the primary key 099 * @param roleId the primary key of the role 100 * @param actionId the action ID 101 * @throws PortalException if the user did not have permission to add 102 resource permissions, or if scope was set to individual scope or 103 if a role with the primary key or a resource action with the name 104 and action ID could not be found 105 * @throws SystemException if a system exception occurred 106 */ 107 public static void addResourcePermission(long groupId, long companyId, 108 java.lang.String name, int scope, java.lang.String primKey, 109 long roleId, java.lang.String actionId) throws RemoteException { 110 try { 111 ResourcePermissionServiceUtil.addResourcePermission(groupId, 112 companyId, name, scope, primKey, roleId, actionId); 113 } 114 catch (Exception e) { 115 _log.error(e, e); 116 117 throw new RemoteException(e.getMessage()); 118 } 119 } 120 121 /** 122 * Revokes permission at the scope from the role to perform the action on 123 * resources of the type. For example, this method could be used to revoke a 124 * group scope permission to edit blog posts. 125 * 126 * <p> 127 * Depending on the scope, the value of <code>primKey</code> will have 128 * different meanings. For more information, see {@link 129 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 130 * </p> 131 * 132 * @param groupId the primary key of the group 133 * @param companyId the primary key of the company 134 * @param name the resource's name, which can be either a class name or a 135 portlet ID 136 * @param scope the scope 137 * @param primKey the primary key 138 * @param roleId the primary key of the role 139 * @param actionId the action ID 140 * @throws PortalException if the user did not have permission to remove 141 resource permissions, or if a role with the primary key or a 142 resource action with the name and action ID could not be found 143 * @throws SystemException if a system exception occurred 144 */ 145 public static void removeResourcePermission(long groupId, long companyId, 146 java.lang.String name, int scope, java.lang.String primKey, 147 long roleId, java.lang.String actionId) throws RemoteException { 148 try { 149 ResourcePermissionServiceUtil.removeResourcePermission(groupId, 150 companyId, name, scope, primKey, roleId, actionId); 151 } 152 catch (Exception e) { 153 _log.error(e, e); 154 155 throw new RemoteException(e.getMessage()); 156 } 157 } 158 159 /** 160 * Revokes all permissions at the scope from the role to perform the action 161 * on resources of the type. For example, this method could be used to 162 * revoke all individual scope permissions to edit blog posts from site 163 * members. 164 * 165 * @param groupId the primary key of the group 166 * @param companyId the primary key of the company 167 * @param name the resource's name, which can be either a class name or a 168 portlet ID 169 * @param scope the scope 170 * @param roleId the primary key of the role 171 * @param actionId the action ID 172 * @throws PortalException if the user did not have permission to remove 173 resource permissions, or if a role with the primary key or a 174 resource action with the name and action ID could not be found 175 * @throws SystemException if a system exception occurred 176 */ 177 public static void removeResourcePermissions(long groupId, long companyId, 178 java.lang.String name, int scope, long roleId, java.lang.String actionId) 179 throws RemoteException { 180 try { 181 ResourcePermissionServiceUtil.removeResourcePermissions(groupId, 182 companyId, name, scope, roleId, actionId); 183 } 184 catch (Exception e) { 185 _log.error(e, e); 186 187 throw new RemoteException(e.getMessage()); 188 } 189 } 190 191 /** 192 * Updates the role's permissions at the scope, setting the actions that can 193 * be performed on resources of the type. Existing actions are replaced. 194 * 195 * <p> 196 * This method can be used to set permissions at any scope, but it is 197 * generally only used at the individual scope. For example, it could be 198 * used to set the guest permissions on a blog post. 199 * </p> 200 * 201 * <p> 202 * Depending on the scope, the value of <code>primKey</code> will have 203 * different meanings. For more information, see {@link 204 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 205 * </p> 206 * 207 * @param groupId the primary key of the group 208 * @param companyId the primary key of the company 209 * @param name the resource's name, which can be either a class name or a 210 portlet ID 211 * @param primKey the primary key 212 * @param roleId the primary key of the role 213 * @param actionIds the action IDs of the actions 214 * @throws PortalException if the user did not have permission to set 215 resource permissions, or if a role with the primary key or a 216 resource action with the name and action ID could not be found 217 * @throws SystemException if a system exception occurred 218 */ 219 public static void setIndividualResourcePermissions(long groupId, 220 long companyId, java.lang.String name, java.lang.String primKey, 221 long roleId, java.lang.String[] actionIds) throws RemoteException { 222 try { 223 ResourcePermissionServiceUtil.setIndividualResourcePermissions(groupId, 224 companyId, name, primKey, roleId, actionIds); 225 } 226 catch (Exception e) { 227 _log.error(e, e); 228 229 throw new RemoteException(e.getMessage()); 230 } 231 } 232 233 private static Log _log = LogFactoryUtil.getLog(ResourcePermissionServiceSoap.class); 234 }