1   /**
2    * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.service;
24  
25  /**
26   * <a href="PermissionServiceUtil.java.html"><b><i>View Source</i></b></a>
27   *
28   * <p>
29   * ServiceBuilder generated this class. Modifications in this class will be overwritten
30   * the next time is generated.
31   * </p>
32   *
33   * <p>
34   * This class provides static methods for the <code>com.liferay.portal.service.PermissionService</code>
35   * bean. The static methods of this class calls the same methods of the bean instance.
36   * It's convenient to be able to just write one line to call a method on a bean
37   * instead of writing a lookup call and a method call.
38   * </p>
39   *
40   * <p>
41   * <code>com.liferay.portal.service.PermissionServiceFactory</code> is responsible
42   * for the lookup of the bean.
43   * </p>
44   *
45   * @author Brian Wing Shun Chan
46   *
47   * @see com.liferay.portal.service.PermissionService
48   * @see com.liferay.portal.service.PermissionServiceFactory
49   *
50   */
51  public class PermissionServiceUtil {
52      public static void checkPermission(long groupId, java.lang.String name,
53          java.lang.String primKey)
54          throws com.liferay.portal.PortalException, 
55              com.liferay.portal.SystemException, java.rmi.RemoteException {
56          PermissionService permissionService = PermissionServiceFactory.getService();
57          permissionService.checkPermission(groupId, name, primKey);
58      }
59  
60      public static boolean hasGroupPermission(long groupId,
61          java.lang.String actionId, long resourceId)
62          throws com.liferay.portal.PortalException, 
63              com.liferay.portal.SystemException, java.rmi.RemoteException {
64          PermissionService permissionService = PermissionServiceFactory.getService();
65  
66          return permissionService.hasGroupPermission(groupId, actionId,
67              resourceId);
68      }
69  
70      public static boolean hasUserPermission(long userId,
71          java.lang.String actionId, long resourceId)
72          throws com.liferay.portal.PortalException, 
73              com.liferay.portal.SystemException, java.rmi.RemoteException {
74          PermissionService permissionService = PermissionServiceFactory.getService();
75  
76          return permissionService.hasUserPermission(userId, actionId, resourceId);
77      }
78  
79      public static boolean hasUserPermissions(long userId, long groupId,
80          java.lang.String actionId, long[] resourceIds,
81          com.liferay.portal.kernel.security.permission.PermissionCheckerBag permissionCheckerBag)
82          throws com.liferay.portal.PortalException, 
83              com.liferay.portal.SystemException, java.rmi.RemoteException {
84          PermissionService permissionService = PermissionServiceFactory.getService();
85  
86          return permissionService.hasUserPermissions(userId, groupId, actionId,
87              resourceIds, permissionCheckerBag);
88      }
89  
90      public static void setGroupPermissions(long groupId,
91          java.lang.String[] actionIds, long resourceId)
92          throws com.liferay.portal.PortalException, 
93              com.liferay.portal.SystemException, java.rmi.RemoteException {
94          PermissionService permissionService = PermissionServiceFactory.getService();
95          permissionService.setGroupPermissions(groupId, actionIds, resourceId);
96      }
97  
98      public static void setGroupPermissions(java.lang.String className,
99          java.lang.String classPK, long groupId, java.lang.String[] actionIds,
100         long resourceId)
101         throws com.liferay.portal.PortalException, 
102             com.liferay.portal.SystemException, java.rmi.RemoteException {
103         PermissionService permissionService = PermissionServiceFactory.getService();
104         permissionService.setGroupPermissions(className, classPK, groupId,
105             actionIds, resourceId);
106     }
107 
108     public static void setOrgGroupPermissions(long organizationId,
109         long groupId, java.lang.String[] actionIds, long resourceId)
110         throws com.liferay.portal.PortalException, 
111             com.liferay.portal.SystemException, java.rmi.RemoteException {
112         PermissionService permissionService = PermissionServiceFactory.getService();
113         permissionService.setOrgGroupPermissions(organizationId, groupId,
114             actionIds, resourceId);
115     }
116 
117     public static void setRolePermission(long roleId, long groupId,
118         java.lang.String name, int scope, java.lang.String primKey,
119         java.lang.String actionId)
120         throws com.liferay.portal.PortalException, 
121             com.liferay.portal.SystemException, java.rmi.RemoteException {
122         PermissionService permissionService = PermissionServiceFactory.getService();
123         permissionService.setRolePermission(roleId, groupId, name, scope,
124             primKey, actionId);
125     }
126 
127     public static void setUserPermissions(long userId, long groupId,
128         java.lang.String[] actionIds, long resourceId)
129         throws com.liferay.portal.PortalException, 
130             com.liferay.portal.SystemException, java.rmi.RemoteException {
131         PermissionService permissionService = PermissionServiceFactory.getService();
132         permissionService.setUserPermissions(userId, groupId, actionIds,
133             resourceId);
134     }
135 
136     public static void unsetRolePermission(long roleId, long groupId,
137         long permissionId)
138         throws com.liferay.portal.PortalException, 
139             com.liferay.portal.SystemException, java.rmi.RemoteException {
140         PermissionService permissionService = PermissionServiceFactory.getService();
141         permissionService.unsetRolePermission(roleId, groupId, permissionId);
142     }
143 
144     public static void unsetRolePermission(long roleId, long groupId,
145         java.lang.String name, int scope, java.lang.String primKey,
146         java.lang.String actionId)
147         throws com.liferay.portal.PortalException, 
148             com.liferay.portal.SystemException, java.rmi.RemoteException {
149         PermissionService permissionService = PermissionServiceFactory.getService();
150         permissionService.unsetRolePermission(roleId, groupId, name, scope,
151             primKey, actionId);
152     }
153 
154     public static void unsetRolePermissions(long roleId, long groupId,
155         java.lang.String name, int scope, java.lang.String actionId)
156         throws com.liferay.portal.PortalException, 
157             com.liferay.portal.SystemException, java.rmi.RemoteException {
158         PermissionService permissionService = PermissionServiceFactory.getService();
159         permissionService.unsetRolePermissions(roleId, groupId, name, scope,
160             actionId);
161     }
162 
163     public static void unsetUserPermissions(long userId, long groupId,
164         java.lang.String[] actionIds, long resourceId)
165         throws com.liferay.portal.PortalException, 
166             com.liferay.portal.SystemException, java.rmi.RemoteException {
167         PermissionService permissionService = PermissionServiceFactory.getService();
168         permissionService.unsetUserPermissions(userId, groupId, actionIds,
169             resourceId);
170     }
171 }