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