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