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