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