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