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