1   /**
2    * Copyright (c) 2000-2009 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  /**
27   * <a href="PermissionServiceUtil.java.html"><b><i>View Source</i></b></a>
28   *
29   * <p>
30   * ServiceBuilder generated this class. Modifications in this class will be
31   * overwritten the next time is generated.
32   * </p>
33   *
34   * <p>
35   * This class provides static methods for the
36   * <code>com.liferay.portal.service.PermissionService</code>
37   * bean. The static methods of this class calls the same methods of the bean
38   * instance. It's convenient to be able to just write one line to call a method
39   * on a bean instead of writing a lookup call and a method call.
40   * </p>
41   *
42   * @author Brian Wing Shun Chan
43   *
44   * @see com.liferay.portal.service.PermissionService
45   *
46   */
47  public class PermissionServiceUtil {
48      public static void checkPermission(long groupId, long resourceId)
49          throws com.liferay.portal.PortalException,
50              com.liferay.portal.SystemException, java.rmi.RemoteException {
51          getService().checkPermission(groupId, resourceId);
52      }
53  
54      public static void checkPermission(long groupId, java.lang.String name,
55          long primKey)
56          throws com.liferay.portal.PortalException,
57              com.liferay.portal.SystemException, java.rmi.RemoteException {
58          getService().checkPermission(groupId, name, primKey);
59      }
60  
61      public static void checkPermission(long groupId, java.lang.String name,
62          java.lang.String primKey)
63          throws com.liferay.portal.PortalException,
64              com.liferay.portal.SystemException, java.rmi.RemoteException {
65          getService().checkPermission(groupId, name, primKey);
66      }
67  
68      public static boolean hasGroupPermission(long groupId,
69          java.lang.String actionId, long resourceId)
70          throws com.liferay.portal.SystemException, java.rmi.RemoteException {
71          return getService().hasGroupPermission(groupId, actionId, resourceId);
72      }
73  
74      public static boolean hasUserPermission(long userId,
75          java.lang.String actionId, long resourceId)
76          throws com.liferay.portal.SystemException, java.rmi.RemoteException {
77          return getService().hasUserPermission(userId, actionId, resourceId);
78      }
79  
80      public static boolean hasUserPermissions(long userId, long groupId,
81          java.util.List<com.liferay.portal.model.Resource> resources,
82          java.lang.String actionId,
83          com.liferay.portal.security.permission.PermissionCheckerBag permissionCheckerBag)
84          throws com.liferay.portal.PortalException,
85              com.liferay.portal.SystemException, java.rmi.RemoteException {
86          return getService()
87                     .hasUserPermissions(userId, groupId, resources, actionId,
88              permissionCheckerBag);
89      }
90  
91      public static void setGroupPermissions(long groupId,
92          java.lang.String[] actionIds, long resourceId)
93          throws com.liferay.portal.PortalException,
94              com.liferay.portal.SystemException, java.rmi.RemoteException {
95          getService().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         getService()
104             .setGroupPermissions(className, classPK, groupId, actionIds,
105             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         getService()
113             .setOrgGroupPermissions(organizationId, groupId, actionIds,
114             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         getService()
123             .setRolePermission(roleId, groupId, name, scope, primKey, actionId);
124     }
125 
126     public static void setRolePermissions(long roleId, long groupId,
127         java.lang.String[] actionIds, long resourceId)
128         throws com.liferay.portal.PortalException,
129             com.liferay.portal.SystemException, java.rmi.RemoteException {
130         getService().setRolePermissions(roleId, groupId, actionIds, resourceId);
131     }
132 
133     public static void setUserPermissions(long userId, long groupId,
134         java.lang.String[] actionIds, long resourceId)
135         throws com.liferay.portal.PortalException,
136             com.liferay.portal.SystemException, java.rmi.RemoteException {
137         getService().setUserPermissions(userId, groupId, actionIds, resourceId);
138     }
139 
140     public static void unsetRolePermission(long roleId, long groupId,
141         long permissionId)
142         throws com.liferay.portal.PortalException,
143             com.liferay.portal.SystemException, java.rmi.RemoteException {
144         getService().unsetRolePermission(roleId, groupId, permissionId);
145     }
146 
147     public static void unsetRolePermission(long roleId, long groupId,
148         java.lang.String name, int scope, java.lang.String primKey,
149         java.lang.String actionId)
150         throws com.liferay.portal.PortalException,
151             com.liferay.portal.SystemException, java.rmi.RemoteException {
152         getService()
153             .unsetRolePermission(roleId, groupId, name, scope, primKey, actionId);
154     }
155 
156     public static void unsetRolePermissions(long roleId, long groupId,
157         java.lang.String name, int scope, java.lang.String actionId)
158         throws com.liferay.portal.PortalException,
159             com.liferay.portal.SystemException, java.rmi.RemoteException {
160         getService().unsetRolePermissions(roleId, groupId, name, scope, 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         getService().unsetUserPermissions(userId, groupId, actionIds, resourceId);
168     }
169 
170     public static PermissionService getService() {
171         if (_service == null) {
172             throw new RuntimeException("PermissionService is not set");
173         }
174 
175         return _service;
176     }
177 
178     public void setService(PermissionService service) {
179         _service = service;
180     }
181 
182     private static PermissionService _service;
183 }