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