001 /** 002 * Copyright (c) 2000-2012 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; 016 017 import com.liferay.portal.kernel.exception.PortalException; 018 import com.liferay.portal.kernel.exception.SystemException; 019 import com.liferay.portal.kernel.jsonwebservice.JSONWebService; 020 import com.liferay.portal.kernel.transaction.Isolation; 021 import com.liferay.portal.kernel.transaction.Transactional; 022 023 /** 024 * The interface for the resource permission remote service. 025 * 026 * <p> 027 * This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS credentials because this service can be accessed remotely. 028 * </p> 029 * 030 * @author Brian Wing Shun Chan 031 * @see ResourcePermissionServiceUtil 032 * @see com.liferay.portal.service.base.ResourcePermissionServiceBaseImpl 033 * @see com.liferay.portal.service.impl.ResourcePermissionServiceImpl 034 * @generated 035 */ 036 @JSONWebService 037 @Transactional(isolation = Isolation.PORTAL, rollbackFor = { 038 PortalException.class, SystemException.class}) 039 public interface ResourcePermissionService { 040 /* 041 * NOTE FOR DEVELOPERS: 042 * 043 * Never modify or reference this interface directly. Always use {@link ResourcePermissionServiceUtil} to access the resource permission remote service. Add custom service methods to {@link com.liferay.portal.service.impl.ResourcePermissionServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface. 044 */ 045 046 /** 047 * Grants the role permission at the scope to perform the action on 048 * resources of the type. Existing actions are retained. 049 * 050 * <p> 051 * This method cannot be used to grant individual scope permissions, but is 052 * only intended for adding permissions at the company, group, and 053 * group-template scopes. For example, this method could be used to grant a 054 * company scope permission to edit message board posts. 055 * </p> 056 * 057 * <p> 058 * If a company scope permission is granted to resources that the role 059 * already had group scope permissions to, the group scope permissions are 060 * deleted. Likewise, if a group scope permission is granted to resources 061 * that the role already had company scope permissions to, the company scope 062 * permissions are deleted. Be aware that this latter behavior can result in 063 * an overall reduction in permissions for the role. 064 * </p> 065 * 066 * <p> 067 * Depending on the scope, the value of <code>primKey</code> will have 068 * different meanings. For more information, see {@link 069 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 070 * </p> 071 * 072 * @param groupId the primary key of the group 073 * @param companyId the primary key of the company 074 * @param name the resource's name, which can be either a class name or a 075 portlet ID 076 * @param scope the scope. This method only supports company, group, and 077 group-template scope. 078 * @param primKey the primary key 079 * @param roleId the primary key of the role 080 * @param actionId the action ID 081 * @throws PortalException if the user did not have permission to add 082 resource permissions, or if scope was set to individual scope or 083 if a role with the primary key or a resource action with the name 084 and action ID could not be found 085 * @throws SystemException if a system exception occurred 086 */ 087 public void addResourcePermission(long groupId, long companyId, 088 java.lang.String name, int scope, java.lang.String primKey, 089 long roleId, java.lang.String actionId) 090 throws com.liferay.portal.kernel.exception.PortalException, 091 com.liferay.portal.kernel.exception.SystemException; 092 093 /** 094 * Revokes permission at the scope from the role to perform the action on 095 * resources of the type. For example, this method could be used to revoke a 096 * group scope permission to edit blog posts. 097 * 098 * <p> 099 * Depending on the scope, the value of <code>primKey</code> will have 100 * different meanings. For more information, see {@link 101 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 102 * </p> 103 * 104 * @param groupId the primary key of the group 105 * @param companyId the primary key of the company 106 * @param name the resource's name, which can be either a class name or a 107 portlet ID 108 * @param scope the scope 109 * @param primKey the primary key 110 * @param roleId the primary key of the role 111 * @param actionId the action ID 112 * @throws PortalException if the user did not have permission to remove 113 resource permissions, or if a role with the primary key or a 114 resource action with the name and action ID could not be found 115 * @throws SystemException if a system exception occurred 116 */ 117 public void removeResourcePermission(long groupId, long companyId, 118 java.lang.String name, int scope, java.lang.String primKey, 119 long roleId, java.lang.String actionId) 120 throws com.liferay.portal.kernel.exception.PortalException, 121 com.liferay.portal.kernel.exception.SystemException; 122 123 /** 124 * Revokes all permissions at the scope from the role to perform the action 125 * on resources of the type. For example, this method could be used to 126 * revoke all individual scope permissions to edit blog posts from site 127 * members. 128 * 129 * @param groupId the primary key of the group 130 * @param companyId the primary key of the company 131 * @param name the resource's name, which can be either a class name or a 132 portlet ID 133 * @param scope the scope 134 * @param roleId the primary key of the role 135 * @param actionId the action ID 136 * @throws PortalException if the user did not have permission to remove 137 resource permissions, or if a role with the primary key or a 138 resource action with the name and action ID could not be found 139 * @throws SystemException if a system exception occurred 140 */ 141 public void removeResourcePermissions(long groupId, long companyId, 142 java.lang.String name, int scope, long roleId, java.lang.String actionId) 143 throws com.liferay.portal.kernel.exception.PortalException, 144 com.liferay.portal.kernel.exception.SystemException; 145 146 /** 147 * Updates the role's permissions at the scope, setting the actions that can 148 * be performed on resources of the type. Existing actions are replaced. 149 * 150 * <p> 151 * This method can be used to set permissions at any scope, but it is 152 * generally only used at the individual scope. For example, it could be 153 * used to set the guest permissions on a blog post. 154 * </p> 155 * 156 * <p> 157 * Depending on the scope, the value of <code>primKey</code> will have 158 * different meanings. For more information, see {@link 159 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 160 * </p> 161 * 162 * @param groupId the primary key of the group 163 * @param companyId the primary key of the company 164 * @param name the resource's name, which can be either a class name or a 165 portlet ID 166 * @param primKey the primary key 167 * @param roleId the primary key of the role 168 * @param actionIds the action IDs of the actions 169 * @throws PortalException if the user did not have permission to set 170 resource permissions, or if a role with the primary key or a 171 resource action with the name and action ID could not be found 172 * @throws SystemException if a system exception occurred 173 */ 174 public void setIndividualResourcePermissions(long groupId, long companyId, 175 java.lang.String name, java.lang.String primKey, long roleId, 176 java.lang.String[] actionIds) 177 throws com.liferay.portal.kernel.exception.PortalException, 178 com.liferay.portal.kernel.exception.SystemException; 179 180 /** 181 * Updates the role's permissions at the scope, setting the actions that can 182 * be performed on resources of the type. Existing actions are replaced. 183 * 184 * <p> 185 * This method can be used to set permissions at any scope, but it is 186 * generally only used at the individual scope. For example, it could be 187 * used to set the guest permissions on a blog post. 188 * </p> 189 * 190 * <p> 191 * Depending on the scope, the value of <code>primKey</code> will have 192 * different meanings. For more information, see {@link 193 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 194 * </p> 195 * 196 * @param groupId the primary key of the group 197 * @param companyId the primary key of the company 198 * @param name the resource's name, which can be either a class name or a 199 portlet ID 200 * @param primKey the primary key 201 * @param roleIdsToActionIds a map of role IDs to action IDs of the actions 202 * @throws PortalException if the user did not have permission to set 203 resource permissions, or if a role with the primary key or a 204 resource action with the name and action ID could not be found 205 * @throws SystemException if a system exception occurred 206 */ 207 public void setIndividualResourcePermissions(long groupId, long companyId, 208 java.lang.String name, java.lang.String primKey, 209 java.util.Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds) 210 throws com.liferay.portal.kernel.exception.PortalException, 211 com.liferay.portal.kernel.exception.SystemException; 212 }