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 */ 080 public static void addResourcePermission(long groupId, long companyId, 081 java.lang.String name, int scope, java.lang.String primKey, 082 long roleId, java.lang.String actionId) 083 throws com.liferay.portal.kernel.exception.PortalException { 084 getService() 085 .addResourcePermission(groupId, companyId, name, scope, primKey, 086 roleId, actionId); 087 } 088 089 /** 090 * Returns the OSGi service identifier. 091 * 092 * @return the OSGi service identifier 093 */ 094 public static java.lang.String getOSGiServiceIdentifier() { 095 return getService().getOSGiServiceIdentifier(); 096 } 097 098 /** 099 * Revokes permission at the scope from the role to perform the action on 100 * resources of the type. For example, this method could be used to revoke a 101 * group scope permission to edit blog posts. 102 * 103 * <p> 104 * Depending on the scope, the value of <code>primKey</code> will have 105 * different meanings. For more information, see {@link 106 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 107 * </p> 108 * 109 * @param groupId the primary key of the group 110 * @param companyId the primary key of the company 111 * @param name the resource's name, which can be either a class name or a 112 portlet ID 113 * @param scope the scope 114 * @param primKey the primary key 115 * @param roleId the primary key of the role 116 * @param actionId the action ID 117 */ 118 public static void removeResourcePermission(long groupId, long companyId, 119 java.lang.String name, int scope, java.lang.String primKey, 120 long roleId, java.lang.String actionId) 121 throws com.liferay.portal.kernel.exception.PortalException { 122 getService() 123 .removeResourcePermission(groupId, companyId, name, scope, primKey, 124 roleId, actionId); 125 } 126 127 /** 128 * Revokes all permissions at the scope from the role to perform the action 129 * on resources of the type. For example, this method could be used to 130 * revoke all individual scope permissions to edit blog posts from site 131 * members. 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 roleId the primary key of the role 139 * @param actionId the action ID 140 */ 141 public static void removeResourcePermissions(long groupId, long companyId, 142 java.lang.String name, int scope, long roleId, java.lang.String actionId) 143 throws com.liferay.portal.kernel.exception.PortalException { 144 getService() 145 .removeResourcePermissions(groupId, companyId, name, scope, roleId, 146 actionId); 147 } 148 149 /** 150 * Updates the role's permissions at the scope, setting the actions that can 151 * be performed on resources of the type. Existing actions are replaced. 152 * 153 * <p> 154 * This method can be used to set permissions at any scope, but it is 155 * generally only used at the individual scope. For example, it could be 156 * used to set the guest permissions on a blog post. 157 * </p> 158 * 159 * <p> 160 * Depending on the scope, the value of <code>primKey</code> will have 161 * different meanings. For more information, see {@link 162 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 163 * </p> 164 * 165 * @param groupId the primary key of the group 166 * @param companyId the primary key of the company 167 * @param name the resource's name, which can be either a class name or a 168 portlet ID 169 * @param primKey the primary key 170 * @param roleId the primary key of the role 171 * @param actionIds the action IDs of the actions 172 */ 173 public static void setIndividualResourcePermissions(long groupId, 174 long companyId, java.lang.String name, java.lang.String primKey, 175 long roleId, java.lang.String[] actionIds) 176 throws com.liferay.portal.kernel.exception.PortalException { 177 getService() 178 .setIndividualResourcePermissions(groupId, companyId, name, 179 primKey, roleId, actionIds); 180 } 181 182 /** 183 * Updates the role's permissions at the scope, setting the actions that can 184 * be performed on resources of the type. Existing actions are replaced. 185 * 186 * <p> 187 * This method can be used to set permissions at any scope, but it is 188 * generally only used at the individual scope. For example, it could be 189 * used to set the guest permissions on a blog post. 190 * </p> 191 * 192 * <p> 193 * Depending on the scope, the value of <code>primKey</code> will have 194 * different meanings. For more information, see {@link 195 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 196 * </p> 197 * 198 * @param groupId the primary key of the group 199 * @param companyId the primary key of the company 200 * @param name the resource's name, which can be either a class name or a 201 portlet ID 202 * @param primKey the primary key 203 * @param roleIdsToActionIds a map of role IDs to action IDs of the actions 204 */ 205 public static void setIndividualResourcePermissions(long groupId, 206 long companyId, java.lang.String name, java.lang.String primKey, 207 java.util.Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds) 208 throws com.liferay.portal.kernel.exception.PortalException { 209 getService() 210 .setIndividualResourcePermissions(groupId, companyId, name, 211 primKey, roleIdsToActionIds); 212 } 213 214 public static ResourcePermissionService getService() { 215 if (_service == null) { 216 _service = (ResourcePermissionService)PortalBeanLocatorUtil.locate(ResourcePermissionService.class.getName()); 217 218 ReferenceRegistry.registerReference(ResourcePermissionServiceUtil.class, 219 "_service"); 220 } 221 222 return _service; 223 } 224 225 private static ResourcePermissionService _service; 226 }