001 /** 002 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved. 003 * 004 * The contents of this file are subject to the terms of the Liferay Enterprise 005 * Subscription License ("License"). You may not use this file except in 006 * compliance with the License. You can obtain a copy of the License by 007 * contacting Liferay, Inc. See the License for the specific language governing 008 * permissions and limitations under the License, including but not limited to 009 * distribution rights of the Software. 010 * 011 * 012 * 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 051 * http://localhost:8080/tunnel-web/secure/axis. Set the property 052 * <b>tunnel.servlet.hosts.allowed</b> in portal.properties to configure 053 * security. 054 * </p> 055 * 056 * <p> 057 * The SOAP utility is only generated for remote services. 058 * </p> 059 * 060 * @author Brian Wing Shun Chan 061 * @see ResourcePermissionServiceHttp 062 * @see com.liferay.portal.model.ResourcePermissionSoap 063 * @see com.liferay.portal.service.ResourcePermissionServiceUtil 064 * @generated 065 */ 066 public class ResourcePermissionServiceSoap { 067 /** 068 * Grants the role permission at the scope to perform the action on 069 * resources of the type. Existing actions are retained. 070 * 071 * <p> 072 * This method cannot be used to grant individual scope permissions, but is 073 * only intended for adding permissions at the company, group, and 074 * group-template scopes. For example, this method could be used to grant a 075 * company scope permission to edit message board posts. 076 * </p> 077 * 078 * <p> 079 * If a company scope permission is granted to resources that the role 080 * already had group scope permissions to, the group scope permissions are 081 * deleted. Likewise, if a group scope permission is granted to resources 082 * that the role already had company scope permissions to, the company 083 * scope permissions are deleted. Be aware that this latter behavior can 084 * result in an overall reduction in permissions for the role. 085 * </p> 086 * 087 * <p> 088 * Depending on the scope, the value of <code>primKey</code> will have 089 * different meanings. For more information, see {@link 090 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 091 * </p> 092 * 093 * @param groupId the primary key of the group 094 * @param companyId the primary key of the company 095 * @param name the resource's name, which can be either a class name or a 096 portlet ID 097 * @param scope the scope. This method only supports company, group, and 098 group-template scope. 099 * @param primKey the primary key 100 * @param roleId the primary key of the role 101 * @param actionId the action ID 102 * @throws PortalException if the user did not have permission to add 103 resource permissions, or if scope was set to individual scope or 104 if a role with the primary key or a resource action with the 105 name and action ID could not be found 106 * @throws SystemException if a system exception occurred 107 */ 108 public static void addResourcePermission(long groupId, long companyId, 109 java.lang.String name, int scope, java.lang.String primKey, 110 long roleId, java.lang.String actionId) throws RemoteException { 111 try { 112 ResourcePermissionServiceUtil.addResourcePermission(groupId, 113 companyId, name, scope, primKey, roleId, actionId); 114 } 115 catch (Exception e) { 116 _log.error(e, e); 117 118 throw new RemoteException(e.getMessage()); 119 } 120 } 121 122 /** 123 * Revokes permission at the scope from the role to perform the action on 124 * resources of the type. For example, this method could be used to revoke 125 * a group scope permission to edit blog posts. 126 * 127 * <p> 128 * Depending on the scope, the value of <code>primKey</code> will have 129 * different meanings. For more information, see {@link 130 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 131 * </p> 132 * 133 * @param groupId the primary key of the group 134 * @param companyId the primary key of the company 135 * @param name the resource's name, which can be either a class name or a 136 portlet ID 137 * @param scope the scope 138 * @param primKey the primary key 139 * @param roleId the primary key of the role 140 * @param actionId the action ID 141 * @throws PortalException if the user did not have permission to remove 142 resource permissions, or if a role with the primary key or a 143 resource action with the name and action ID could not be found 144 * @throws SystemException if a system exception occurred 145 */ 146 public static void removeResourcePermission(long groupId, long companyId, 147 java.lang.String name, int scope, java.lang.String primKey, 148 long roleId, java.lang.String actionId) throws RemoteException { 149 try { 150 ResourcePermissionServiceUtil.removeResourcePermission(groupId, 151 companyId, name, scope, primKey, roleId, actionId); 152 } 153 catch (Exception e) { 154 _log.error(e, e); 155 156 throw new RemoteException(e.getMessage()); 157 } 158 } 159 160 /** 161 * Revokes all permissions at the scope from the role to perform the action 162 * on resources of the type. For example, this method could be used to 163 * revoke all individual scope permissions to edit blog posts from site 164 * members. 165 * 166 * @param groupId the primary key of the group 167 * @param companyId the primary key of the company 168 * @param name the resource's name, which can be either a class name or a 169 portlet ID 170 * @param scope the scope 171 * @param roleId the primary key of the role 172 * @param actionId the action ID 173 * @throws PortalException if the user did not have permission to remove 174 resource permissions, or if a role with the primary key or a 175 resource action with the name and action ID could not be found 176 * @throws SystemException if a system exception occurred 177 */ 178 public static void removeResourcePermissions(long groupId, long companyId, 179 java.lang.String name, int scope, long roleId, java.lang.String actionId) 180 throws RemoteException { 181 try { 182 ResourcePermissionServiceUtil.removeResourcePermissions(groupId, 183 companyId, name, scope, roleId, actionId); 184 } 185 catch (Exception e) { 186 _log.error(e, e); 187 188 throw new RemoteException(e.getMessage()); 189 } 190 } 191 192 /** 193 * Updates the role's permissions at the scope, setting the actions that 194 * can be performed on resources of the type. Existing actions are 195 * replaced. 196 * 197 * <p> 198 * This method can be used to set permissions at any scope, but it is 199 * generally only used at the individual scope. For example, it could be 200 * used to set the guest permissions on a blog post. 201 * </p> 202 * 203 * <p> 204 * Depending on the scope, the value of <code>primKey</code> will have 205 * different meanings. For more information, see {@link 206 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 207 * </p> 208 * 209 * @param groupId the primary key of the group 210 * @param companyId the primary key of the company 211 * @param name the resource's name, which can be either a class name or a 212 portlet ID 213 * @param primKey the primary key 214 * @param roleId the primary key of the role 215 * @param actionIds the action IDs of the actions 216 * @throws PortalException if the user did not have permission to set 217 resource permissions, or if a role with the primary key or a 218 resource action with the name and action ID could not be found 219 * @throws SystemException if a system exception occurred 220 */ 221 public static void setIndividualResourcePermissions(long groupId, 222 long companyId, java.lang.String name, java.lang.String primKey, 223 long roleId, java.lang.String[] actionIds) throws RemoteException { 224 try { 225 ResourcePermissionServiceUtil.setIndividualResourcePermissions(groupId, 226 companyId, name, primKey, roleId, actionIds); 227 } 228 catch (Exception e) { 229 _log.error(e, e); 230 231 throw new RemoteException(e.getMessage()); 232 } 233 } 234 235 private static Log _log = LogFactoryUtil.getLog(ResourcePermissionServiceSoap.class); 236 }