001 /** 002 * Copyright (c) 2000-2013 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; 016 017 import aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil; 020 import com.liferay.portal.kernel.util.ReferenceRegistry; 021 022 /** 023 * Provides the remote service utility for ResourcePermission. This utility wraps 024 * {@link com.liferay.portal.service.impl.ResourcePermissionServiceImpl} and is the 025 * primary access point for service operations in application layer code running 026 * on a remote server. Methods of this service are expected to have security 027 * checks based on the propagated JAAS credentials because this service can be 028 * accessed remotely. 029 * 030 * @author Brian Wing Shun Chan 031 * @see ResourcePermissionService 032 * @see com.liferay.portal.service.base.ResourcePermissionServiceBaseImpl 033 * @see com.liferay.portal.service.impl.ResourcePermissionServiceImpl 034 * @generated 035 */ 036 @ProviderType 037 public class ResourcePermissionServiceUtil { 038 /* 039 * NOTE FOR DEVELOPERS: 040 * 041 * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.ResourcePermissionServiceImpl} and rerun ServiceBuilder to regenerate this class. 042 */ 043 044 /** 045 * Returns the Spring bean ID for this bean. 046 * 047 * @return the Spring bean ID for this bean 048 */ 049 public static java.lang.String getBeanIdentifier() { 050 return getService().getBeanIdentifier(); 051 } 052 053 /** 054 * Sets the Spring bean ID for this bean. 055 * 056 * @param beanIdentifier the Spring bean ID for this bean 057 */ 058 public static void setBeanIdentifier(java.lang.String beanIdentifier) { 059 getService().setBeanIdentifier(beanIdentifier); 060 } 061 062 /** 063 * Grants the role permission at the scope to perform the action on 064 * resources of the type. Existing actions are retained. 065 * 066 * <p> 067 * This method cannot be used to grant individual scope permissions, but is 068 * only intended for adding permissions at the company, group, and 069 * group-template scopes. For example, this method could be used to grant a 070 * company scope permission to edit message board posts. 071 * </p> 072 * 073 * <p> 074 * If a company scope permission is granted to resources that the role 075 * already had group scope permissions to, the group scope permissions are 076 * deleted. Likewise, if a group scope permission is granted to resources 077 * that the role already had company scope permissions to, the company scope 078 * permissions are deleted. Be aware that this latter behavior can result in 079 * an overall reduction in permissions for the role. 080 * </p> 081 * 082 * <p> 083 * Depending on the scope, the value of <code>primKey</code> will have 084 * different meanings. For more information, see {@link 085 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 086 * </p> 087 * 088 * @param groupId the primary key of the group 089 * @param companyId the primary key of the company 090 * @param name the resource's name, which can be either a class name or a 091 portlet ID 092 * @param scope the scope. This method only supports company, group, and 093 group-template scope. 094 * @param primKey the primary key 095 * @param roleId the primary key of the role 096 * @param actionId the action ID 097 * @throws PortalException if the user did not have permission to add 098 resource permissions, or if scope was set to individual scope or 099 if a role with the primary key or a resource action with the name 100 and action ID could not be found 101 * @throws SystemException if a system exception occurred 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) 106 throws com.liferay.portal.kernel.exception.PortalException, 107 com.liferay.portal.kernel.exception.SystemException { 108 getService() 109 .addResourcePermission(groupId, companyId, name, scope, primKey, 110 roleId, actionId); 111 } 112 113 /** 114 * Revokes permission at the scope from the role to perform the action on 115 * resources of the type. For example, this method could be used to revoke a 116 * group scope permission to edit blog posts. 117 * 118 * <p> 119 * Depending on the scope, the value of <code>primKey</code> will have 120 * different meanings. For more information, see {@link 121 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 122 * </p> 123 * 124 * @param groupId the primary key of the group 125 * @param companyId the primary key of the company 126 * @param name the resource's name, which can be either a class name or a 127 portlet ID 128 * @param scope the scope 129 * @param primKey the primary key 130 * @param roleId the primary key of the role 131 * @param actionId the action ID 132 * @throws PortalException if the user did not have permission to remove 133 resource permissions, or if a role with the primary key or a 134 resource action with the name and action ID could not be found 135 * @throws SystemException if a system exception occurred 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) 140 throws com.liferay.portal.kernel.exception.PortalException, 141 com.liferay.portal.kernel.exception.SystemException { 142 getService() 143 .removeResourcePermission(groupId, companyId, name, scope, primKey, 144 roleId, actionId); 145 } 146 147 /** 148 * Revokes all permissions at the scope from the role to perform the action 149 * on resources of the type. For example, this method could be used to 150 * revoke all individual scope permissions to edit blog posts from site 151 * members. 152 * 153 * @param groupId the primary key of the group 154 * @param companyId the primary key of the company 155 * @param name the resource's name, which can be either a class name or a 156 portlet ID 157 * @param scope the scope 158 * @param roleId the primary key of the role 159 * @param actionId the action ID 160 * @throws PortalException if the user did not have permission to remove 161 resource permissions, or if a role with the primary key or a 162 resource action with the name and action ID could not be found 163 * @throws SystemException if a system exception occurred 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 com.liferay.portal.kernel.exception.PortalException, 168 com.liferay.portal.kernel.exception.SystemException { 169 getService() 170 .removeResourcePermissions(groupId, companyId, name, scope, roleId, 171 actionId); 172 } 173 174 /** 175 * Updates the role's permissions at the scope, setting the actions that can 176 * be performed on resources of the type. Existing actions are replaced. 177 * 178 * <p> 179 * This method can be used to set permissions at any scope, but it is 180 * generally only used at the individual scope. For example, it could be 181 * used to set the guest permissions on a blog post. 182 * </p> 183 * 184 * <p> 185 * Depending on the scope, the value of <code>primKey</code> will have 186 * different meanings. For more information, see {@link 187 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 188 * </p> 189 * 190 * @param groupId the primary key of the group 191 * @param companyId the primary key of the company 192 * @param name the resource's name, which can be either a class name or a 193 portlet ID 194 * @param primKey the primary key 195 * @param roleId the primary key of the role 196 * @param actionIds the action IDs of the actions 197 * @throws PortalException if the user did not have permission to set 198 resource permissions, or if a role with the primary key or a 199 resource action with the name and action ID could not be found 200 * @throws SystemException if a system exception occurred 201 */ 202 public static void setIndividualResourcePermissions(long groupId, 203 long companyId, java.lang.String name, java.lang.String primKey, 204 long roleId, java.lang.String[] actionIds) 205 throws com.liferay.portal.kernel.exception.PortalException, 206 com.liferay.portal.kernel.exception.SystemException { 207 getService() 208 .setIndividualResourcePermissions(groupId, companyId, name, 209 primKey, roleId, actionIds); 210 } 211 212 /** 213 * Updates the role's permissions at the scope, setting the actions that can 214 * be performed on resources of the type. Existing actions are replaced. 215 * 216 * <p> 217 * This method can be used to set permissions at any scope, but it is 218 * generally only used at the individual scope. For example, it could be 219 * used to set the guest permissions on a blog post. 220 * </p> 221 * 222 * <p> 223 * Depending on the scope, the value of <code>primKey</code> will have 224 * different meanings. For more information, see {@link 225 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 226 * </p> 227 * 228 * @param groupId the primary key of the group 229 * @param companyId the primary key of the company 230 * @param name the resource's name, which can be either a class name or a 231 portlet ID 232 * @param primKey the primary key 233 * @param roleIdsToActionIds a map of role IDs to action IDs of the actions 234 * @throws PortalException if the user did not have permission to set 235 resource permissions, or if a role with the primary key or a 236 resource action with the name and action ID could not be found 237 * @throws SystemException if a system exception occurred 238 */ 239 public static void setIndividualResourcePermissions(long groupId, 240 long companyId, java.lang.String name, java.lang.String primKey, 241 java.util.Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds) 242 throws com.liferay.portal.kernel.exception.PortalException, 243 com.liferay.portal.kernel.exception.SystemException { 244 getService() 245 .setIndividualResourcePermissions(groupId, companyId, name, 246 primKey, roleIdsToActionIds); 247 } 248 249 public static ResourcePermissionService getService() { 250 if (_service == null) { 251 _service = (ResourcePermissionService)PortalBeanLocatorUtil.locate(ResourcePermissionService.class.getName()); 252 253 ReferenceRegistry.registerReference(ResourcePermissionServiceUtil.class, 254 "_service"); 255 } 256 257 return _service; 258 } 259 260 /** 261 * @deprecated As of 6.2.0 262 */ 263 public void setService(ResourcePermissionService service) { 264 } 265 266 private static ResourcePermissionService _service; 267 }