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.http;
022:
023: import com.liferay.portal.service.PermissionServiceUtil;
024:
025: /**
026: * <a href="PermissionServiceJSON.java.html"><b><i>View Source</i></b></a>
027: *
028: * <p>
029: * ServiceBuilder generated this class. Modifications in this class will be
030: * overwritten the next time is generated.
031: * </p>
032: *
033: * <p>
034: * This class provides a JSON utility for the
035: * <code>com.liferay.portal.service.PermissionServiceUtil</code>
036: * service utility. The static methods of this class calls the same methods of
037: * the service utility. However, the signatures are different because it is
038: * difficult for JSON to support certain types.
039: * </p>
040: *
041: * <p>
042: * ServiceBuilder follows certain rules in translating the methods. For example,
043: * if the method in the service utility returns a <code>java.util.List</code>,
044: * that is translated to a <code>org.json.JSONArray</code>. If the method in the
045: * service utility returns a <code>com.liferay.portal.model.Permission</code>,
046: * that is translated to a <code>org.json.JSONObject</code>. Methods that JSON
047: * cannot safely use are skipped. The logic for the translation is encapsulated
048: * in <code>com.liferay.portal.service.http.PermissionJSONSerializer</code>.
049: * </p>
050: *
051: * <p>
052: * This allows you to call the the backend services directly from JavaScript.
053: * See <code>portal-web/docroot/html/portlet/tags_admin/unpacked.js</code> for a
054: * reference of how that portlet uses the generated JavaScript in
055: * <code>portal-web/docroot/html/js/service.js</code> to call the backend
056: * services directly from JavaScript.
057: * </p>
058: *
059: * <p>
060: * The JSON utility is only generated for remote services.
061: * </p>
062: *
063: * @author Brian Wing Shun Chan
064: *
065: * @see com.liferay.portal.service.PermissionServiceUtil
066: * @see com.liferay.portal.service.http.PermissionJSONSerializer
067: *
068: */
069: public class PermissionServiceJSON {
070: public static void checkPermission(long groupId,
071: java.lang.String name, java.lang.String primKey)
072: throws java.rmi.RemoteException,
073: com.liferay.portal.SystemException,
074: com.liferay.portal.PortalException {
075: PermissionServiceUtil.checkPermission(groupId, name, primKey);
076: }
077:
078: public static boolean hasGroupPermission(long groupId,
079: java.lang.String actionId, long resourceId)
080: throws java.rmi.RemoteException,
081: com.liferay.portal.SystemException,
082: com.liferay.portal.PortalException {
083: boolean returnValue = PermissionServiceUtil.hasGroupPermission(
084: groupId, actionId, resourceId);
085:
086: return returnValue;
087: }
088:
089: public static boolean hasUserPermission(long userId,
090: java.lang.String actionId, long resourceId)
091: throws java.rmi.RemoteException,
092: com.liferay.portal.SystemException,
093: com.liferay.portal.PortalException {
094: boolean returnValue = PermissionServiceUtil.hasUserPermission(
095: userId, actionId, resourceId);
096:
097: return returnValue;
098: }
099:
100: public static boolean hasUserPermissions(
101: long userId,
102: long groupId,
103: java.lang.String actionId,
104: long[] resourceIds,
105: com.liferay.portal.kernel.security.permission.PermissionCheckerBag permissionCheckerBag)
106: throws java.rmi.RemoteException,
107: com.liferay.portal.SystemException,
108: com.liferay.portal.PortalException {
109: boolean returnValue = PermissionServiceUtil.hasUserPermissions(
110: userId, groupId, actionId, resourceIds,
111: permissionCheckerBag);
112:
113: return returnValue;
114: }
115:
116: public static void setGroupPermissions(long groupId,
117: java.lang.String[] actionIds, long resourceId)
118: throws java.rmi.RemoteException,
119: com.liferay.portal.SystemException,
120: com.liferay.portal.PortalException {
121: PermissionServiceUtil.setGroupPermissions(groupId, actionIds,
122: resourceId);
123: }
124:
125: public static void setGroupPermissions(java.lang.String className,
126: java.lang.String classPK, long groupId,
127: java.lang.String[] actionIds, long resourceId)
128: throws java.rmi.RemoteException,
129: com.liferay.portal.SystemException,
130: com.liferay.portal.PortalException {
131: PermissionServiceUtil.setGroupPermissions(className, classPK,
132: groupId, actionIds, resourceId);
133: }
134:
135: public static void setOrgGroupPermissions(long organizationId,
136: long groupId, java.lang.String[] actionIds, long resourceId)
137: throws java.rmi.RemoteException,
138: com.liferay.portal.SystemException,
139: com.liferay.portal.PortalException {
140: PermissionServiceUtil.setOrgGroupPermissions(organizationId,
141: groupId, actionIds, resourceId);
142: }
143:
144: public static void setRolePermission(long roleId, long groupId,
145: java.lang.String name, int scope, java.lang.String primKey,
146: java.lang.String actionId) throws java.rmi.RemoteException,
147: com.liferay.portal.SystemException,
148: com.liferay.portal.PortalException {
149: PermissionServiceUtil.setRolePermission(roleId, groupId, name,
150: scope, primKey, actionId);
151: }
152:
153: public static void setRolePermissions(long roleId, long groupId,
154: java.lang.String[] actionIds, long resourceId)
155: throws java.rmi.RemoteException,
156: com.liferay.portal.SystemException,
157: com.liferay.portal.PortalException {
158: PermissionServiceUtil.setRolePermissions(roleId, groupId,
159: actionIds, resourceId);
160: }
161:
162: public static void setUserPermissions(long userId, long groupId,
163: java.lang.String[] actionIds, long resourceId)
164: throws java.rmi.RemoteException,
165: com.liferay.portal.SystemException,
166: com.liferay.portal.PortalException {
167: PermissionServiceUtil.setUserPermissions(userId, groupId,
168: actionIds, resourceId);
169: }
170:
171: public static void unsetRolePermission(long roleId, long groupId,
172: long permissionId) throws java.rmi.RemoteException,
173: com.liferay.portal.SystemException,
174: com.liferay.portal.PortalException {
175: PermissionServiceUtil.unsetRolePermission(roleId, groupId,
176: permissionId);
177: }
178:
179: public static void unsetRolePermission(long roleId, long groupId,
180: java.lang.String name, int scope, java.lang.String primKey,
181: java.lang.String actionId) throws java.rmi.RemoteException,
182: com.liferay.portal.SystemException,
183: com.liferay.portal.PortalException {
184: PermissionServiceUtil.unsetRolePermission(roleId, groupId,
185: name, scope, primKey, actionId);
186: }
187:
188: public static void unsetRolePermissions(long roleId, long groupId,
189: java.lang.String name, int scope, java.lang.String actionId)
190: throws java.rmi.RemoteException,
191: com.liferay.portal.SystemException,
192: com.liferay.portal.PortalException {
193: PermissionServiceUtil.unsetRolePermissions(roleId, groupId,
194: name, scope, actionId);
195: }
196:
197: public static void unsetUserPermissions(long userId, long groupId,
198: java.lang.String[] actionIds, long resourceId)
199: throws java.rmi.RemoteException,
200: com.liferay.portal.SystemException,
201: com.liferay.portal.PortalException {
202: PermissionServiceUtil.unsetUserPermissions(userId, groupId,
203: actionIds, resourceId);
204: }
205: }
|