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; 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 * Grants the role permission at the scope to perform the action on 046 * resources of the type. Existing actions are retained. 047 * 048 * <p> 049 * This method cannot be used to grant individual scope permissions, but is 050 * only intended for adding permissions at the company, group, and 051 * group-template scopes. For example, this method could be used to grant a 052 * company scope permission to edit message board posts. 053 * </p> 054 * 055 * <p> 056 * If a company scope permission is granted to resources that the role 057 * already had group scope permissions to, the group scope permissions are 058 * deleted. Likewise, if a group scope permission is granted to resources 059 * that the role already had company scope permissions to, the company scope 060 * permissions are deleted. Be aware that this latter behavior can result in 061 * an overall reduction in permissions for the role. 062 * </p> 063 * 064 * <p> 065 * Depending on the scope, the value of <code>primKey</code> will have 066 * different meanings. For more information, see {@link 067 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 068 * </p> 069 * 070 * @param groupId the primary key of the group 071 * @param companyId the primary key of the company 072 * @param name the resource's name, which can be either a class name or a 073 portlet ID 074 * @param scope the scope. This method only supports company, group, and 075 group-template scope. 076 * @param primKey the primary key 077 * @param roleId the primary key of the role 078 * @param actionId the action ID 079 * @throws PortalException if the user did not have permission to add 080 resource permissions, or if scope was set to individual scope or 081 if a role with the primary key or a resource action with the name 082 and action ID could not be found 083 */ 084 public static void addResourcePermission(long groupId, long companyId, 085 java.lang.String name, int scope, java.lang.String primKey, 086 long roleId, java.lang.String actionId) 087 throws com.liferay.portal.kernel.exception.PortalException { 088 getService() 089 .addResourcePermission(groupId, companyId, name, scope, primKey, 090 roleId, actionId); 091 } 092 093 /** 094 * Returns the Spring bean ID for this bean. 095 * 096 * @return the Spring bean ID for this bean 097 */ 098 public static java.lang.String getBeanIdentifier() { 099 return getService().getBeanIdentifier(); 100 } 101 102 /** 103 * Revokes permission at the scope from the role to perform the action on 104 * resources of the type. For example, this method could be used to revoke a 105 * group scope permission to edit blog posts. 106 * 107 * <p> 108 * Depending on the scope, the value of <code>primKey</code> will have 109 * different meanings. For more information, see {@link 110 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 111 * </p> 112 * 113 * @param groupId the primary key of the group 114 * @param companyId the primary key of the company 115 * @param name the resource's name, which can be either a class name or a 116 portlet ID 117 * @param scope the scope 118 * @param primKey the primary key 119 * @param roleId the primary key of the role 120 * @param actionId the action ID 121 * @throws PortalException if the user did not have permission to remove 122 resource permissions, or if a role with the primary key or a 123 resource action with the name and action ID could not be found 124 */ 125 public static void removeResourcePermission(long groupId, long companyId, 126 java.lang.String name, int scope, java.lang.String primKey, 127 long roleId, java.lang.String actionId) 128 throws com.liferay.portal.kernel.exception.PortalException { 129 getService() 130 .removeResourcePermission(groupId, companyId, name, scope, primKey, 131 roleId, actionId); 132 } 133 134 /** 135 * Revokes all permissions at the scope from the role to perform the action 136 * on resources of the type. For example, this method could be used to 137 * revoke all individual scope permissions to edit blog posts from site 138 * members. 139 * 140 * @param groupId the primary key of the group 141 * @param companyId the primary key of the company 142 * @param name the resource's name, which can be either a class name or a 143 portlet ID 144 * @param scope the scope 145 * @param roleId the primary key of the role 146 * @param actionId the action ID 147 * @throws PortalException if the user did not have permission to remove 148 resource permissions, or if a role with the primary key or a 149 resource action with the name and action ID could not be found 150 */ 151 public static void removeResourcePermissions(long groupId, long companyId, 152 java.lang.String name, int scope, long roleId, java.lang.String actionId) 153 throws com.liferay.portal.kernel.exception.PortalException { 154 getService() 155 .removeResourcePermissions(groupId, companyId, name, scope, roleId, 156 actionId); 157 } 158 159 /** 160 * Sets the Spring bean ID for this bean. 161 * 162 * @param beanIdentifier the Spring bean ID for this bean 163 */ 164 public static void setBeanIdentifier(java.lang.String beanIdentifier) { 165 getService().setBeanIdentifier(beanIdentifier); 166 } 167 168 /** 169 * Updates the role's permissions at the scope, setting the actions that can 170 * be performed on resources of the type. Existing actions are replaced. 171 * 172 * <p> 173 * This method can be used to set permissions at any scope, but it is 174 * generally only used at the individual scope. For example, it could be 175 * used to set the guest permissions on a blog post. 176 * </p> 177 * 178 * <p> 179 * Depending on the scope, the value of <code>primKey</code> will have 180 * different meanings. For more information, see {@link 181 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 182 * </p> 183 * 184 * @param groupId the primary key of the group 185 * @param companyId the primary key of the company 186 * @param name the resource's name, which can be either a class name or a 187 portlet ID 188 * @param primKey the primary key 189 * @param roleId the primary key of the role 190 * @param actionIds the action IDs of the actions 191 * @throws PortalException if the user did not have permission to set 192 resource permissions, or if a role with the primary key or a 193 resource action with the name and action ID could not be found 194 */ 195 public static void setIndividualResourcePermissions(long groupId, 196 long companyId, java.lang.String name, java.lang.String primKey, 197 long roleId, java.lang.String[] actionIds) 198 throws com.liferay.portal.kernel.exception.PortalException { 199 getService() 200 .setIndividualResourcePermissions(groupId, companyId, name, 201 primKey, roleId, actionIds); 202 } 203 204 /** 205 * Updates the role's permissions at the scope, setting the actions that can 206 * be performed on resources of the type. Existing actions are replaced. 207 * 208 * <p> 209 * This method can be used to set permissions at any scope, but it is 210 * generally only used at the individual scope. For example, it could be 211 * used to set the guest permissions on a blog post. 212 * </p> 213 * 214 * <p> 215 * Depending on the scope, the value of <code>primKey</code> will have 216 * different meanings. For more information, see {@link 217 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 218 * </p> 219 * 220 * @param groupId the primary key of the group 221 * @param companyId the primary key of the company 222 * @param name the resource's name, which can be either a class name or a 223 portlet ID 224 * @param primKey the primary key 225 * @param roleIdsToActionIds a map of role IDs to action IDs of the actions 226 * @throws PortalException if the user did not have permission to set 227 resource permissions, or if a role with the primary key or a 228 resource action with the name and action ID could not be found 229 */ 230 public static void setIndividualResourcePermissions(long groupId, 231 long companyId, java.lang.String name, java.lang.String primKey, 232 java.util.Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds) 233 throws com.liferay.portal.kernel.exception.PortalException { 234 getService() 235 .setIndividualResourcePermissions(groupId, companyId, name, 236 primKey, roleIdsToActionIds); 237 } 238 239 public static ResourcePermissionService getService() { 240 if (_service == null) { 241 _service = (ResourcePermissionService)PortalBeanLocatorUtil.locate(ResourcePermissionService.class.getName()); 242 243 ReferenceRegistry.registerReference(ResourcePermissionServiceUtil.class, 244 "_service"); 245 } 246 247 return _service; 248 } 249 250 /** 251 * @deprecated As of 6.2.0 252 */ 253 @Deprecated 254 public void setService(ResourcePermissionService service) { 255 } 256 257 private static ResourcePermissionService _service; 258 }