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.Propagation; 022 import com.liferay.portal.kernel.transaction.Transactional; 023 024 /** 025 * The interface for the permission remote service. 026 * 027 * <p> 028 * 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. 029 * </p> 030 * 031 * @author Brian Wing Shun Chan 032 * @see PermissionServiceUtil 033 * @see com.liferay.portal.service.base.PermissionServiceBaseImpl 034 * @see com.liferay.portal.service.impl.PermissionServiceImpl 035 * @generated 036 */ 037 @JSONWebService 038 @Transactional(isolation = Isolation.PORTAL, rollbackFor = { 039 PortalException.class, SystemException.class}) 040 public interface PermissionService { 041 /* 042 * NOTE FOR DEVELOPERS: 043 * 044 * Never modify or reference this interface directly. Always use {@link PermissionServiceUtil} to access the permission remote service. Add custom service methods to {@link com.liferay.portal.service.impl.PermissionServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface. 045 */ 046 047 /** 048 * Checks to see if the group has permission to the resource. 049 * 050 * @param groupId the primary key of the group 051 * @param resourceId the primary key of the resource 052 * @throws PortalException if the group did not have permission to the 053 resource, or if a group or resource with the primary key could 054 not be found or was invalid 055 * @throws SystemException if a system exception occurred 056 */ 057 public void checkPermission(long groupId, long resourceId) 058 throws com.liferay.portal.kernel.exception.PortalException, 059 com.liferay.portal.kernel.exception.SystemException; 060 061 /** 062 * Checks to see if the group has permission to the service. 063 * 064 * @param groupId the primary key of the group 065 * @param name the service name 066 * @param primKey the primary key of the service 067 * @throws PortalException if the group did not have permission to the 068 service, if a group with the primary key could not be found or if 069 the permission information was invalid 070 * @throws SystemException if a system exception occurred 071 */ 072 public void checkPermission(long groupId, java.lang.String name, 073 long primKey) 074 throws com.liferay.portal.kernel.exception.PortalException, 075 com.liferay.portal.kernel.exception.SystemException; 076 077 /** 078 * Checks to see if the group has permission to the service. 079 * 080 * @param groupId the primary key of the group 081 * @param name the service name 082 * @param primKey the primary key of the service 083 * @throws PortalException if the group did not have permission to the 084 service, if a group with the primary key could not be found or if 085 the permission information was invalid 086 * @throws SystemException if a system exception occurred 087 */ 088 public void checkPermission(long groupId, java.lang.String name, 089 java.lang.String primKey) 090 throws com.liferay.portal.kernel.exception.PortalException, 091 com.liferay.portal.kernel.exception.SystemException; 092 093 /** 094 * Returns <code>true</code> if the group has permission to perform the 095 * action on the resource. 096 * 097 * @param groupId the primary key of the group 098 * @param actionId the action's ID 099 * @param resourceId the primary key of the resource 100 * @return <code>true</code> if the group has permission to perform the 101 action on the resource; <code>false</code> otherwise 102 * @throws SystemException if a system exception occurred 103 */ 104 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 105 public boolean hasGroupPermission(long groupId, java.lang.String actionId, 106 long resourceId) 107 throws com.liferay.portal.kernel.exception.SystemException; 108 109 /** 110 * Returns <code>true</code> if the user has permission to perform the 111 * action on the resource. 112 * 113 * @param userId the primary key of the user 114 * @param actionId the action's ID 115 * @param resourceId the primary key of the resource 116 * @return <code>true</code> if the user has permission to perform the 117 action on the resource; <code>false</code> otherwise 118 * @throws SystemException if a system exception occurred 119 */ 120 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 121 public boolean hasUserPermission(long userId, java.lang.String actionId, 122 long resourceId) 123 throws com.liferay.portal.kernel.exception.SystemException; 124 125 /** 126 * Returns <code>true</code> if the user has permission to perform the 127 * action on the resources. 128 * 129 * <p> 130 * This method does not support resources managed by the resource block 131 * system. 132 * </p> 133 * 134 * @param userId the primary key of the user 135 * @param groupId the primary key of the group containing the resource 136 * @param resources representations of the resource at each scope level 137 returned by {@link 138 com.liferay.portal.security.permission.AdvancedPermissionChecker#getResources( 139 long, long, String, String, String)} 140 * @param actionId the action's ID 141 * @param permissionCheckerBag the permission checker bag 142 * @return <code>true</code> if the user has permission to perform the 143 action on the resources; <code>false</code> otherwise 144 * @throws PortalException if a resource action based on any one of the 145 resources and the action ID could not be found 146 * @throws SystemException if a system exception occurred 147 */ 148 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 149 public boolean hasUserPermissions(long userId, long groupId, 150 java.util.List<com.liferay.portal.model.Resource> resources, 151 java.lang.String actionId, 152 com.liferay.portal.security.permission.PermissionCheckerBag permissionCheckerBag) 153 throws com.liferay.portal.kernel.exception.PortalException, 154 com.liferay.portal.kernel.exception.SystemException; 155 156 /** 157 * Sets the group's permissions to perform the actions on the resource, 158 * replacing the group's existing permissions on the resource. 159 * 160 * @param groupId the primary key of the group 161 * @param actionIds the primary keys of the actions 162 * @param resourceId the primary key of the resource 163 * @throws PortalException if a group with the primary key could not be 164 found or if the group did not have permission to the resource 165 * @throws SystemException if a system exception occurred 166 */ 167 public void setGroupPermissions(long groupId, java.lang.String[] actionIds, 168 long resourceId) 169 throws com.liferay.portal.kernel.exception.PortalException, 170 com.liferay.portal.kernel.exception.SystemException; 171 172 /** 173 * Sets the entity's group permissions to perform the actions on the 174 * resource, replacing the entity's existing group permissions on the 175 * resource. Only {@link com.liferay.portal.model.Organization} and {@link 176 * com.liferay.portal.model.UserGroup} class entities are supported. 177 * 178 * @param className the class name of an organization or user group 179 * @param classPK the primary key of the class 180 * @param groupId the primary key of the group 181 * @param actionIds the primary keys of the actions 182 * @param resourceId the primary key of the resource 183 * @throws PortalException if the group did not have permission to the 184 resource, if an entity with the class name and primary key could 185 not be found, or if the entity's associated group could not be 186 found 187 * @throws SystemException if a system exception occurred 188 */ 189 public void setGroupPermissions(java.lang.String className, 190 java.lang.String classPK, long groupId, java.lang.String[] actionIds, 191 long resourceId) 192 throws com.liferay.portal.kernel.exception.PortalException, 193 com.liferay.portal.kernel.exception.SystemException; 194 195 /** 196 * Sets the permissions of each role to perform respective actions on the 197 * resource, replacing the existing permissions of each role on the 198 * resource. 199 * 200 * @param groupId the primary key of the group 201 * @param companyId the primary key of the company 202 * @param roleIdsToActionIds the map of roles to their new actions on the 203 resource 204 * @param resourceId the primary key of the resource 205 * @throws PortalException if the group did not have permission to the 206 resource 207 * @throws SystemException if a system exception occurred 208 */ 209 public void setIndividualPermissions(long groupId, long companyId, 210 java.util.Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds, 211 long resourceId) 212 throws com.liferay.portal.kernel.exception.PortalException, 213 com.liferay.portal.kernel.exception.SystemException; 214 215 /** 216 * Sets the organization permission to perform the actions on the resource 217 * for a particular group, replacing the organization's existing permissions 218 * on the resource. 219 * 220 * @param organizationId the primary key of the organization 221 * @param groupId the primary key of the group in which to scope the 222 permissions 223 * @param actionIds the primary keys of the actions 224 * @param resourceId the primary key of the resource 225 * @throws PortalException if the group did not have permission to the 226 resource or if an organization with the primary key could not be 227 found 228 * @throws SystemException if a system exception occurred 229 */ 230 public void setOrgGroupPermissions(long organizationId, long groupId, 231 java.lang.String[] actionIds, long resourceId) 232 throws com.liferay.portal.kernel.exception.PortalException, 233 com.liferay.portal.kernel.exception.SystemException; 234 235 /** 236 * Sets the role's permissions to perform the action on the named resource, 237 * replacing the role's existing permissions on the resource. 238 * 239 * @param roleId the primary key of the role 240 * @param groupId the primary key of the group 241 * @param name the resource name 242 * @param scope the resource scope 243 * @param primKey the resource primKey 244 * @param actionId the action's ID 245 * @throws PortalException if the group did not have permission to the role 246 or if the scope was {@link 247 com.liferay.portal.model.ResourceConstants#SCOPE_INDIVIDUAL} 248 * @throws SystemException if a system exception occurred 249 */ 250 public void setRolePermission(long roleId, long groupId, 251 java.lang.String name, int scope, java.lang.String primKey, 252 java.lang.String actionId) 253 throws com.liferay.portal.kernel.exception.PortalException, 254 com.liferay.portal.kernel.exception.SystemException; 255 256 /** 257 * Sets the role's permissions to perform the actions on the resource, 258 * replacing the role's existing permissions on the resource. 259 * 260 * @param roleId the primary key of the role 261 * @param groupId the primary key of the group 262 * @param actionIds the primary keys of the actions 263 * @param resourceId the primary key of the resource 264 * @throws PortalException if the group did not have permission to the 265 resource or if a role with the primary key could not be found 266 * @throws SystemException if a system exception occurred 267 */ 268 public void setRolePermissions(long roleId, long groupId, 269 java.lang.String[] actionIds, long resourceId) 270 throws com.liferay.portal.kernel.exception.PortalException, 271 com.liferay.portal.kernel.exception.SystemException; 272 273 /** 274 * Sets the user's permissions to perform the actions on the resource, 275 * replacing the user's existing permissions on the resource. 276 * 277 * @param userId the primary key of the user 278 * @param groupId the primary key of the group 279 * @param actionIds the primary keys of the actions 280 * @param resourceId the primary key of the resource 281 * @throws PortalException if the group did not have permission to the 282 resource or if a user with the primary key could not be found 283 * @throws SystemException if a system exception occurred 284 */ 285 public void setUserPermissions(long userId, long groupId, 286 java.lang.String[] actionIds, long resourceId) 287 throws com.liferay.portal.kernel.exception.PortalException, 288 com.liferay.portal.kernel.exception.SystemException; 289 290 /** 291 * Removes the permission from the role. 292 * 293 * @param roleId the primary key of the role 294 * @param groupId the primary key of the group 295 * @param permissionId the primary key of the permission 296 * @throws PortalException if the group did not have permission to the role 297 * @throws SystemException if a system exception occurred 298 */ 299 public void unsetRolePermission(long roleId, long groupId, long permissionId) 300 throws com.liferay.portal.kernel.exception.PortalException, 301 com.liferay.portal.kernel.exception.SystemException; 302 303 /** 304 * Removes the role's permissions to perform the action on the named 305 * resource with the scope and primKey. 306 * 307 * @param roleId the primary key of the role 308 * @param groupId the primary key of the group 309 * @param name the resource name 310 * @param scope the resource scope 311 * @param primKey the resource primKey 312 * @param actionId the action's ID 313 * @throws PortalException if the group did not have permission to the role 314 * @throws SystemException if a system exception occurred 315 */ 316 public void unsetRolePermission(long roleId, long groupId, 317 java.lang.String name, int scope, java.lang.String primKey, 318 java.lang.String actionId) 319 throws com.liferay.portal.kernel.exception.PortalException, 320 com.liferay.portal.kernel.exception.SystemException; 321 322 /** 323 * Removes the role's permissions to perform the action on the named 324 * resource. 325 * 326 * @param roleId the primary key of the role 327 * @param groupId the primary key of the group 328 * @param name the resource name 329 * @param scope the resource scope 330 * @param actionId the action's ID 331 * @throws PortalException if the group did not have permission to the role 332 * @throws SystemException if a system exception occurred 333 */ 334 public void unsetRolePermissions(long roleId, long groupId, 335 java.lang.String name, int scope, java.lang.String actionId) 336 throws com.liferay.portal.kernel.exception.PortalException, 337 com.liferay.portal.kernel.exception.SystemException; 338 339 /** 340 * Removes the user's permissions to perform the actions on the resource. 341 * 342 * @param userId the primary key of the user 343 * @param groupId the primary key of the group 344 * @param actionIds the primary keys of the actions 345 * @param resourceId the primary key of the resource 346 * @throws PortalException if the group did not have permission to the 347 resource 348 * @throws SystemException if a system exception occurred 349 */ 350 public void unsetUserPermissions(long userId, long groupId, 351 java.lang.String[] actionIds, long resourceId) 352 throws com.liferay.portal.kernel.exception.PortalException, 353 com.liferay.portal.kernel.exception.SystemException; 354 }