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 /** 536 * Returns all the resource permissions where scope = any ?. 537 * 538 * <p> 539 * Useful when paginating results. Returns a maximum of <code>end - 540 * start</code> instances. <code>start</code> and <code>end</code> are not 541 * primary keys, they are indexes in the result set. Thus, <code>0</code> 542 * refers to the first result in the set. Setting both <code>start</code> 543 * and <code>end</code> to {@link 544 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 545 * result set. 546 * </p> 547 * 548 * @param scopes the scopes 549 * @return the resource permissions where scope = any ? 550 */ 551 public static java.util.List<com.liferay.portal.model.ResourcePermission> getScopeResourcePermissions( 552 int[] scopes) { 553 return getService().getScopeResourcePermissions(scopes); 554 } 555 556 /** 557 * Returns <code>true</code> if the resource permission grants permission to 558 * perform the resource action. Note that this method does not ensure that 559 * the resource permission refers to the same type of resource as the 560 * resource action. 561 * 562 * @param resourcePermission the resource permission 563 * @param resourceAction the resource action 564 * @return <code>true</code> if the resource permission grants permission to 565 perform the resource action 566 */ 567 public static boolean hasActionId( 568 com.liferay.portal.model.ResourcePermission resourcePermission, 569 com.liferay.portal.model.ResourceAction resourceAction) { 570 return getService().hasActionId(resourcePermission, resourceAction); 571 } 572 573 /** 574 * Returns <code>true</code> if the role has permission at the scope to 575 * perform the action on resources of the type. 576 * 577 * <p> 578 * Depending on the scope, the value of <code>primKey</code> will have 579 * different meanings. For more information, see {@link 580 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 581 * </p> 582 * 583 * @param companyId the primary key of the company 584 * @param name the resource's name, which can be either a class name or a 585 portlet ID 586 * @param scope the scope 587 * @param primKey the primary key 588 * @param roleId the primary key of the role 589 * @param actionId the action ID 590 * @return <code>true</code> if the role has permission to perform the 591 action on the resource; <code>false</code> otherwise 592 * @throws PortalException if a role with the primary key or a resource 593 action with the name and action ID could not be found 594 */ 595 public static boolean hasResourcePermission(long companyId, 596 java.lang.String name, int scope, java.lang.String primKey, 597 long roleId, java.lang.String actionId) 598 throws com.liferay.portal.kernel.exception.PortalException { 599 return getService() 600 .hasResourcePermission(companyId, name, scope, primKey, 601 roleId, actionId); 602 } 603 604 /** 605 * Returns <code>true</code> if the roles have permission at the scope to 606 * perform the action on resources of the type. 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 618 * @param primKey the primary key 619 * @param roleIds the primary keys of the roles 620 * @param actionId the action ID 621 * @return <code>true</code> if any one of the roles has permission to 622 perform the action on the resource; <code>false</code> otherwise 623 * @throws PortalException if any one of the roles with the primary keys 624 could not be found or if a resource action with the name and 625 action ID could not be found 626 */ 627 public static boolean hasResourcePermission(long companyId, 628 java.lang.String name, int scope, java.lang.String primKey, 629 long[] roleIds, java.lang.String actionId) 630 throws com.liferay.portal.kernel.exception.PortalException { 631 return getService() 632 .hasResourcePermission(companyId, name, scope, primKey, 633 roleIds, actionId); 634 } 635 636 /** 637 * Returns <code>true</code> if the roles have permission at the scope to 638 * perform the action on the resources. 639 * 640 * <p> 641 * Depending on the scope, the value of <code>primKey</code> will have 642 * different meanings. For more information, see {@link 643 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 644 * </p> 645 * 646 * @param resources the resources 647 * @param roleIds the primary keys of the roles 648 * @param actionId the action ID 649 * @return <code>true</code> if any one of the roles has permission to 650 perform the action on any one of the resources; 651 <code>false</code> otherwise 652 * @throws PortalException if any one of the roles with the primary keys 653 could not be found or if a resource action with the name and 654 action ID could not be found 655 */ 656 public static boolean hasResourcePermission( 657 java.util.List<com.liferay.portal.model.Resource> resources, 658 long[] roleIds, java.lang.String actionId) 659 throws com.liferay.portal.kernel.exception.PortalException { 660 return getService().hasResourcePermission(resources, roleIds, actionId); 661 } 662 663 public static boolean[] hasResourcePermissions(long companyId, 664 java.lang.String name, int scope, java.lang.String primKey, 665 long[] roleIds, java.lang.String actionId) 666 throws com.liferay.portal.kernel.exception.PortalException { 667 return getService() 668 .hasResourcePermissions(companyId, name, scope, primKey, 669 roleIds, actionId); 670 } 671 672 /** 673 * Returns <code>true</code> if the role has permission at the scope to 674 * perform the action on the resource. 675 * 676 * <p> 677 * Depending on the scope, the value of <code>primKey</code> will have 678 * different meanings. For more information, see {@link 679 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 680 * </p> 681 * 682 * @param companyId the primary key of the company 683 * @param name the resource's name, which can be either a class name or a 684 portlet ID 685 * @param scope the scope 686 * @param roleId the primary key of the role 687 * @param actionId the action ID 688 * @return <code>true</code> if the role has permission to perform the 689 action on the resource; <code>false</code> otherwise 690 * @throws PortalException if a role with the primary key or a resource 691 action with the name and action ID could not be found 692 */ 693 public static boolean hasScopeResourcePermission(long companyId, 694 java.lang.String name, int scope, long roleId, java.lang.String actionId) 695 throws com.liferay.portal.kernel.exception.PortalException { 696 return getService() 697 .hasScopeResourcePermission(companyId, name, scope, roleId, 698 actionId); 699 } 700 701 /** 702 * Reassigns all the resource permissions from the source role to the 703 * destination role, and deletes the source role. 704 * 705 * @param fromRoleId the primary key of the source role 706 * @param toRoleId the primary key of the destination role 707 * @throws PortalException if a role with the primary key could not be found 708 */ 709 public static void mergePermissions(long fromRoleId, long toRoleId) 710 throws com.liferay.portal.kernel.exception.PortalException { 711 getService().mergePermissions(fromRoleId, toRoleId); 712 } 713 714 /** 715 * Grants the role default permissions to all the resources of the type and 716 * at the scope stored in the resource permission, deletes the resource 717 * permission, and deletes the resource permission's role if it has no 718 * permissions remaining. 719 * 720 * @param resourcePermissionId the primary key of the resource permission 721 * @param toRoleId the primary key of the role 722 * @throws PortalException if a resource permission or role with the primary 723 key could not be found 724 */ 725 public static void reassignPermissions(long resourcePermissionId, 726 long toRoleId) 727 throws com.liferay.portal.kernel.exception.PortalException { 728 getService().reassignPermissions(resourcePermissionId, toRoleId); 729 } 730 731 /** 732 * Revokes permission at the scope from the role to perform the action on 733 * resources of the type. For example, this method could be used to revoke a 734 * group scope permission to edit blog posts. 735 * 736 * <p> 737 * Depending on the scope, the value of <code>primKey</code> will have 738 * different meanings. For more information, see {@link 739 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 740 * </p> 741 * 742 * @param companyId the primary key of the company 743 * @param name the resource's name, which can be either a class name or a 744 portlet ID 745 * @param scope the scope 746 * @param primKey the primary key 747 * @param roleId the primary key of the role 748 * @param actionId the action ID 749 * @throws PortalException if a role with the primary key or a resource 750 action with the name and action ID could not be found 751 */ 752 public static void removeResourcePermission(long companyId, 753 java.lang.String name, int scope, java.lang.String primKey, 754 long roleId, java.lang.String actionId) 755 throws com.liferay.portal.kernel.exception.PortalException { 756 getService() 757 .removeResourcePermission(companyId, name, scope, primKey, roleId, 758 actionId); 759 } 760 761 /** 762 * Revokes all permissions at the scope from the role to perform the action 763 * on resources of the type. For example, this method could be used to 764 * revoke all individual scope permissions to edit blog posts from site 765 * members. 766 * 767 * @param companyId the primary key of the company 768 * @param name the resource's name, which can be either a class name or a 769 portlet ID 770 * @param scope the scope 771 * @param roleId the primary key of the role 772 * @param actionId the action ID 773 * @throws PortalException if a role with the primary key or a resource 774 action with the name and action ID could not be found 775 */ 776 public static void removeResourcePermissions(long companyId, 777 java.lang.String name, int scope, long roleId, java.lang.String actionId) 778 throws com.liferay.portal.kernel.exception.PortalException { 779 getService() 780 .removeResourcePermissions(companyId, name, scope, roleId, actionId); 781 } 782 783 /** 784 * Sets the Spring bean ID for this bean. 785 * 786 * @param beanIdentifier the Spring bean ID for this bean 787 */ 788 public static void setBeanIdentifier(java.lang.String beanIdentifier) { 789 getService().setBeanIdentifier(beanIdentifier); 790 } 791 792 /** 793 * Updates the role's permissions at the scope, setting the actions that can 794 * be performed on resources of the type, also setting the owner of any 795 * newly created resource permissions. Existing actions are replaced. 796 * 797 * <p> 798 * This method can be used to set permissions at any scope, but it is 799 * generally only used at the individual scope. For example, it could be 800 * used to set the guest permissions on a blog post. 801 * </p> 802 * 803 * <p> 804 * Depending on the scope, the value of <code>primKey</code> will have 805 * different meanings. For more information, see {@link 806 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 807 * </p> 808 * 809 * @param companyId the primary key of the company 810 * @param name the resource's name, which can be either a class name or a 811 portlet ID 812 * @param scope the scope 813 * @param primKey the primary key 814 * @param roleId the primary key of the role 815 * @param ownerId the primary key of the owner (generally the user that 816 created the resource) 817 * @param actionIds the action IDs of the actions 818 * @throws PortalException if a role with the primary key or a resource 819 action with the name and action ID could not be found 820 */ 821 public static void setOwnerResourcePermissions(long companyId, 822 java.lang.String name, int scope, java.lang.String primKey, 823 long roleId, long ownerId, java.lang.String[] actionIds) 824 throws com.liferay.portal.kernel.exception.PortalException { 825 getService() 826 .setOwnerResourcePermissions(companyId, name, scope, primKey, 827 roleId, ownerId, actionIds); 828 } 829 830 /** 831 * Updates the role's permissions at the scope, setting the actions that can 832 * be performed on resources of the type. Existing actions are replaced. 833 * 834 * <p> 835 * This method can be used to set permissions at any scope, but it is 836 * generally only used at the individual scope. For example, it could be 837 * used to set the guest permissions on a blog post. 838 * </p> 839 * 840 * <p> 841 * Depending on the scope, the value of <code>primKey</code> will have 842 * different meanings. For more information, see {@link 843 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 844 * </p> 845 * 846 * @param companyId the primary key of the company 847 * @param name the resource's name, which can be either a class name or a 848 portlet ID 849 * @param scope the scope 850 * @param primKey the primary key 851 * @param roleId the primary key of the role 852 * @param actionIds the action IDs of the actions 853 * @throws PortalException if a role with the primary key or a resource 854 action with the name and action ID could not be found 855 */ 856 public static void setResourcePermissions(long companyId, 857 java.lang.String name, int scope, java.lang.String primKey, 858 long roleId, java.lang.String[] actionIds) 859 throws com.liferay.portal.kernel.exception.PortalException { 860 getService() 861 .setResourcePermissions(companyId, name, scope, primKey, roleId, 862 actionIds); 863 } 864 865 /** 866 * Updates the role's permissions at the scope, setting the actions that can 867 * be performed on resources of the type. Existing actions are replaced. 868 * 869 * <p> 870 * This method can be used to set permissions at any scope, but it is 871 * generally only used at the individual scope. For example, it could be 872 * used to set the guest permissions on a blog post. 873 * </p> 874 * 875 * <p> 876 * Depending on the scope, the value of <code>primKey</code> will have 877 * different meanings. For more information, see {@link 878 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 879 * </p> 880 * 881 * @param companyId the primary key of the company 882 * @param name the resource's name, which can be either a class name or a 883 portlet ID 884 * @param scope the scope 885 * @param primKey the primary key 886 * @param roleIdsToActionIds a map of role IDs to action IDs of the actions 887 * @throws PortalException if a role with the primary key or a resource 888 action with the name and action ID could not be found 889 */ 890 public static void setResourcePermissions(long companyId, 891 java.lang.String name, int scope, java.lang.String primKey, 892 java.util.Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds) 893 throws com.liferay.portal.kernel.exception.PortalException { 894 getService() 895 .setResourcePermissions(companyId, name, scope, primKey, 896 roleIdsToActionIds); 897 } 898 899 /** 900 * Updates the resource permission in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 901 * 902 * @param resourcePermission the resource permission 903 * @return the resource permission that was updated 904 */ 905 public static com.liferay.portal.model.ResourcePermission updateResourcePermission( 906 com.liferay.portal.model.ResourcePermission resourcePermission) { 907 return getService().updateResourcePermission(resourcePermission); 908 } 909 910 public static ResourcePermissionLocalService getService() { 911 if (_service == null) { 912 _service = (ResourcePermissionLocalService)PortalBeanLocatorUtil.locate(ResourcePermissionLocalService.class.getName()); 913 914 ReferenceRegistry.registerReference(ResourcePermissionLocalServiceUtil.class, 915 "_service"); 916 } 917 918 return _service; 919 } 920 921 /** 922 * @deprecated As of 6.2.0 923 */ 924 @Deprecated 925 public void setService(ResourcePermissionLocalService service) { 926 } 927 928 private static ResourcePermissionLocalService _service; 929 }