001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.service;
022:
023: /**
024: * <a href="PermissionServiceUtil.java.html"><b><i>View Source</i></b></a>
025: *
026: * <p>
027: * ServiceBuilder generated this class. Modifications in this class will be
028: * overwritten the next time is generated.
029: * </p>
030: *
031: * <p>
032: * This class provides static methods for the
033: * <code>com.liferay.portal.service.PermissionService</code>
034: * bean. The static methods of this class calls the same methods of the bean
035: * instance. It's convenient to be able to just write one line to call a method
036: * on a bean instead of writing a lookup call and a method call.
037: * </p>
038: *
039: * <p>
040: * <code>com.liferay.portal.service.PermissionServiceFactory</code>
041: * is responsible for the lookup of the bean.
042: * </p>
043: *
044: * @author Brian Wing Shun Chan
045: *
046: * @see com.liferay.portal.service.PermissionService
047: * @see com.liferay.portal.service.PermissionServiceFactory
048: *
049: */
050: public class PermissionServiceUtil {
051: public static void checkPermission(long groupId,
052: java.lang.String name, java.lang.String primKey)
053: throws com.liferay.portal.PortalException,
054: com.liferay.portal.SystemException,
055: java.rmi.RemoteException {
056: PermissionService permissionService = PermissionServiceFactory
057: .getService();
058:
059: permissionService.checkPermission(groupId, name, primKey);
060: }
061:
062: public static boolean hasGroupPermission(long groupId,
063: java.lang.String actionId, long resourceId)
064: throws com.liferay.portal.PortalException,
065: com.liferay.portal.SystemException,
066: java.rmi.RemoteException {
067: PermissionService permissionService = PermissionServiceFactory
068: .getService();
069:
070: return permissionService.hasGroupPermission(groupId, actionId,
071: resourceId);
072: }
073:
074: public static boolean hasUserPermission(long userId,
075: java.lang.String actionId, long resourceId)
076: throws com.liferay.portal.PortalException,
077: com.liferay.portal.SystemException,
078: java.rmi.RemoteException {
079: PermissionService permissionService = PermissionServiceFactory
080: .getService();
081:
082: return permissionService.hasUserPermission(userId, actionId,
083: resourceId);
084: }
085:
086: public static boolean hasUserPermissions(
087: long userId,
088: long groupId,
089: java.lang.String actionId,
090: long[] resourceIds,
091: com.liferay.portal.kernel.security.permission.PermissionCheckerBag permissionCheckerBag)
092: throws com.liferay.portal.PortalException,
093: com.liferay.portal.SystemException,
094: java.rmi.RemoteException {
095: PermissionService permissionService = PermissionServiceFactory
096: .getService();
097:
098: return permissionService.hasUserPermissions(userId, groupId,
099: actionId, resourceIds, permissionCheckerBag);
100: }
101:
102: public static void setGroupPermissions(long groupId,
103: java.lang.String[] actionIds, long resourceId)
104: throws com.liferay.portal.PortalException,
105: com.liferay.portal.SystemException,
106: java.rmi.RemoteException {
107: PermissionService permissionService = PermissionServiceFactory
108: .getService();
109:
110: permissionService.setGroupPermissions(groupId, actionIds,
111: resourceId);
112: }
113:
114: public static void setGroupPermissions(java.lang.String className,
115: java.lang.String classPK, long groupId,
116: java.lang.String[] actionIds, long resourceId)
117: throws com.liferay.portal.PortalException,
118: com.liferay.portal.SystemException,
119: java.rmi.RemoteException {
120: PermissionService permissionService = PermissionServiceFactory
121: .getService();
122:
123: permissionService.setGroupPermissions(className, classPK,
124: groupId, actionIds, resourceId);
125: }
126:
127: public static void setOrgGroupPermissions(long organizationId,
128: long groupId, java.lang.String[] actionIds, long resourceId)
129: throws com.liferay.portal.PortalException,
130: com.liferay.portal.SystemException,
131: java.rmi.RemoteException {
132: PermissionService permissionService = PermissionServiceFactory
133: .getService();
134:
135: permissionService.setOrgGroupPermissions(organizationId,
136: groupId, actionIds, resourceId);
137: }
138:
139: public static void setRolePermission(long roleId, long groupId,
140: java.lang.String name, int scope, java.lang.String primKey,
141: java.lang.String actionId)
142: throws com.liferay.portal.PortalException,
143: com.liferay.portal.SystemException,
144: java.rmi.RemoteException {
145: PermissionService permissionService = PermissionServiceFactory
146: .getService();
147:
148: permissionService.setRolePermission(roleId, groupId, name,
149: scope, primKey, actionId);
150: }
151:
152: public static void setRolePermissions(long roleId, long groupId,
153: java.lang.String[] actionIds, long resourceId)
154: throws com.liferay.portal.PortalException,
155: com.liferay.portal.SystemException,
156: java.rmi.RemoteException {
157: PermissionService permissionService = PermissionServiceFactory
158: .getService();
159:
160: permissionService.setRolePermissions(roleId, groupId,
161: actionIds, resourceId);
162: }
163:
164: public static void setUserPermissions(long userId, long groupId,
165: java.lang.String[] actionIds, long resourceId)
166: throws com.liferay.portal.PortalException,
167: com.liferay.portal.SystemException,
168: java.rmi.RemoteException {
169: PermissionService permissionService = PermissionServiceFactory
170: .getService();
171:
172: permissionService.setUserPermissions(userId, groupId,
173: actionIds, resourceId);
174: }
175:
176: public static void unsetRolePermission(long roleId, long groupId,
177: long permissionId)
178: throws com.liferay.portal.PortalException,
179: com.liferay.portal.SystemException,
180: java.rmi.RemoteException {
181: PermissionService permissionService = PermissionServiceFactory
182: .getService();
183:
184: permissionService.unsetRolePermission(roleId, groupId,
185: permissionId);
186: }
187:
188: public static void unsetRolePermission(long roleId, long groupId,
189: java.lang.String name, int scope, java.lang.String primKey,
190: java.lang.String actionId)
191: throws com.liferay.portal.PortalException,
192: com.liferay.portal.SystemException,
193: java.rmi.RemoteException {
194: PermissionService permissionService = PermissionServiceFactory
195: .getService();
196:
197: permissionService.unsetRolePermission(roleId, groupId, name,
198: scope, primKey, actionId);
199: }
200:
201: public static void unsetRolePermissions(long roleId, long groupId,
202: java.lang.String name, int scope, java.lang.String actionId)
203: throws com.liferay.portal.PortalException,
204: com.liferay.portal.SystemException,
205: java.rmi.RemoteException {
206: PermissionService permissionService = PermissionServiceFactory
207: .getService();
208:
209: permissionService.unsetRolePermissions(roleId, groupId, name,
210: scope, actionId);
211: }
212:
213: public static void unsetUserPermissions(long userId, long groupId,
214: java.lang.String[] actionIds, long resourceId)
215: throws com.liferay.portal.PortalException,
216: com.liferay.portal.SystemException,
217: java.rmi.RemoteException {
218: PermissionService permissionService = PermissionServiceFactory
219: .getService();
220:
221: permissionService.unsetUserPermissions(userId, groupId,
222: actionIds, resourceId);
223: }
224: }
|