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