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, java.lang.String name,
49          java.lang.String primKey)
50          throws com.liferay.portal.PortalException,
51              com.liferay.portal.SystemException {
52          getService().checkPermission(groupId, name, primKey);
53      }
54  
55      public static boolean hasGroupPermission(long groupId,
56          java.lang.String actionId, long resourceId)
57          throws com.liferay.portal.SystemException {
58          return getService().hasGroupPermission(groupId, actionId, resourceId);
59      }
60  
61      public static boolean hasUserPermission(long userId,
62          java.lang.String actionId, long resourceId)
63          throws com.liferay.portal.SystemException {
64          return getService().hasUserPermission(userId, actionId, resourceId);
65      }
66  
67      public static boolean hasUserPermissions(long userId, long groupId,
68          java.lang.String actionId, long[] resourceIds,
69          com.liferay.portal.security.permission.PermissionCheckerBag permissionCheckerBag)
70          throws com.liferay.portal.SystemException {
71          return getService()
72                     .hasUserPermissions(userId, groupId, actionId, resourceIds,
73              permissionCheckerBag);
74      }
75  
76      public static void setGroupPermissions(long groupId,
77          java.lang.String[] actionIds, long resourceId)
78          throws com.liferay.portal.PortalException,
79              com.liferay.portal.SystemException {
80          getService().setGroupPermissions(groupId, actionIds, resourceId);
81      }
82  
83      public static void setGroupPermissions(java.lang.String className,
84          java.lang.String classPK, long groupId, java.lang.String[] actionIds,
85          long resourceId)
86          throws com.liferay.portal.PortalException,
87              com.liferay.portal.SystemException {
88          getService()
89              .setGroupPermissions(className, classPK, groupId, actionIds,
90              resourceId);
91      }
92  
93      public static void setOrgGroupPermissions(long organizationId,
94          long groupId, java.lang.String[] actionIds, long resourceId)
95          throws com.liferay.portal.PortalException,
96              com.liferay.portal.SystemException {
97          getService()
98              .setOrgGroupPermissions(organizationId, groupId, actionIds,
99              resourceId);
100     }
101 
102     public static void setRolePermission(long roleId, long groupId,
103         java.lang.String name, int scope, java.lang.String primKey,
104         java.lang.String actionId)
105         throws com.liferay.portal.PortalException,
106             com.liferay.portal.SystemException {
107         getService()
108             .setRolePermission(roleId, groupId, name, scope, primKey, actionId);
109     }
110 
111     public static void setRolePermissions(long roleId, long groupId,
112         java.lang.String[] actionIds, long resourceId)
113         throws com.liferay.portal.PortalException,
114             com.liferay.portal.SystemException {
115         getService().setRolePermissions(roleId, groupId, actionIds, resourceId);
116     }
117 
118     public static void setUserPermissions(long userId, long groupId,
119         java.lang.String[] actionIds, long resourceId)
120         throws com.liferay.portal.PortalException,
121             com.liferay.portal.SystemException {
122         getService().setUserPermissions(userId, groupId, actionIds, resourceId);
123     }
124 
125     public static void unsetRolePermission(long roleId, long groupId,
126         long permissionId)
127         throws com.liferay.portal.PortalException,
128             com.liferay.portal.SystemException {
129         getService().unsetRolePermission(roleId, groupId, permissionId);
130     }
131 
132     public static void unsetRolePermission(long roleId, long groupId,
133         java.lang.String name, int scope, java.lang.String primKey,
134         java.lang.String actionId)
135         throws com.liferay.portal.PortalException,
136             com.liferay.portal.SystemException {
137         getService()
138             .unsetRolePermission(roleId, groupId, name, scope, primKey, actionId);
139     }
140 
141     public static void unsetRolePermissions(long roleId, long groupId,
142         java.lang.String name, int scope, java.lang.String actionId)
143         throws com.liferay.portal.PortalException,
144             com.liferay.portal.SystemException {
145         getService().unsetRolePermissions(roleId, groupId, name, scope, actionId);
146     }
147 
148     public static void unsetUserPermissions(long userId, long groupId,
149         java.lang.String[] actionIds, long resourceId)
150         throws com.liferay.portal.PortalException,
151             com.liferay.portal.SystemException {
152         getService().unsetUserPermissions(userId, groupId, actionIds, resourceId);
153     }
154 
155     public static PermissionService getService() {
156         if (_service == null) {
157             throw new RuntimeException("PermissionService is not set");
158         }
159 
160         return _service;
161     }
162 
163     public void setService(PermissionService service) {
164         _service = service;
165     }
166 
167     private static PermissionService _service;
168 }