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