1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.service.impl;
16  
17  import com.liferay.portal.PortalException;
18  import com.liferay.portal.SystemException;
19  import com.liferay.portal.model.ResourceConstants;
20  import com.liferay.portal.model.Role;
21  import com.liferay.portal.service.base.ResourcePermissionServiceBaseImpl;
22  
23  /**
24   * <a href="ResourcePermissionServiceImpl.java.html"><b><i>View Source</i></b>
25   * </a>
26   *
27   * @author Brian Wing Shun Chan
28   */
29  public class ResourcePermissionServiceImpl
30      extends ResourcePermissionServiceBaseImpl {
31  
32      public void addResourcePermission(
33              long groupId, long companyId, String name, int scope,
34              String primKey, long roleId, String actionId)
35          throws PortalException, SystemException {
36  
37          permissionService.checkPermission(
38              groupId, Role.class.getName(), roleId);
39  
40          resourcePermissionLocalService.addResourcePermission(
41              companyId, name, scope, primKey, roleId, actionId);
42      }
43  
44      public void setIndividualResourcePermissions(
45              long groupId, long companyId, String name, String primKey,
46              long roleId, String[] actionIds)
47          throws PortalException, SystemException {
48  
49          permissionService.checkPermission(groupId, name, primKey);
50  
51          resourcePermissionLocalService.setResourcePermissions(
52              companyId, name, ResourceConstants.SCOPE_INDIVIDUAL, primKey,
53              roleId, actionIds);
54      }
55  
56      public void removeResourcePermission(
57              long groupId, long companyId, String name, int scope,
58              String primKey, long roleId, String actionId)
59          throws PortalException, SystemException {
60  
61          permissionService.checkPermission(
62              groupId, Role.class.getName(), roleId);
63  
64          resourcePermissionLocalService.removeResourcePermission(
65              companyId, name, scope, primKey, roleId, actionId);
66      }
67  
68      public void removeResourcePermissions(
69              long groupId, long companyId, String name, int scope, long roleId,
70              String actionId)
71          throws PortalException, SystemException {
72  
73          permissionService.checkPermission(
74              groupId, Role.class.getName(), roleId);
75  
76          resourcePermissionLocalService.removeResourcePermissions(
77              companyId, name, scope, roleId, actionId);
78      }
79  
80  }