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