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