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 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 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 */ 103 public static void addResourcePermission(long groupId, long companyId, 104 java.lang.String name, int scope, java.lang.String primKey, 105 long roleId, java.lang.String actionId) throws RemoteException { 106 try { 107 ResourcePermissionServiceUtil.addResourcePermission(groupId, 108 companyId, name, scope, primKey, roleId, actionId); 109 } 110 catch (Exception e) { 111 _log.error(e, e); 112 113 throw new RemoteException(e.getMessage()); 114 } 115 } 116 117 /** 118 * Revokes permission at the scope from the role to perform the action on 119 * resources of the type. For example, this method could be used to revoke a 120 * group scope permission to edit blog posts. 121 * 122 * <p> 123 * Depending on the scope, the value of <code>primKey</code> will have 124 * different meanings. For more information, see {@link 125 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 126 * </p> 127 * 128 * @param groupId the primary key of the group 129 * @param companyId the primary key of the company 130 * @param name the resource's name, which can be either a class name or a 131 portlet ID 132 * @param scope the scope 133 * @param primKey the primary key 134 * @param roleId the primary key of the role 135 * @param actionId the action ID 136 */ 137 public static void removeResourcePermission(long groupId, long companyId, 138 java.lang.String name, int scope, java.lang.String primKey, 139 long roleId, java.lang.String actionId) throws RemoteException { 140 try { 141 ResourcePermissionServiceUtil.removeResourcePermission(groupId, 142 companyId, name, scope, primKey, roleId, actionId); 143 } 144 catch (Exception e) { 145 _log.error(e, e); 146 147 throw new RemoteException(e.getMessage()); 148 } 149 } 150 151 /** 152 * Revokes all permissions at the scope from the role to perform the action 153 * on resources of the type. For example, this method could be used to 154 * revoke all individual scope permissions to edit blog posts from site 155 * members. 156 * 157 * @param groupId the primary key of the group 158 * @param companyId the primary key of the company 159 * @param name the resource's name, which can be either a class name or a 160 portlet ID 161 * @param scope the scope 162 * @param roleId the primary key of the role 163 * @param actionId the action ID 164 */ 165 public static void removeResourcePermissions(long groupId, long companyId, 166 java.lang.String name, int scope, long roleId, java.lang.String actionId) 167 throws RemoteException { 168 try { 169 ResourcePermissionServiceUtil.removeResourcePermissions(groupId, 170 companyId, name, scope, roleId, actionId); 171 } 172 catch (Exception e) { 173 _log.error(e, e); 174 175 throw new RemoteException(e.getMessage()); 176 } 177 } 178 179 /** 180 * Updates the role's permissions at the scope, setting the actions that can 181 * be performed on resources of the type. Existing actions are replaced. 182 * 183 * <p> 184 * This method can be used to set permissions at any scope, but it is 185 * generally only used at the individual scope. For example, it could be 186 * used to set the guest permissions on a blog post. 187 * </p> 188 * 189 * <p> 190 * Depending on the scope, the value of <code>primKey</code> will have 191 * different meanings. For more information, see {@link 192 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 193 * </p> 194 * 195 * @param groupId the primary key of the group 196 * @param companyId the primary key of the company 197 * @param name the resource's name, which can be either a class name or a 198 portlet ID 199 * @param primKey the primary key 200 * @param roleId the primary key of the role 201 * @param actionIds the action IDs of the actions 202 */ 203 public static void setIndividualResourcePermissions(long groupId, 204 long companyId, java.lang.String name, java.lang.String primKey, 205 long roleId, java.lang.String[] actionIds) throws RemoteException { 206 try { 207 ResourcePermissionServiceUtil.setIndividualResourcePermissions(groupId, 208 companyId, name, primKey, roleId, actionIds); 209 } 210 catch (Exception e) { 211 _log.error(e, e); 212 213 throw new RemoteException(e.getMessage()); 214 } 215 } 216 217 private static Log _log = LogFactoryUtil.getLog(ResourcePermissionServiceSoap.class); 218 }