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.kernel.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 OSGi service identifier. 046 * 047 * @return the OSGi service identifier 048 */ 049 public static java.lang.String getOSGiServiceIdentifier() { 050 return getService().getOSGiServiceIdentifier(); 051 } 052 053 /** 054 * Grants the role permission at the scope to perform the action on 055 * resources of the type. Existing actions are retained. 056 * 057 * <p> 058 * This method cannot be used to grant individual scope permissions, but is 059 * only intended for adding permissions at the company, group, and 060 * group-template scopes. For example, this method could be used to grant a 061 * company scope permission to edit message board posts. 062 * </p> 063 * 064 * <p> 065 * If a company scope permission is granted to resources that the role 066 * already had group scope permissions to, the group scope permissions are 067 * deleted. Likewise, if a group scope permission is granted to resources 068 * that the role already had company scope permissions to, the company scope 069 * permissions are deleted. Be aware that this latter behavior can result in 070 * an overall reduction in permissions for the role. 071 * </p> 072 * 073 * <p> 074 * Depending on the scope, the value of <code>primKey</code> will have 075 * different meanings. For more information, see {@link 076 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 077 * </p> 078 * 079 * @param groupId the primary key of the group 080 * @param companyId the primary key of the company 081 * @param name the resource's name, which can be either a class name or a 082 portlet ID 083 * @param scope the scope. This method only supports company, group, and 084 group-template scope. 085 * @param primKey the primary key 086 * @param roleId the primary key of the role 087 * @param actionId the action ID 088 */ 089 public static void addResourcePermission(long groupId, long companyId, 090 java.lang.String name, int scope, java.lang.String primKey, 091 long roleId, java.lang.String actionId) 092 throws com.liferay.portal.kernel.exception.PortalException { 093 getService() 094 .addResourcePermission(groupId, companyId, name, scope, primKey, 095 roleId, actionId); 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 roleIdsToActionIds a map of role IDs to action IDs of the actions 171 */ 172 public static void setIndividualResourcePermissions(long groupId, 173 long companyId, java.lang.String name, java.lang.String primKey, 174 java.util.Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds) 175 throws com.liferay.portal.kernel.exception.PortalException { 176 getService() 177 .setIndividualResourcePermissions(groupId, companyId, name, 178 primKey, roleIdsToActionIds); 179 } 180 181 /** 182 * Updates the role's permissions at the scope, setting the actions that can 183 * be performed on resources of the type. Existing actions are replaced. 184 * 185 * <p> 186 * This method can be used to set permissions at any scope, but it is 187 * generally only used at the individual scope. For example, it could be 188 * used to set the guest permissions on a blog post. 189 * </p> 190 * 191 * <p> 192 * Depending on the scope, the value of <code>primKey</code> will have 193 * different meanings. For more information, see {@link 194 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 195 * </p> 196 * 197 * @param groupId the primary key of the group 198 * @param companyId the primary key of the company 199 * @param name the resource's name, which can be either a class name or a 200 portlet ID 201 * @param primKey the primary key 202 * @param roleId the primary key of the role 203 * @param actionIds the 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 long roleId, java.lang.String[] actionIds) 208 throws com.liferay.portal.kernel.exception.PortalException { 209 getService() 210 .setIndividualResourcePermissions(groupId, companyId, name, 211 primKey, roleId, actionIds); 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 }