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