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