001 /** 002 * Copyright (c) 2000-present 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.kernel.service; 016 017 import aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery; 020 import com.liferay.portal.kernel.dao.orm.DynamicQuery; 021 import com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery; 022 import com.liferay.portal.kernel.dao.orm.Projection; 023 import com.liferay.portal.kernel.exception.PortalException; 024 import com.liferay.portal.kernel.exception.SystemException; 025 import com.liferay.portal.kernel.model.PersistedModel; 026 import com.liferay.portal.kernel.model.Resource; 027 import com.liferay.portal.kernel.model.ResourceAction; 028 import com.liferay.portal.kernel.model.ResourcePermission; 029 import com.liferay.portal.kernel.model.Role; 030 import com.liferay.portal.kernel.search.Indexable; 031 import com.liferay.portal.kernel.search.IndexableType; 032 import com.liferay.portal.kernel.spring.aop.Property; 033 import com.liferay.portal.kernel.spring.aop.Retry; 034 import com.liferay.portal.kernel.transaction.Isolation; 035 import com.liferay.portal.kernel.transaction.Propagation; 036 import com.liferay.portal.kernel.transaction.Transactional; 037 import com.liferay.portal.kernel.util.OrderByComparator; 038 039 import java.io.Serializable; 040 041 import java.util.Collection; 042 import java.util.List; 043 import java.util.Map; 044 import java.util.Set; 045 046 /** 047 * Provides the local service interface for ResourcePermission. Methods of this 048 * service will not have security checks based on the propagated JAAS 049 * credentials because this service can only be accessed from within the same 050 * VM. 051 * 052 * @author Brian Wing Shun Chan 053 * @see ResourcePermissionLocalServiceUtil 054 * @see com.liferay.portal.service.base.ResourcePermissionLocalServiceBaseImpl 055 * @see com.liferay.portal.service.impl.ResourcePermissionLocalServiceImpl 056 * @generated 057 */ 058 @ProviderType 059 @Transactional(isolation = Isolation.PORTAL, rollbackFor = { 060 PortalException.class, SystemException.class}) 061 public interface ResourcePermissionLocalService extends BaseLocalService, 062 PersistedModelLocalService { 063 /* 064 * NOTE FOR DEVELOPERS: 065 * 066 * Never modify or reference this interface directly. Always use {@link ResourcePermissionLocalServiceUtil} to access the resource permission local service. Add custom service methods to {@link com.liferay.portal.service.impl.ResourcePermissionLocalServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface. 067 */ 068 069 /** 070 * Returns <code>true</code> if the resource permission grants permission to 071 * perform the resource action. Note that this method does not ensure that 072 * the resource permission refers to the same type of resource as the 073 * resource action. 074 * 075 * @param resourcePermission the resource permission 076 * @param resourceAction the resource action 077 * @return <code>true</code> if the resource permission grants permission to 078 perform the resource action 079 */ 080 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 081 public boolean hasActionId(ResourcePermission resourcePermission, 082 ResourceAction resourceAction); 083 084 /** 085 * Returns <code>true</code> if the roles have permission at the scope to 086 * perform the action on the resources. 087 * 088 * <p> 089 * Depending on the scope, the value of <code>primKey</code> will have 090 * different meanings. For more information, see {@link 091 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 092 * </p> 093 * 094 * @param resources the resources 095 * @param roleIds the primary keys of the roles 096 * @param actionId the action ID 097 * @return <code>true</code> if any one of the roles has permission to 098 perform the action on any one of the resources; 099 <code>false</code> otherwise 100 */ 101 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 102 public boolean hasResourcePermission(List<Resource> resources, 103 long[] roleIds, java.lang.String actionId) throws PortalException; 104 105 /** 106 * Returns <code>true</code> if the role has permission at the scope to 107 * perform the action on resources of the type. 108 * 109 * <p> 110 * Depending on the scope, the value of <code>primKey</code> will have 111 * different meanings. For more information, see {@link 112 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 113 * </p> 114 * 115 * @param companyId the primary key of the company 116 * @param name the resource's name, which can be either a class name or a 117 portlet ID 118 * @param scope the scope 119 * @param primKey the primary key 120 * @param roleId the primary key of the role 121 * @param actionId the action ID 122 * @return <code>true</code> if the role has permission to perform the 123 action on the resource; <code>false</code> otherwise 124 */ 125 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 126 public boolean hasResourcePermission(long companyId, java.lang.String name, 127 int scope, java.lang.String primKey, long roleId, 128 java.lang.String actionId) throws PortalException; 129 130 /** 131 * Returns <code>true</code> if the roles have permission at the scope to 132 * perform the action on resources of the type. 133 * 134 * <p> 135 * Depending on the scope, the value of <code>primKey</code> will have 136 * different meanings. For more information, see {@link 137 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 138 * </p> 139 * 140 * @param companyId the primary key of the company 141 * @param name the resource's name, which can be either a class name or a 142 portlet ID 143 * @param scope the scope 144 * @param primKey the primary key 145 * @param roleIds the primary keys of the roles 146 * @param actionId the action ID 147 * @return <code>true</code> if any one of the roles has permission to 148 perform the action on the resource; <code>false</code> otherwise 149 */ 150 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 151 public boolean hasResourcePermission(long companyId, java.lang.String name, 152 int scope, java.lang.String primKey, long[] roleIds, 153 java.lang.String actionId) throws PortalException; 154 155 /** 156 * Returns <code>true</code> if the role has permission at the scope to 157 * perform the action on the resource. 158 * 159 * <p> 160 * Depending on the scope, the value of <code>primKey</code> will have 161 * different meanings. For more information, see {@link 162 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 163 * </p> 164 * 165 * @param companyId the primary key of the company 166 * @param name the resource's name, which can be either a class name or a 167 portlet ID 168 * @param scope the scope 169 * @param roleId the primary key of the role 170 * @param actionId the action ID 171 * @return <code>true</code> if the role has permission to perform the 172 action on the resource; <code>false</code> otherwise 173 */ 174 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 175 public boolean hasScopeResourcePermission(long companyId, 176 java.lang.String name, int scope, long roleId, java.lang.String actionId) 177 throws PortalException; 178 179 /** 180 * @deprecated As of 7.0.0, replaced by {@link #getRoles(long, String, int, 181 String, String} 182 */ 183 @java.lang.Deprecated 184 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 185 public boolean[] hasResourcePermissions(long companyId, 186 java.lang.String name, int scope, java.lang.String primKey, 187 long[] roleIds, java.lang.String actionId) throws PortalException; 188 189 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 190 public ActionableDynamicQuery getActionableDynamicQuery(); 191 192 public DynamicQuery dynamicQuery(); 193 194 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 195 public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery(); 196 197 /** 198 * @throws PortalException 199 */ 200 @Override 201 public PersistedModel deletePersistedModel(PersistedModel persistedModel) 202 throws PortalException; 203 204 @Override 205 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 206 public PersistedModel getPersistedModel(Serializable primaryKeyObj) 207 throws PortalException; 208 209 /** 210 * Adds the resource permission to the database. Also notifies the appropriate model listeners. 211 * 212 * @param resourcePermission the resource permission 213 * @return the resource permission that was added 214 */ 215 @Indexable(type = IndexableType.REINDEX) 216 public ResourcePermission addResourcePermission( 217 ResourcePermission resourcePermission); 218 219 /** 220 * Creates a new resource permission with the primary key. Does not add the resource permission to the database. 221 * 222 * @param resourcePermissionId the primary key for the new resource permission 223 * @return the new resource permission 224 */ 225 public ResourcePermission createResourcePermission( 226 long resourcePermissionId); 227 228 /** 229 * Deletes the resource permission from the database. Also notifies the appropriate model listeners. 230 * 231 * @param resourcePermission the resource permission 232 * @return the resource permission that was removed 233 */ 234 @Indexable(type = IndexableType.DELETE) 235 public ResourcePermission deleteResourcePermission( 236 ResourcePermission resourcePermission); 237 238 /** 239 * Deletes the resource permission with the primary key from the database. Also notifies the appropriate model listeners. 240 * 241 * @param resourcePermissionId the primary key of the resource permission 242 * @return the resource permission that was removed 243 * @throws PortalException if a resource permission with the primary key could not be found 244 */ 245 @Indexable(type = IndexableType.DELETE) 246 public ResourcePermission deleteResourcePermission( 247 long resourcePermissionId) throws PortalException; 248 249 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 250 public ResourcePermission fetchResourcePermission(long companyId, 251 java.lang.String name, int scope, java.lang.String primKey, long roleId); 252 253 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 254 public ResourcePermission fetchResourcePermission(long resourcePermissionId); 255 256 /** 257 * Returns the resource permission for the role at the scope to perform the 258 * actions on resources of the type. 259 * 260 * @param companyId the primary key of the company 261 * @param name the resource's name, which can be either a class name or a 262 portlet ID 263 * @param scope the scope 264 * @param primKey the primary key 265 * @param roleId the primary key of the role 266 * @return the resource permission for the role at the scope to perform the 267 actions on resources of the type 268 */ 269 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 270 public ResourcePermission getResourcePermission(long companyId, 271 java.lang.String name, int scope, java.lang.String primKey, long roleId) 272 throws PortalException; 273 274 /** 275 * Returns the resource permission with the primary key. 276 * 277 * @param resourcePermissionId the primary key of the resource permission 278 * @return the resource permission 279 * @throws PortalException if a resource permission with the primary key could not be found 280 */ 281 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 282 public ResourcePermission getResourcePermission(long resourcePermissionId) 283 throws PortalException; 284 285 /** 286 * Updates the resource permission in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 287 * 288 * @param resourcePermission the resource permission 289 * @return the resource permission that was updated 290 */ 291 @Indexable(type = IndexableType.REINDEX) 292 public ResourcePermission updateResourcePermission( 293 ResourcePermission resourcePermission); 294 295 /** 296 * Returns the number of resource permissions. 297 * 298 * @return the number of resource permissions 299 */ 300 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 301 public int getResourcePermissionsCount(); 302 303 /** 304 * Returns the number of resource permissions at the scope of the type. 305 * 306 * @param companyId the primary key of the company 307 * @param name the resource's name, which can be either a class name or a 308 portlet ID 309 * @param scope the scope 310 * @param primKey the primary key 311 * @return the number of resource permissions at the scope of the type 312 */ 313 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 314 public int getResourcePermissionsCount(long companyId, 315 java.lang.String name, int scope, java.lang.String primKey); 316 317 /** 318 * Returns the OSGi service identifier. 319 * 320 * @return the OSGi service identifier 321 */ 322 public java.lang.String getOSGiServiceIdentifier(); 323 324 /** 325 * Performs a dynamic query on the database and returns the matching rows. 326 * 327 * @param dynamicQuery the dynamic query 328 * @return the matching rows 329 */ 330 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery); 331 332 /** 333 * Performs a dynamic query on the database and returns a range of the matching rows. 334 * 335 * <p> 336 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.ResourcePermissionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 337 * </p> 338 * 339 * @param dynamicQuery the dynamic query 340 * @param start the lower bound of the range of model instances 341 * @param end the upper bound of the range of model instances (not inclusive) 342 * @return the range of matching rows 343 */ 344 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, 345 int end); 346 347 /** 348 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 349 * 350 * <p> 351 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.ResourcePermissionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 352 * </p> 353 * 354 * @param dynamicQuery the dynamic query 355 * @param start the lower bound of the range of model instances 356 * @param end the upper bound of the range of model instances (not inclusive) 357 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 358 * @return the ordered range of matching rows 359 */ 360 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, 361 int end, OrderByComparator<T> orderByComparator); 362 363 /** 364 * Returns the intersection of action IDs the role has permission at the 365 * scope to perform on resources of the type. 366 * 367 * @param companyId he primary key of the company 368 * @param name the resource's name, which can be either a class name or a 369 portlet ID 370 * @param scope the scope 371 * @param primKey the primary key 372 * @param roleId the primary key of the role 373 * @param actionIds the action IDs 374 * @return the intersection of action IDs the role has permission at the 375 scope to perform on resources of the type 376 */ 377 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 378 public List<java.lang.String> getAvailableResourcePermissionActionIds( 379 long companyId, java.lang.String name, int scope, 380 java.lang.String primKey, long roleId, 381 Collection<java.lang.String> actionIds) throws PortalException; 382 383 /** 384 * Returns a range of all the resource permissions. 385 * 386 * <p> 387 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.ResourcePermissionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 388 * </p> 389 * 390 * @param start the lower bound of the range of resource permissions 391 * @param end the upper bound of the range of resource permissions (not inclusive) 392 * @return the range of resource permissions 393 */ 394 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 395 public List<ResourcePermission> getResourcePermissions(int start, int end); 396 397 /** 398 * Returns all the resource permissions at the scope of the type. 399 * 400 * @param companyId the primary key of the company 401 * @param name the resource's name, which can be either a class name or a 402 portlet ID 403 * @param scope the scope 404 * @param primKey the primary key 405 * @return the resource permissions at the scope of the type 406 */ 407 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 408 public List<ResourcePermission> getResourcePermissions(long companyId, 409 java.lang.String name, int scope, java.lang.String primKey); 410 411 /** 412 * Returns the resource permissions that apply to the resource. 413 * 414 * @param companyId the primary key of the resource's company 415 * @param groupId the primary key of the resource's group 416 * @param name the resource's name, which can be either a class name or a 417 portlet ID 418 * @param primKey the primary key of the resource 419 * @return the resource permissions associated with the resource 420 */ 421 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 422 public List<ResourcePermission> getResourceResourcePermissions( 423 long companyId, long groupId, java.lang.String name, 424 java.lang.String primKey); 425 426 /** 427 * Returns all the resource permissions for the role. 428 * 429 * @param roleId the primary key of the role 430 * @return the resource permissions for the role 431 */ 432 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 433 public List<ResourcePermission> getRoleResourcePermissions(long roleId); 434 435 /** 436 * Returns a range of all the resource permissions for the role at the 437 * scopes. 438 * 439 * <p> 440 * Useful when paginating results. Returns a maximum of <code>end - 441 * start</code> instances. <code>start</code> and <code>end</code> are not 442 * primary keys, they are indexes in the result set. Thus, <code>0</code> 443 * refers to the first result in the set. Setting both <code>start</code> 444 * and <code>end</code> to {@link 445 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 446 * result set. 447 * </p> 448 * 449 * @param roleId the primary key of the role 450 * @param scopes the scopes 451 * @param start the lower bound of the range of results 452 * @param end the upper bound of the range of results (not inclusive) 453 * @return the range of resource permissions for the role at the scopes 454 */ 455 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 456 public List<ResourcePermission> getRoleResourcePermissions(long roleId, 457 int[] scopes, int start, int end); 458 459 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 460 public List<Role> getRoles(long companyId, java.lang.String name, 461 int scope, java.lang.String primKey, java.lang.String actionId) 462 throws PortalException; 463 464 /** 465 * Returns all the resource permissions where scope = any ?. 466 * 467 * <p> 468 * Useful when paginating results. Returns a maximum of <code>end - 469 * start</code> instances. <code>start</code> and <code>end</code> are not 470 * primary keys, they are indexes in the result set. Thus, <code>0</code> 471 * refers to the first result in the set. Setting both <code>start</code> 472 * and <code>end</code> to {@link 473 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 474 * result set. 475 * </p> 476 * 477 * @param scopes the scopes 478 * @return the resource permissions where scope = any ? 479 */ 480 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 481 public List<ResourcePermission> getScopeResourcePermissions(int[] scopes); 482 483 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 484 public Map<java.lang.Long, Set<java.lang.String>> getAvailableResourcePermissionActionIds( 485 long companyId, java.lang.String name, int scope, 486 java.lang.String primKey, Collection<java.lang.String> actionIds); 487 488 /** 489 * @deprecated As of 7.0.0, replaced by {@link 490 #getAvailableResourcePermissionActionIds(long, String, int, 491 String, Collection)} 492 */ 493 @java.lang.Deprecated 494 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 495 public Map<java.lang.Long, Set<java.lang.String>> getAvailableResourcePermissionActionIds( 496 long companyId, java.lang.String name, int scope, 497 java.lang.String primKey, long[] roleIds, 498 Collection<java.lang.String> actionIds); 499 500 /** 501 * Returns the number of rows matching the dynamic query. 502 * 503 * @param dynamicQuery the dynamic query 504 * @return the number of rows matching the dynamic query 505 */ 506 public long dynamicQueryCount(DynamicQuery dynamicQuery); 507 508 /** 509 * Returns the number of rows matching the dynamic query. 510 * 511 * @param dynamicQuery the dynamic query 512 * @param projection the projection to apply to the query 513 * @return the number of rows matching the dynamic query 514 */ 515 public long dynamicQueryCount(DynamicQuery dynamicQuery, 516 Projection projection); 517 518 /** 519 * Grants the role permission at the scope to perform the action on 520 * resources of the type. Existing actions are retained. 521 * 522 * <p> 523 * This method cannot be used to grant individual scope permissions, but is 524 * only intended for adding permissions at the company, group, and 525 * group-template scopes. For example, this method could be used to grant a 526 * company scope permission to edit message board posts. 527 * </p> 528 * 529 * <p> 530 * If a company scope permission is granted to resources that the role 531 * already had group scope permissions to, the group scope permissions are 532 * deleted. Likewise, if a group scope permission is granted to resources 533 * that the role already had company scope permissions to, the company scope 534 * permissions are deleted. Be aware that this latter behavior can result in 535 * an overall reduction in permissions for the role. 536 * </p> 537 * 538 * <p> 539 * Depending on the scope, the value of <code>primKey</code> will have 540 * different meanings. For more information, see {@link 541 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 542 * </p> 543 * 544 * @param companyId the primary key of the company 545 * @param name the resource's name, which can be either a class name or a 546 portlet ID 547 * @param scope the scope. This method only supports company, group, and 548 group-template scope. 549 * @param primKey the primary key 550 * @param roleId the primary key of the role 551 * @param actionId the action ID 552 */ 553 @Retry(acceptor = ExceptionRetryAcceptor.class, properties = { 554 @Property(name = ExceptionRetryAcceptor.EXCEPTION_NAME, value = "org.springframework.dao.DataIntegrityViolationException") 555 } 556 ) 557 public void addResourcePermission(long companyId, java.lang.String name, 558 int scope, java.lang.String primKey, long roleId, 559 java.lang.String actionId) throws PortalException; 560 561 /** 562 * Grants the role permissions at the scope to perform the actions on all 563 * resources of the type. Existing actions are retained. 564 * 565 * <p> 566 * This method should only be used to add default permissions to existing 567 * resources en masse during upgrades or while verifying permissions. For 568 * example, this method could be used to grant site members individual scope 569 * permissions to view all blog posts. 570 * </p> 571 * 572 * @param resourceName the resource's name, which can be either a class name 573 or a portlet ID 574 * @param roleName the role's name 575 * @param scope the scope 576 * @param resourceActionBitwiseValue the bitwise IDs of the actions 577 */ 578 public void addResourcePermissions(java.lang.String resourceName, 579 java.lang.String roleName, int scope, long resourceActionBitwiseValue); 580 581 /** 582 * Deletes all resource permissions at the scope to resources of the type. 583 * This method should not be confused with any of the 584 * <code>removeResourcePermission</code> methods, as its purpose is very 585 * different. This method should only be used for deleting resource 586 * permissions that refer to a resource when that resource is deleted. For 587 * example this method could be used to delete all individual scope 588 * permissions to a blog post when it is deleted. 589 * 590 * <p> 591 * Depending on the scope, the value of <code>primKey</code> will have 592 * different meanings. For more information, see {@link 593 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 594 * </p> 595 * 596 * @param companyId the primary key of the company 597 * @param name the resource's name, which can be either a class name or a 598 portlet ID 599 * @param scope the scope 600 * @param primKey the primary key 601 */ 602 public void deleteResourcePermissions(long companyId, 603 java.lang.String name, int scope, java.lang.String primKey) 604 throws PortalException; 605 606 /** 607 * Deletes all resource permissions at the scope to resources of the type. 608 * This method should not be confused with any of the 609 * <code>removeResourcePermission</code> methods, as its purpose is very 610 * different. This method should only be used for deleting resource 611 * permissions that refer to a resource when that resource is deleted. For 612 * example this method could be used to delete all individual scope 613 * permissions to a blog post when it is deleted. 614 * 615 * <p> 616 * Depending on the scope, the value of <code>primKey</code> will have 617 * different meanings. For more information, see {@link 618 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 619 * </p> 620 * 621 * @param companyId the primary key of the company 622 * @param name the resource's name, which can be either a class name or a 623 portlet ID 624 * @param scope the scope 625 * @param primKey the primary key 626 */ 627 public void deleteResourcePermissions(long companyId, 628 java.lang.String name, int scope, long primKey) 629 throws PortalException; 630 631 /** 632 * Reassigns all the resource permissions from the source role to the 633 * destination role, and deletes the source role. 634 * 635 * @param fromRoleId the primary key of the source role 636 * @param toRoleId the primary key of the destination role 637 */ 638 public void mergePermissions(long fromRoleId, long toRoleId) 639 throws PortalException; 640 641 /** 642 * Grants the role default permissions to all the resources of the type and 643 * at the scope stored in the resource permission, deletes the resource 644 * permission, and deletes the resource permission's role if it has no 645 * permissions remaining. 646 * 647 * @param resourcePermissionId the primary key of the resource permission 648 * @param toRoleId the primary key of the role 649 */ 650 public void reassignPermissions(long resourcePermissionId, long toRoleId) 651 throws PortalException; 652 653 /** 654 * Revokes permission at the scope from the role to perform the action on 655 * resources of the type. For example, this method could be used to revoke a 656 * group scope permission to edit blog posts. 657 * 658 * <p> 659 * Depending on the scope, the value of <code>primKey</code> will have 660 * different meanings. For more information, see {@link 661 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 662 * </p> 663 * 664 * @param companyId the primary key of the company 665 * @param name the resource's name, which can be either a class name or a 666 portlet ID 667 * @param scope the scope 668 * @param primKey the primary key 669 * @param roleId the primary key of the role 670 * @param actionId the action ID 671 */ 672 public void removeResourcePermission(long companyId, java.lang.String name, 673 int scope, java.lang.String primKey, long roleId, 674 java.lang.String actionId) throws PortalException; 675 676 /** 677 * Revokes all permissions at the scope from the role to perform the action 678 * on resources of the type. For example, this method could be used to 679 * revoke all individual scope permissions to edit blog posts from site 680 * members. 681 * 682 * @param companyId the primary key of the company 683 * @param name the resource's name, which can be either a class name or a 684 portlet ID 685 * @param scope the scope 686 * @param roleId the primary key of the role 687 * @param actionId the action ID 688 */ 689 public void removeResourcePermissions(long companyId, 690 java.lang.String name, int scope, long roleId, java.lang.String actionId) 691 throws PortalException; 692 693 /** 694 * Updates the role's permissions at the scope, setting the actions that can 695 * be performed on resources of the type, also setting the owner of any 696 * newly created resource permissions. Existing actions are replaced. 697 * 698 * <p> 699 * This method can be used to set permissions at any scope, but it is 700 * generally only used at the individual scope. For example, it could be 701 * used to set the guest permissions on a blog post. 702 * </p> 703 * 704 * <p> 705 * Depending on the scope, the value of <code>primKey</code> will have 706 * different meanings. For more information, see {@link 707 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 708 * </p> 709 * 710 * @param companyId the primary key of the company 711 * @param name the resource's name, which can be either a class name or a 712 portlet ID 713 * @param scope the scope 714 * @param primKey the primary key 715 * @param roleId the primary key of the role 716 * @param ownerId the primary key of the owner (generally the user that 717 created the resource) 718 * @param actionIds the action IDs of the actions 719 */ 720 @Retry(acceptor = ExceptionRetryAcceptor.class, properties = { 721 @Property(name = ExceptionRetryAcceptor.EXCEPTION_NAME, value = "org.springframework.dao.DataIntegrityViolationException") 722 } 723 ) 724 public void setOwnerResourcePermissions(long companyId, 725 java.lang.String name, int scope, java.lang.String primKey, 726 long roleId, long ownerId, java.lang.String[] actionIds) 727 throws PortalException; 728 729 /** 730 * Updates the role's permissions at the scope, setting the actions that can 731 * be performed on resources of the type. Existing actions are replaced. 732 * 733 * <p> 734 * This method can be used to set permissions at any scope, but it is 735 * generally only used at the individual scope. For example, it could be 736 * used to set the guest permissions on a blog post. 737 * </p> 738 * 739 * <p> 740 * Depending on the scope, the value of <code>primKey</code> will have 741 * different meanings. For more information, see {@link 742 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 743 * </p> 744 * 745 * @param companyId the primary key of the company 746 * @param name the resource's name, which can be either a class name or a 747 portlet ID 748 * @param scope the scope 749 * @param primKey the primary key 750 * @param roleIdsToActionIds a map of role IDs to action IDs of the actions 751 */ 752 @Retry(acceptor = ExceptionRetryAcceptor.class, properties = { 753 @Property(name = ExceptionRetryAcceptor.EXCEPTION_NAME, value = "org.springframework.dao.DataIntegrityViolationException") 754 } 755 ) 756 public void setResourcePermissions(long companyId, java.lang.String name, 757 int scope, java.lang.String primKey, 758 Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds) 759 throws PortalException; 760 761 /** 762 * Updates the role's permissions at the scope, setting the actions that can 763 * be performed on resources of the type. Existing actions are replaced. 764 * 765 * <p> 766 * This method can be used to set permissions at any scope, but it is 767 * generally only used at the individual scope. For example, it could be 768 * used to set the guest permissions on a blog post. 769 * </p> 770 * 771 * <p> 772 * Depending on the scope, the value of <code>primKey</code> will have 773 * different meanings. For more information, see {@link 774 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 775 * </p> 776 * 777 * @param companyId the primary key of the company 778 * @param name the resource's name, which can be either a class name or a 779 portlet ID 780 * @param scope the scope 781 * @param primKey the primary key 782 * @param roleId the primary key of the role 783 * @param actionIds the action IDs of the actions 784 */ 785 @Retry(acceptor = ExceptionRetryAcceptor.class, properties = { 786 @Property(name = ExceptionRetryAcceptor.EXCEPTION_NAME, value = "org.springframework.dao.DataIntegrityViolationException") 787 } 788 ) 789 public void setResourcePermissions(long companyId, java.lang.String name, 790 int scope, java.lang.String primKey, long roleId, 791 java.lang.String[] actionIds) throws PortalException; 792 }