1
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 import java.rmi.RemoteException;
24
25
31 public class ResourcePermissionServiceImpl
32 extends ResourcePermissionServiceBaseImpl {
33
34 public void addResourcePermission(
35 long groupId, long companyId, String name, int scope,
36 String primKey, long roleId, String actionId)
37 throws PortalException, SystemException {
38
39 try {
40 permissionService.checkPermission(
41 groupId, Role.class.getName(), roleId);
42 }
43 catch (RemoteException re) {
44 throw new SystemException(re);
45 }
46
47 resourcePermissionLocalService.addResourcePermission(
48 companyId, name, scope, primKey, roleId, actionId);
49 }
50
51 public void setIndividualResourcePermissions(
52 long groupId, long companyId, String name, String primKey,
53 long roleId, String[] actionIds)
54 throws PortalException, SystemException {
55
56 try {
57 permissionService.checkPermission(groupId, name, primKey);
58 }
59 catch (RemoteException re) {
60 throw new SystemException(re);
61 }
62
63 resourcePermissionLocalService.setResourcePermissions(
64 companyId, name, ResourceConstants.SCOPE_INDIVIDUAL, primKey,
65 roleId, actionIds);
66 }
67
68 public void removeResourcePermission(
69 long groupId, long companyId, String name, int scope,
70 String primKey, long roleId, String actionId)
71 throws PortalException, SystemException {
72
73 try {
74 permissionService.checkPermission(
75 groupId, Role.class.getName(), roleId);
76 }
77 catch (RemoteException re) {
78 throw new SystemException(re);
79 }
80
81 resourcePermissionLocalService.removeResourcePermission(
82 companyId, name, scope, primKey, roleId, actionId);
83 }
84
85 public void removeResourcePermissions(
86 long groupId, long companyId, String name, int scope, long roleId,
87 String actionId)
88 throws PortalException, SystemException {
89
90 try {
91 permissionService.checkPermission(
92 groupId, Role.class.getName(), roleId);
93 }
94 catch (RemoteException re) {
95 throw new SystemException(re);
96 }
97
98 resourcePermissionLocalService.removeResourcePermissions(
99 companyId, name, scope, roleId, actionId);
100 }
101
102 }