1
22
23 package com.liferay.portal.service.impl;
24
25 import com.liferay.portal.PortalException;
26 import com.liferay.portal.SystemException;
27 import com.liferay.portal.model.ResourceConstants;
28 import com.liferay.portal.model.Role;
29 import com.liferay.portal.service.base.ResourcePermissionServiceBaseImpl;
30
31 import java.rmi.RemoteException;
32
33
39 public class ResourcePermissionServiceImpl
40 extends ResourcePermissionServiceBaseImpl {
41
42 public void addResourcePermission(
43 long groupId, long companyId, String name, int scope,
44 String primKey, long roleId, String actionId)
45 throws PortalException, SystemException {
46
47 try {
48 permissionService.checkPermission(
49 groupId, Role.class.getName(), roleId);
50 }
51 catch (RemoteException re) {
52 throw new SystemException(re);
53 }
54
55 resourcePermissionLocalService.addResourcePermission(
56 companyId, name, scope, primKey, roleId, actionId);
57 }
58
59 public void setIndividualResourcePermissions(
60 long groupId, long companyId, String name, String primKey,
61 long roleId, String[] actionIds)
62 throws PortalException, SystemException {
63
64 try {
65 permissionService.checkPermission(groupId, name, primKey);
66 }
67 catch (RemoteException re) {
68 throw new SystemException(re);
69 }
70
71 resourcePermissionLocalService.setResourcePermissions(
72 companyId, name, ResourceConstants.SCOPE_INDIVIDUAL, primKey,
73 roleId, actionIds);
74 }
75
76 public void removeResourcePermission(
77 long groupId, long companyId, String name, int scope,
78 String primKey, long roleId, String actionId)
79 throws PortalException, SystemException {
80
81 try {
82 permissionService.checkPermission(
83 groupId, Role.class.getName(), roleId);
84 }
85 catch (RemoteException re) {
86 throw new SystemException(re);
87 }
88
89 resourcePermissionLocalService.removeResourcePermission(
90 companyId, name, scope, primKey, roleId, actionId);
91 }
92
93 public void removeResourcePermissions(
94 long groupId, long companyId, String name, int scope, long roleId,
95 String actionId)
96 throws PortalException, SystemException {
97
98 try {
99 permissionService.checkPermission(
100 groupId, Role.class.getName(), roleId);
101 }
102 catch (RemoteException re) {
103 throw new SystemException(re);
104 }
105
106 resourcePermissionLocalService.removeResourcePermissions(
107 companyId, name, scope, roleId, actionId);
108 }
109
110 }