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