001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.http;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.log.Log;
020    import com.liferay.portal.kernel.log.LogFactoryUtil;
021    import com.liferay.portal.service.ResourcePermissionServiceUtil;
022    
023    import java.rmi.RemoteException;
024    
025    /**
026     * Provides the SOAP utility for the
027     * {@link com.liferay.portal.service.ResourcePermissionServiceUtil} service utility. The
028     * static methods of this class calls the same methods of the service utility.
029     * However, the signatures are different because it is difficult for SOAP to
030     * support certain types.
031     *
032     * <p>
033     * ServiceBuilder follows certain rules in translating the methods. For example,
034     * if the method in the service utility returns a {@link java.util.List}, that
035     * is translated to an array of {@link com.liferay.portal.model.ResourcePermissionSoap}.
036     * If the method in the service utility returns a
037     * {@link com.liferay.portal.model.ResourcePermission}, that is translated to a
038     * {@link com.liferay.portal.model.ResourcePermissionSoap}. Methods that SOAP cannot
039     * safely wire are skipped.
040     * </p>
041     *
042     * <p>
043     * The benefits of using the SOAP utility is that it is cross platform
044     * compatible. SOAP allows different languages like Java, .NET, C++, PHP, and
045     * even Perl, to call the generated services. One drawback of SOAP is that it is
046     * slow because it needs to serialize all calls into a text format (XML).
047     * </p>
048     *
049     * <p>
050     * You can see a list of services at http://localhost:8080/api/axis. Set the
051     * property <b>axis.servlet.hosts.allowed</b> in portal.properties to configure
052     * security.
053     * </p>
054     *
055     * <p>
056     * The SOAP utility is only generated for remote services.
057     * </p>
058     *
059     * @author Brian Wing Shun Chan
060     * @see ResourcePermissionServiceHttp
061     * @see com.liferay.portal.model.ResourcePermissionSoap
062     * @see com.liferay.portal.service.ResourcePermissionServiceUtil
063     * @generated
064     */
065    @ProviderType
066    public class ResourcePermissionServiceSoap {
067            /**
068            * Grants the role permission at the scope to perform the action on
069            * resources of the type. Existing actions are retained.
070            *
071            * <p>
072            * This method cannot be used to grant individual scope permissions, but is
073            * only intended for adding permissions at the company, group, and
074            * group-template scopes. For example, this method could be used to grant a
075            * company scope permission to edit message board posts.
076            * </p>
077            *
078            * <p>
079            * If a company scope permission is granted to resources that the role
080            * already had group scope permissions to, the group scope permissions are
081            * deleted. Likewise, if a group scope permission is granted to resources
082            * that the role already had company scope permissions to, the company scope
083            * permissions are deleted. Be aware that this latter behavior can result in
084            * an overall reduction in permissions for the role.
085            * </p>
086            *
087            * <p>
088            * Depending on the scope, the value of <code>primKey</code> will have
089            * different meanings. For more information, see {@link
090            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
091            * </p>
092            *
093            * @param groupId the primary key of the group
094            * @param companyId the primary key of the company
095            * @param name the resource's name, which can be either a class name or a
096            portlet ID
097            * @param scope the scope. This method only supports company, group, and
098            group-template scope.
099            * @param primKey the primary key
100            * @param roleId the primary key of the role
101            * @param actionId the action ID
102            * @throws PortalException if the user did not have permission to add
103            resource permissions, or if scope was set to individual scope or
104            if a role with the primary key or a resource action with the name
105            and action ID could not be found
106            * @throws SystemException if a system exception occurred
107            */
108            public static void addResourcePermission(long groupId, long companyId,
109                    java.lang.String name, int scope, java.lang.String primKey,
110                    long roleId, java.lang.String actionId) throws RemoteException {
111                    try {
112                            ResourcePermissionServiceUtil.addResourcePermission(groupId,
113                                    companyId, name, scope, primKey, roleId, actionId);
114                    }
115                    catch (Exception e) {
116                            _log.error(e, e);
117    
118                            throw new RemoteException(e.getMessage());
119                    }
120            }
121    
122            /**
123            * Revokes permission at the scope from the role to perform the action on
124            * resources of the type. For example, this method could be used to revoke a
125            * group scope permission to edit blog posts.
126            *
127            * <p>
128            * Depending on the scope, the value of <code>primKey</code> will have
129            * different meanings. For more information, see {@link
130            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
131            * </p>
132            *
133            * @param groupId the primary key of the group
134            * @param companyId the primary key of the company
135            * @param name the resource's name, which can be either a class name or a
136            portlet ID
137            * @param scope the scope
138            * @param primKey the primary key
139            * @param roleId the primary key of the role
140            * @param actionId the action ID
141            * @throws PortalException if the user did not have permission to remove
142            resource permissions, or if a role with the primary key or a
143            resource action with the name and action ID could not be found
144            * @throws SystemException if a system exception occurred
145            */
146            public static void removeResourcePermission(long groupId, long companyId,
147                    java.lang.String name, int scope, java.lang.String primKey,
148                    long roleId, java.lang.String actionId) throws RemoteException {
149                    try {
150                            ResourcePermissionServiceUtil.removeResourcePermission(groupId,
151                                    companyId, name, scope, primKey, roleId, actionId);
152                    }
153                    catch (Exception e) {
154                            _log.error(e, e);
155    
156                            throw new RemoteException(e.getMessage());
157                    }
158            }
159    
160            /**
161            * Revokes all permissions at the scope from the role to perform the action
162            * on resources of the type. For example, this method could be used to
163            * revoke all individual scope permissions to edit blog posts from site
164            * members.
165            *
166            * @param groupId the primary key of the group
167            * @param companyId the primary key of the company
168            * @param name the resource's name, which can be either a class name or a
169            portlet ID
170            * @param scope the scope
171            * @param roleId the primary key of the role
172            * @param actionId the action ID
173            * @throws PortalException if the user did not have permission to remove
174            resource permissions, or if a role with the primary key or a
175            resource action with the name and action ID could not be found
176            * @throws SystemException if a system exception occurred
177            */
178            public static void removeResourcePermissions(long groupId, long companyId,
179                    java.lang.String name, int scope, long roleId, java.lang.String actionId)
180                    throws RemoteException {
181                    try {
182                            ResourcePermissionServiceUtil.removeResourcePermissions(groupId,
183                                    companyId, name, scope, roleId, actionId);
184                    }
185                    catch (Exception e) {
186                            _log.error(e, e);
187    
188                            throw new RemoteException(e.getMessage());
189                    }
190            }
191    
192            /**
193            * Updates the role's permissions at the scope, setting the actions that can
194            * be performed on resources of the type. Existing actions are replaced.
195            *
196            * <p>
197            * This method can be used to set permissions at any scope, but it is
198            * generally only used at the individual scope. For example, it could be
199            * used to set the guest permissions on a blog post.
200            * </p>
201            *
202            * <p>
203            * Depending on the scope, the value of <code>primKey</code> will have
204            * different meanings. For more information, see {@link
205            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
206            * </p>
207            *
208            * @param groupId the primary key of the group
209            * @param companyId the primary key of the company
210            * @param name the resource's name, which can be either a class name or a
211            portlet ID
212            * @param primKey the primary key
213            * @param roleId the primary key of the role
214            * @param actionIds the action IDs of the actions
215            * @throws PortalException if the user did not have permission to set
216            resource permissions, or if a role with the primary key or a
217            resource action with the name and action ID could not be found
218            * @throws SystemException if a system exception occurred
219            */
220            public static void setIndividualResourcePermissions(long groupId,
221                    long companyId, java.lang.String name, java.lang.String primKey,
222                    long roleId, java.lang.String[] actionIds) throws RemoteException {
223                    try {
224                            ResourcePermissionServiceUtil.setIndividualResourcePermissions(groupId,
225                                    companyId, name, primKey, roleId, actionIds);
226                    }
227                    catch (Exception e) {
228                            _log.error(e, e);
229    
230                            throw new RemoteException(e.getMessage());
231                    }
232            }
233    
234            private static Log _log = LogFactoryUtil.getLog(ResourcePermissionServiceSoap.class);
235    }