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