001 /** 002 * Copyright (c) 2000-present 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 aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.portal.kernel.log.Log; 020 import com.liferay.portal.kernel.log.LogFactoryUtil; 021 import com.liferay.portal.service.ResourcePermissionServiceUtil; 022 023 import java.rmi.RemoteException; 024 025 /** 026 * Provides the SOAP utility for the 027 * {@link com.liferay.portal.service.ResourcePermissionServiceUtil} service utility. The 028 * static methods of this class calls the same methods of the service utility. 029 * However, the signatures are different because it is difficult for SOAP to 030 * support certain types. 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 @ProviderType 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 scope 083 * permissions are deleted. Be aware that this latter behavior can result in 084 * 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 name 105 and action ID could not be found 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 */ 144 public static void removeResourcePermission(long groupId, long companyId, 145 java.lang.String name, int scope, java.lang.String primKey, 146 long roleId, java.lang.String actionId) throws RemoteException { 147 try { 148 ResourcePermissionServiceUtil.removeResourcePermission(groupId, 149 companyId, name, scope, primKey, roleId, actionId); 150 } 151 catch (Exception e) { 152 _log.error(e, e); 153 154 throw new RemoteException(e.getMessage()); 155 } 156 } 157 158 /** 159 * Revokes all permissions at the scope from the role to perform the action 160 * on resources of the type. For example, this method could be used to 161 * revoke all individual scope permissions to edit blog posts from site 162 * members. 163 * 164 * @param groupId the primary key of the group 165 * @param companyId the primary key of the company 166 * @param name the resource's name, which can be either a class name or a 167 portlet ID 168 * @param scope the scope 169 * @param roleId the primary key of the role 170 * @param actionId the action ID 171 * @throws PortalException if the user did not have permission to remove 172 resource permissions, or if a role with the primary key or a 173 resource action with the name and action ID could not be found 174 */ 175 public static void removeResourcePermissions(long groupId, long companyId, 176 java.lang.String name, int scope, long roleId, java.lang.String actionId) 177 throws RemoteException { 178 try { 179 ResourcePermissionServiceUtil.removeResourcePermissions(groupId, 180 companyId, name, scope, roleId, actionId); 181 } 182 catch (Exception e) { 183 _log.error(e, e); 184 185 throw new RemoteException(e.getMessage()); 186 } 187 } 188 189 /** 190 * Updates the role's permissions at the scope, setting the actions that can 191 * be performed on resources of the type. Existing actions are replaced. 192 * 193 * <p> 194 * This method can be used to set permissions at any scope, but it is 195 * generally only used at the individual scope. For example, it could be 196 * used to set the guest permissions on a blog post. 197 * </p> 198 * 199 * <p> 200 * Depending on the scope, the value of <code>primKey</code> will have 201 * different meanings. For more information, see {@link 202 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 203 * </p> 204 * 205 * @param groupId the primary key of the group 206 * @param companyId the primary key of the company 207 * @param name the resource's name, which can be either a class name or a 208 portlet ID 209 * @param primKey the primary key 210 * @param roleId the primary key of the role 211 * @param actionIds the action IDs of the actions 212 * @throws PortalException if the user did not have permission to set 213 resource permissions, or if a role with the primary key or a 214 resource action with the name and action ID could not be found 215 */ 216 public static void setIndividualResourcePermissions(long groupId, 217 long companyId, java.lang.String name, java.lang.String primKey, 218 long roleId, java.lang.String[] actionIds) throws RemoteException { 219 try { 220 ResourcePermissionServiceUtil.setIndividualResourcePermissions(groupId, 221 companyId, name, primKey, roleId, actionIds); 222 } 223 catch (Exception e) { 224 _log.error(e, e); 225 226 throw new RemoteException(e.getMessage()); 227 } 228 } 229 230 private static Log _log = LogFactoryUtil.getLog(ResourcePermissionServiceSoap.class); 231 }