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 /** 327 * Returns the OSGi service identifier. 328 * 329 * @return the OSGi service identifier 330 */ 331 public java.lang.String getOSGiServiceIdentifier(); 332 333 @Override 334 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 335 public com.liferay.portal.model.PersistedModel getPersistedModel( 336 java.io.Serializable primaryKeyObj) throws PortalException; 337 338 /** 339 * Returns the resource permission for the role at the scope to perform the 340 * actions on resources of the type. 341 * 342 * @param companyId the primary key of the company 343 * @param name the resource's name, which can be either a class name or a 344 portlet ID 345 * @param scope the scope 346 * @param primKey the primary key 347 * @param roleId the primary key of the role 348 * @return the resource permission for the role at the scope to perform the 349 actions on resources of the type 350 */ 351 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 352 public com.liferay.portal.model.ResourcePermission getResourcePermission( 353 long companyId, java.lang.String name, int scope, 354 java.lang.String primKey, long roleId) throws PortalException; 355 356 /** 357 * Returns the resource permission with the primary key. 358 * 359 * @param resourcePermissionId the primary key of the resource permission 360 * @return the resource permission 361 * @throws PortalException if a resource permission with the primary key could not be found 362 */ 363 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 364 public com.liferay.portal.model.ResourcePermission getResourcePermission( 365 long resourcePermissionId) throws PortalException; 366 367 /** 368 * Returns all the resource permissions at the scope of the type. 369 * 370 * @param companyId the primary key of the company 371 * @param name the resource's name, which can be either a class name or a 372 portlet ID 373 * @param scope the scope 374 * @param primKey the primary key 375 * @return the resource permissions at the scope of the type 376 */ 377 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 378 public java.util.List<com.liferay.portal.model.ResourcePermission> getResourcePermissions( 379 long companyId, java.lang.String name, int scope, 380 java.lang.String primKey); 381 382 /** 383 * Returns a range of all the resource permissions. 384 * 385 * <p> 386 * 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. 387 * </p> 388 * 389 * @param start the lower bound of the range of resource permissions 390 * @param end the upper bound of the range of resource permissions (not inclusive) 391 * @return the range of resource permissions 392 */ 393 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 394 public java.util.List<com.liferay.portal.model.ResourcePermission> getResourcePermissions( 395 int start, int end); 396 397 /** 398 * Returns the number of resource permissions. 399 * 400 * @return the number of resource permissions 401 */ 402 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 403 public int getResourcePermissionsCount(); 404 405 /** 406 * Returns the number of resource permissions at the scope of the type. 407 * 408 * @param companyId the primary key of the company 409 * @param name the resource's name, which can be either a class name or a 410 portlet ID 411 * @param scope the scope 412 * @param primKey the primary key 413 * @return the number of resource permissions at the scope of the type 414 */ 415 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 416 public int getResourcePermissionsCount(long companyId, 417 java.lang.String name, int scope, java.lang.String primKey); 418 419 /** 420 * Returns the resource permissions that apply to the resource. 421 * 422 * @param companyId the primary key of the resource's company 423 * @param groupId the primary key of the resource's group 424 * @param name the resource's name, which can be either a class name or a 425 portlet ID 426 * @param primKey the primary key of the resource 427 * @return the resource permissions associated with the resource 428 */ 429 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 430 public java.util.List<com.liferay.portal.model.ResourcePermission> getResourceResourcePermissions( 431 long companyId, long groupId, java.lang.String name, 432 java.lang.String primKey); 433 434 /** 435 * Returns all the resource permissions for the role. 436 * 437 * @param roleId the primary key of the role 438 * @return the resource permissions for the role 439 */ 440 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 441 public java.util.List<com.liferay.portal.model.ResourcePermission> getRoleResourcePermissions( 442 long roleId); 443 444 /** 445 * Returns a range of all the resource permissions for the role at the 446 * scopes. 447 * 448 * <p> 449 * Useful when paginating results. Returns a maximum of <code>end - 450 * start</code> instances. <code>start</code> and <code>end</code> are not 451 * primary keys, they are indexes in the result set. Thus, <code>0</code> 452 * refers to the first result in the set. Setting both <code>start</code> 453 * and <code>end</code> to {@link 454 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 455 * result set. 456 * </p> 457 * 458 * @param roleId the primary key of the role 459 * @param scopes the scopes 460 * @param start the lower bound of the range of results 461 * @param end the upper bound of the range of results (not inclusive) 462 * @return the range of resource permissions for the role at the scopes 463 */ 464 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 465 public java.util.List<com.liferay.portal.model.ResourcePermission> getRoleResourcePermissions( 466 long roleId, int[] scopes, int start, int end); 467 468 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 469 public java.util.List<com.liferay.portal.model.Role> getRoles( 470 long companyId, java.lang.String name, int scope, 471 java.lang.String primKey, java.lang.String actionId) 472 throws PortalException; 473 474 /** 475 * Returns all the resource permissions where scope = any ?. 476 * 477 * <p> 478 * Useful when paginating results. Returns a maximum of <code>end - 479 * start</code> instances. <code>start</code> and <code>end</code> are not 480 * primary keys, they are indexes in the result set. Thus, <code>0</code> 481 * refers to the first result in the set. Setting both <code>start</code> 482 * and <code>end</code> to {@link 483 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 484 * result set. 485 * </p> 486 * 487 * @param scopes the scopes 488 * @return the resource permissions where scope = any ? 489 */ 490 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 491 public java.util.List<com.liferay.portal.model.ResourcePermission> getScopeResourcePermissions( 492 int[] scopes); 493 494 /** 495 * Returns <code>true</code> if the resource permission grants permission to 496 * perform the resource action. Note that this method does not ensure that 497 * the resource permission refers to the same type of resource as the 498 * resource action. 499 * 500 * @param resourcePermission the resource permission 501 * @param resourceAction the resource action 502 * @return <code>true</code> if the resource permission grants permission to 503 perform the resource action 504 */ 505 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 506 public boolean hasActionId( 507 com.liferay.portal.model.ResourcePermission resourcePermission, 508 com.liferay.portal.model.ResourceAction resourceAction); 509 510 /** 511 * Returns <code>true</code> if the role has permission at the scope to 512 * perform the action on resources of the type. 513 * 514 * <p> 515 * Depending on the scope, the value of <code>primKey</code> will have 516 * different meanings. For more information, see {@link 517 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 518 * </p> 519 * 520 * @param companyId the primary key of the company 521 * @param name the resource's name, which can be either a class name or a 522 portlet ID 523 * @param scope the scope 524 * @param primKey the primary key 525 * @param roleId the primary key of the role 526 * @param actionId the action ID 527 * @return <code>true</code> if the role has permission to perform the 528 action on the resource; <code>false</code> otherwise 529 */ 530 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 531 public boolean hasResourcePermission(long companyId, java.lang.String name, 532 int scope, java.lang.String primKey, long roleId, 533 java.lang.String actionId) throws PortalException; 534 535 /** 536 * Returns <code>true</code> if the roles have permission at the scope to 537 * perform the action on resources of the type. 538 * 539 * <p> 540 * Depending on the scope, the value of <code>primKey</code> will have 541 * different meanings. For more information, see {@link 542 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 543 * </p> 544 * 545 * @param companyId the primary key of the company 546 * @param name the resource's name, which can be either a class name or a 547 portlet ID 548 * @param scope the scope 549 * @param primKey the primary key 550 * @param roleIds the primary keys of the roles 551 * @param actionId the action ID 552 * @return <code>true</code> if any one of the roles has permission to 553 perform the action on the resource; <code>false</code> otherwise 554 */ 555 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 556 public boolean hasResourcePermission(long companyId, java.lang.String name, 557 int scope, java.lang.String primKey, long[] roleIds, 558 java.lang.String actionId) throws PortalException; 559 560 /** 561 * Returns <code>true</code> if the roles have permission at the scope to 562 * perform the action on the resources. 563 * 564 * <p> 565 * Depending on the scope, the value of <code>primKey</code> will have 566 * different meanings. For more information, see {@link 567 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 568 * </p> 569 * 570 * @param resources the resources 571 * @param roleIds the primary keys of the roles 572 * @param actionId the action ID 573 * @return <code>true</code> if any one of the roles has permission to 574 perform the action on any one of the resources; 575 <code>false</code> otherwise 576 */ 577 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 578 public boolean hasResourcePermission( 579 java.util.List<com.liferay.portal.model.Resource> resources, 580 long[] roleIds, java.lang.String actionId) throws PortalException; 581 582 /** 583 * @deprecated As of 7.0.0, replaced by {@link #getRoles(long, String, int, 584 String, String} 585 */ 586 @java.lang.Deprecated 587 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 588 public boolean[] hasResourcePermissions(long companyId, 589 java.lang.String name, int scope, java.lang.String primKey, 590 long[] roleIds, java.lang.String actionId) throws PortalException; 591 592 /** 593 * Returns <code>true</code> if the role has permission at the scope to 594 * perform the action on the resource. 595 * 596 * <p> 597 * Depending on the scope, the value of <code>primKey</code> will have 598 * different meanings. For more information, see {@link 599 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 600 * </p> 601 * 602 * @param companyId the primary key of the company 603 * @param name the resource's name, which can be either a class name or a 604 portlet ID 605 * @param scope the scope 606 * @param roleId the primary key of the role 607 * @param actionId the action ID 608 * @return <code>true</code> if the role has permission to perform the 609 action on the resource; <code>false</code> otherwise 610 */ 611 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 612 public boolean hasScopeResourcePermission(long companyId, 613 java.lang.String name, int scope, long roleId, java.lang.String actionId) 614 throws PortalException; 615 616 /** 617 * Reassigns all the resource permissions from the source role to the 618 * destination role, and deletes the source role. 619 * 620 * @param fromRoleId the primary key of the source role 621 * @param toRoleId the primary key of the destination role 622 */ 623 public void mergePermissions(long fromRoleId, long toRoleId) 624 throws PortalException; 625 626 /** 627 * Grants the role default permissions to all the resources of the type and 628 * at the scope stored in the resource permission, deletes the resource 629 * permission, and deletes the resource permission's role if it has no 630 * permissions remaining. 631 * 632 * @param resourcePermissionId the primary key of the resource permission 633 * @param toRoleId the primary key of the role 634 */ 635 public void reassignPermissions(long resourcePermissionId, long toRoleId) 636 throws PortalException; 637 638 /** 639 * Revokes permission at the scope from the role to perform the action on 640 * resources of the type. For example, this method could be used to revoke a 641 * group scope permission to edit blog posts. 642 * 643 * <p> 644 * Depending on the scope, the value of <code>primKey</code> will have 645 * different meanings. For more information, see {@link 646 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 647 * </p> 648 * 649 * @param companyId the primary key of the company 650 * @param name the resource's name, which can be either a class name or a 651 portlet ID 652 * @param scope the scope 653 * @param primKey the primary key 654 * @param roleId the primary key of the role 655 * @param actionId the action ID 656 */ 657 public void removeResourcePermission(long companyId, java.lang.String name, 658 int scope, java.lang.String primKey, long roleId, 659 java.lang.String actionId) throws PortalException; 660 661 /** 662 * Revokes all permissions at the scope from the role to perform the action 663 * on resources of the type. For example, this method could be used to 664 * revoke all individual scope permissions to edit blog posts from site 665 * members. 666 * 667 * @param companyId the primary key of the company 668 * @param name the resource's name, which can be either a class name or a 669 portlet ID 670 * @param scope the scope 671 * @param roleId the primary key of the role 672 * @param actionId the action ID 673 */ 674 public void removeResourcePermissions(long companyId, 675 java.lang.String name, int scope, long roleId, java.lang.String actionId) 676 throws PortalException; 677 678 /** 679 * Updates the role's permissions at the scope, setting the actions that can 680 * be performed on resources of the type, also setting the owner of any 681 * newly created resource permissions. Existing actions are replaced. 682 * 683 * <p> 684 * This method can be used to set permissions at any scope, but it is 685 * generally only used at the individual scope. For example, it could be 686 * used to set the guest permissions on a blog post. 687 * </p> 688 * 689 * <p> 690 * Depending on the scope, the value of <code>primKey</code> will have 691 * different meanings. For more information, see {@link 692 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 693 * </p> 694 * 695 * @param companyId the primary key of the company 696 * @param name the resource's name, which can be either a class name or a 697 portlet ID 698 * @param scope the scope 699 * @param primKey the primary key 700 * @param roleId the primary key of the role 701 * @param ownerId the primary key of the owner (generally the user that 702 created the resource) 703 * @param actionIds the action IDs of the actions 704 */ 705 @com.liferay.portal.kernel.spring.aop.Retry(acceptor = com.liferay.portal.service.ExceptionRetryAcceptor.class, properties = { 706 @com.liferay.portal.kernel.spring.aop.Property(name = ExceptionRetryAcceptor.EXCEPTION_NAME, value = "org.springframework.dao.DataIntegrityViolationException") 707 } 708 ) 709 public void setOwnerResourcePermissions(long companyId, 710 java.lang.String name, int scope, java.lang.String primKey, 711 long roleId, long ownerId, java.lang.String[] actionIds) 712 throws PortalException; 713 714 /** 715 * Updates the role's permissions at the scope, setting the actions that can 716 * be performed on resources of the type. Existing actions are replaced. 717 * 718 * <p> 719 * This method can be used to set permissions at any scope, but it is 720 * generally only used at the individual scope. For example, it could be 721 * used to set the guest permissions on a blog post. 722 * </p> 723 * 724 * <p> 725 * Depending on the scope, the value of <code>primKey</code> will have 726 * different meanings. For more information, see {@link 727 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 728 * </p> 729 * 730 * @param companyId the primary key of the company 731 * @param name the resource's name, which can be either a class name or a 732 portlet ID 733 * @param scope the scope 734 * @param primKey the primary key 735 * @param roleId the primary key of the role 736 * @param actionIds the action IDs of the actions 737 */ 738 @com.liferay.portal.kernel.spring.aop.Retry(acceptor = com.liferay.portal.service.ExceptionRetryAcceptor.class, properties = { 739 @com.liferay.portal.kernel.spring.aop.Property(name = ExceptionRetryAcceptor.EXCEPTION_NAME, value = "org.springframework.dao.DataIntegrityViolationException") 740 } 741 ) 742 public void setResourcePermissions(long companyId, java.lang.String name, 743 int scope, java.lang.String primKey, long roleId, 744 java.lang.String[] actionIds) throws PortalException; 745 746 /** 747 * Updates the role's permissions at the scope, setting the actions that can 748 * be performed on resources of the type. Existing actions are replaced. 749 * 750 * <p> 751 * This method can be used to set permissions at any scope, but it is 752 * generally only used at the individual scope. For example, it could be 753 * used to set the guest permissions on a blog post. 754 * </p> 755 * 756 * <p> 757 * Depending on the scope, the value of <code>primKey</code> will have 758 * different meanings. For more information, see {@link 759 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 760 * </p> 761 * 762 * @param companyId the primary key of the company 763 * @param name the resource's name, which can be either a class name or a 764 portlet ID 765 * @param scope the scope 766 * @param primKey the primary key 767 * @param roleIdsToActionIds a map of role IDs to action IDs of the actions 768 */ 769 @com.liferay.portal.kernel.spring.aop.Retry(acceptor = com.liferay.portal.service.ExceptionRetryAcceptor.class, properties = { 770 @com.liferay.portal.kernel.spring.aop.Property(name = ExceptionRetryAcceptor.EXCEPTION_NAME, value = "org.springframework.dao.DataIntegrityViolationException") 771 } 772 ) 773 public void setResourcePermissions(long companyId, java.lang.String name, 774 int scope, java.lang.String primKey, 775 java.util.Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds) 776 throws PortalException; 777 778 /** 779 * Updates the resource permission in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 780 * 781 * @param resourcePermission the resource permission 782 * @return the resource permission that was updated 783 */ 784 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.REINDEX) 785 public com.liferay.portal.model.ResourcePermission updateResourcePermission( 786 com.liferay.portal.model.ResourcePermission resourcePermission); 787 }