001 /** 002 * Copyright (c) 2000-2011 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 062 * scope permissions are deleted. Be aware that this latter behavior can 063 * result in 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 084 name 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 096 * a 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 148 * can be performed on resources of the type. Existing actions are 149 * replaced. 150 * 151 * <p> 152 * This method can be used to set permissions at any scope, but it is 153 * generally only used at the individual scope. For example, it could be 154 * used to set the guest permissions on a blog post. 155 * </p> 156 * 157 * <p> 158 * Depending on the scope, the value of <code>primKey</code> will have 159 * different meanings. For more information, see {@link 160 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 161 * </p> 162 * 163 * @param groupId the primary key of the group 164 * @param companyId the primary key of the company 165 * @param name the resource's name, which can be either a class name or a 166 portlet ID 167 * @param primKey the primary key 168 * @param roleId the primary key of the role 169 * @param actionIds the action IDs of the actions 170 * @throws PortalException if the user did not have permission to set 171 resource permissions, or if a role with the primary key or a 172 resource action with the name and action ID could not be found 173 * @throws SystemException if a system exception occurred 174 */ 175 public void setIndividualResourcePermissions(long groupId, long companyId, 176 java.lang.String name, java.lang.String primKey, long roleId, 177 java.lang.String[] actionIds) 178 throws com.liferay.portal.kernel.exception.PortalException, 179 com.liferay.portal.kernel.exception.SystemException; 180 181 /** 182 * Updates the role's permissions at the scope, setting the actions that 183 * can be performed on resources of the type. Existing actions are 184 * replaced. 185 * 186 * <p> 187 * This method can be used to set permissions at any scope, but it is 188 * generally only used at the individual scope. For example, it could be 189 * used to set the guest permissions on a blog post. 190 * </p> 191 * 192 * <p> 193 * Depending on the scope, the value of <code>primKey</code> will have 194 * different meanings. For more information, see {@link 195 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 196 * </p> 197 * 198 * @param groupId the primary key of the group 199 * @param companyId the primary key of the company 200 * @param name the resource's name, which can be either a class name or a 201 portlet ID 202 * @param primKey the primary key 203 * @param roleIdsToActionIds a map of role IDs to action IDs of the 204 actions 205 * @throws PortalException if the user did not have permission to set 206 resource permissions, or if a role with the primary key or a 207 resource action with the name and action ID could not be found 208 * @throws SystemException if a system exception occurred 209 */ 210 public void setIndividualResourcePermissions(long groupId, long companyId, 211 java.lang.String name, java.lang.String primKey, 212 java.util.Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds) 213 throws com.liferay.portal.kernel.exception.PortalException, 214 com.liferay.portal.kernel.exception.SystemException; 215 }