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 public static com.liferay.portal.model.ResourcePermission fetchResourcePermission( 410 long companyId, java.lang.String name, int scope, 411 java.lang.String primKey, long roleId) 412 throws com.liferay.portal.kernel.exception.SystemException { 413 return getService() 414 .fetchResourcePermission(companyId, name, scope, primKey, 415 roleId); 416 } 417 418 /** 419 * Returns the intersection of action IDs the role has permission at the 420 * scope to perform on resources of the type. 421 * 422 * @param companyId he primary key of the company 423 * @param name the resource's name, which can be either a class name or a 424 portlet ID 425 * @param scope the scope 426 * @param primKey the primary key 427 * @param roleId the primary key of the role 428 * @param actionIds the action IDs 429 * @return the intersection of action IDs the role has permission at the 430 scope to perform on resources of the type 431 * @throws PortalException if a resouce action could not be found for any 432 one of the actions on the resource 433 * @throws SystemException if a system exception occurred 434 */ 435 public static java.util.List<java.lang.String> getAvailableResourcePermissionActionIds( 436 long companyId, java.lang.String name, int scope, 437 java.lang.String primKey, long roleId, 438 java.util.Collection<java.lang.String> actionIds) 439 throws com.liferay.portal.kernel.exception.PortalException, 440 com.liferay.portal.kernel.exception.SystemException { 441 return getService() 442 .getAvailableResourcePermissionActionIds(companyId, name, 443 scope, primKey, roleId, actionIds); 444 } 445 446 public static java.util.Map<java.lang.Long, java.util.Set<java.lang.String>> getAvailableResourcePermissionActionIds( 447 long companyId, java.lang.String name, int scope, 448 java.lang.String primKey, long[] roleIds, 449 java.util.Collection<java.lang.String> actionIds) 450 throws com.liferay.portal.kernel.exception.PortalException, 451 com.liferay.portal.kernel.exception.SystemException { 452 return getService() 453 .getAvailableResourcePermissionActionIds(companyId, name, 454 scope, primKey, roleIds, actionIds); 455 } 456 457 /** 458 * Returns the resource permission for the role at the scope to perform the 459 * actions on resources of the type. 460 * 461 * @param companyId the primary key of the company 462 * @param name the resource's name, which can be either a class name or a 463 portlet ID 464 * @param scope the scope 465 * @param primKey the primary key 466 * @param roleId the primary key of the role 467 * @return the resource permission for the role at the scope to perform the 468 actions on resources of the type 469 * @throws PortalException if no matching resources could be found 470 * @throws SystemException if a system exception occurred 471 */ 472 public static com.liferay.portal.model.ResourcePermission getResourcePermission( 473 long companyId, java.lang.String name, int scope, 474 java.lang.String primKey, long roleId) 475 throws com.liferay.portal.kernel.exception.PortalException, 476 com.liferay.portal.kernel.exception.SystemException { 477 return getService() 478 .getResourcePermission(companyId, name, scope, primKey, 479 roleId); 480 } 481 482 /** 483 * Returns all the resource permissions at the scope of the type. 484 * 485 * @param companyId the primary key of the company 486 * @param name the resource's name, which can be either a class name or a 487 portlet ID 488 * @param scope the scope 489 * @param primKey the primary key 490 * @return the resource permissions at the scope of the type 491 * @throws SystemException if a system exception occurred 492 */ 493 public static java.util.List<com.liferay.portal.model.ResourcePermission> getResourcePermissions( 494 long companyId, java.lang.String name, int scope, 495 java.lang.String primKey) 496 throws com.liferay.portal.kernel.exception.SystemException { 497 return getService() 498 .getResourcePermissions(companyId, name, scope, primKey); 499 } 500 501 /** 502 * Returns the number of resource permissions at the scope of the type. 503 * 504 * @param companyId the primary key of the company 505 * @param name the resource's name, which can be either a class name or a 506 portlet ID 507 * @param scope the scope 508 * @param primKey the primary key 509 * @return the number of resource permissions at the scope of the type 510 * @throws SystemException if a system exception occurred 511 */ 512 public static int getResourcePermissionsCount(long companyId, 513 java.lang.String name, int scope, java.lang.String primKey) 514 throws com.liferay.portal.kernel.exception.SystemException { 515 return getService() 516 .getResourcePermissionsCount(companyId, name, scope, primKey); 517 } 518 519 /** 520 * Returns the resource permissions that apply to the resource. 521 * 522 * @param companyId the primary key of the resource's company 523 * @param groupId the primary key of the resource's group 524 * @param name the resource's name, which can be either a class name or a 525 portlet ID 526 * @param primKey the primary key of the resource 527 * @return the resource permissions associated with the resource 528 * @throws SystemException if a system exception occurred 529 */ 530 public static java.util.List<com.liferay.portal.model.ResourcePermission> getResourceResourcePermissions( 531 long companyId, long groupId, java.lang.String name, 532 java.lang.String primKey) 533 throws com.liferay.portal.kernel.exception.SystemException { 534 return getService() 535 .getResourceResourcePermissions(companyId, groupId, name, 536 primKey); 537 } 538 539 /** 540 * Returns all the resource permissions for the role. 541 * 542 * @param roleId the primary key of the role 543 * @return the resource permissions for the role 544 * @throws SystemException if a system exception occurred 545 */ 546 public static java.util.List<com.liferay.portal.model.ResourcePermission> getRoleResourcePermissions( 547 long roleId) throws com.liferay.portal.kernel.exception.SystemException { 548 return getService().getRoleResourcePermissions(roleId); 549 } 550 551 /** 552 * Returns a range of all the resource permissions for the role at the 553 * scopes. 554 * 555 * <p> 556 * Useful when paginating results. Returns a maximum of <code>end - 557 * start</code> instances. <code>start</code> and <code>end</code> are not 558 * primary keys, they are indexes in the result set. Thus, <code>0</code> 559 * refers to the first result in the set. Setting both <code>start</code> 560 * and <code>end</code> to {@link 561 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 562 * result set. 563 * </p> 564 * 565 * @param roleId the primary key of the role 566 * @param scopes the scopes 567 * @param start the lower bound of the range of results 568 * @param end the upper bound of the range of results (not inclusive) 569 * @return the range of resource permissions for the role at the scopes 570 * @throws SystemException if a system exception occurred 571 */ 572 public static java.util.List<com.liferay.portal.model.ResourcePermission> getRoleResourcePermissions( 573 long roleId, int[] scopes, int start, int end) 574 throws com.liferay.portal.kernel.exception.SystemException { 575 return getService() 576 .getRoleResourcePermissions(roleId, scopes, start, end); 577 } 578 579 /** 580 * Returns all the resource permissions where scope = any ?. 581 * 582 * <p> 583 * Useful when paginating results. Returns a maximum of <code>end - 584 * start</code> instances. <code>start</code> and <code>end</code> are not 585 * primary keys, they are indexes in the result set. Thus, <code>0</code> 586 * refers to the first result in the set. Setting both <code>start</code> 587 * and <code>end</code> to {@link 588 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 589 * result set. 590 * </p> 591 * 592 * @param scopes the scopes 593 * @return the resource permissions where scope = any ? 594 * @throws SystemException if a system exception occurred 595 */ 596 public static java.util.List<com.liferay.portal.model.ResourcePermission> getScopeResourcePermissions( 597 int[] scopes) 598 throws com.liferay.portal.kernel.exception.SystemException { 599 return getService().getScopeResourcePermissions(scopes); 600 } 601 602 /** 603 * Returns <code>true</code> if the resource permission grants permission to 604 * perform the resource action. Note that this method does not ensure that 605 * the resource permission refers to the same type of resource as the 606 * resource action. 607 * 608 * @param resourcePermission the resource permission 609 * @param resourceAction the resource action 610 * @return <code>true</code> if the resource permission grants permission to 611 perform the resource action 612 */ 613 public static boolean hasActionId( 614 com.liferay.portal.model.ResourcePermission resourcePermission, 615 com.liferay.portal.model.ResourceAction resourceAction) { 616 return getService().hasActionId(resourcePermission, resourceAction); 617 } 618 619 /** 620 * Returns <code>true</code> if the roles have permission at the scope to 621 * perform the action on the resources. 622 * 623 * <p> 624 * Depending on the scope, the value of <code>primKey</code> will have 625 * different meanings. For more information, see {@link 626 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 627 * </p> 628 * 629 * @param resources the resources 630 * @param roleIds the primary keys of the roles 631 * @param actionId the action ID 632 * @return <code>true</code> if any one of the roles has permission to 633 perform the action on any one of the resources; 634 <code>false</code> otherwise 635 * @throws PortalException if any one of the roles with the primary keys 636 could not be found or if a resource action with the name and 637 action ID could not be found 638 * @throws SystemException if a system exception occurred 639 */ 640 public static boolean hasResourcePermission( 641 java.util.List<com.liferay.portal.model.Resource> resources, 642 long[] roleIds, java.lang.String actionId) 643 throws com.liferay.portal.kernel.exception.PortalException, 644 com.liferay.portal.kernel.exception.SystemException { 645 return getService().hasResourcePermission(resources, roleIds, actionId); 646 } 647 648 /** 649 * Returns <code>true</code> if the role has permission at the scope to 650 * perform the action on resources of the type. 651 * 652 * <p> 653 * Depending on the scope, the value of <code>primKey</code> will have 654 * different meanings. For more information, see {@link 655 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 656 * </p> 657 * 658 * @param companyId the primary key of the company 659 * @param name the resource's name, which can be either a class name or a 660 portlet ID 661 * @param scope the scope 662 * @param primKey the primary key 663 * @param roleId the primary key of the role 664 * @param actionId the action ID 665 * @return <code>true</code> if the role has permission to perform the 666 action on the resource; <code>false</code> otherwise 667 * @throws PortalException if a role with the primary key or a resource 668 action with the name and action ID could not be found 669 * @throws SystemException if a system exception occurred 670 */ 671 public static boolean hasResourcePermission(long companyId, 672 java.lang.String name, int scope, java.lang.String primKey, 673 long roleId, java.lang.String actionId) 674 throws com.liferay.portal.kernel.exception.PortalException, 675 com.liferay.portal.kernel.exception.SystemException { 676 return getService() 677 .hasResourcePermission(companyId, name, scope, primKey, 678 roleId, actionId); 679 } 680 681 /** 682 * Returns <code>true</code> if the roles have permission at the scope to 683 * perform the action on resources of the type. 684 * 685 * <p> 686 * Depending on the scope, the value of <code>primKey</code> will have 687 * different meanings. For more information, see {@link 688 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 689 * </p> 690 * 691 * @param companyId the primary key of the company 692 * @param name the resource's name, which can be either a class name or a 693 portlet ID 694 * @param scope the scope 695 * @param primKey the primary key 696 * @param roleIds the primary keys of the roles 697 * @param actionId the action ID 698 * @return <code>true</code> if any one of the roles has permission to 699 perform the action on the resource; <code>false</code> otherwise 700 * @throws PortalException if any one of the roles with the primary keys 701 could not be found or if a resource action with the name and 702 action ID could not be found 703 * @throws SystemException if a system exception occurred 704 */ 705 public static boolean hasResourcePermission(long companyId, 706 java.lang.String name, int scope, java.lang.String primKey, 707 long[] roleIds, java.lang.String actionId) 708 throws com.liferay.portal.kernel.exception.PortalException, 709 com.liferay.portal.kernel.exception.SystemException { 710 return getService() 711 .hasResourcePermission(companyId, name, scope, primKey, 712 roleIds, actionId); 713 } 714 715 public static boolean[] hasResourcePermissions(long companyId, 716 java.lang.String name, int scope, java.lang.String primKey, 717 long[] roleIds, java.lang.String actionId) 718 throws com.liferay.portal.kernel.exception.PortalException, 719 com.liferay.portal.kernel.exception.SystemException { 720 return getService() 721 .hasResourcePermissions(companyId, name, scope, primKey, 722 roleIds, actionId); 723 } 724 725 /** 726 * Returns <code>true</code> if the role has permission at the scope to 727 * perform the action on the resource. 728 * 729 * <p> 730 * Depending on the scope, the value of <code>primKey</code> will have 731 * different meanings. For more information, see {@link 732 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 733 * </p> 734 * 735 * @param companyId the primary key of the company 736 * @param name the resource's name, which can be either a class name or a 737 portlet ID 738 * @param scope the scope 739 * @param roleId the primary key of the role 740 * @param actionId the action ID 741 * @return <code>true</code> if the role has permission to perform the 742 action on the resource; <code>false</code> otherwise 743 * @throws PortalException if a role with the primary key or a resource 744 action with the name and action ID could not be found 745 * @throws SystemException if a system exception occurred 746 */ 747 public static boolean hasScopeResourcePermission(long companyId, 748 java.lang.String name, int scope, long roleId, java.lang.String actionId) 749 throws com.liferay.portal.kernel.exception.PortalException, 750 com.liferay.portal.kernel.exception.SystemException { 751 return getService() 752 .hasScopeResourcePermission(companyId, name, scope, roleId, 753 actionId); 754 } 755 756 /** 757 * Reassigns all the resource permissions from the source role to the 758 * destination role, and deletes the source role. 759 * 760 * @param fromRoleId the primary key of the source role 761 * @param toRoleId the primary key of the destination role 762 * @throws PortalException if a role with the primary key could not be found 763 * @throws SystemException if a system exception occurred 764 */ 765 public static void mergePermissions(long fromRoleId, long toRoleId) 766 throws com.liferay.portal.kernel.exception.PortalException, 767 com.liferay.portal.kernel.exception.SystemException { 768 getService().mergePermissions(fromRoleId, toRoleId); 769 } 770 771 /** 772 * Grants the role default permissions to all the resources of the type and 773 * at the scope stored in the resource permission, deletes the resource 774 * permission, and deletes the resource permission's role if it has no 775 * permissions remaining. 776 * 777 * @param resourcePermissionId the primary key of the resource permission 778 * @param toRoleId the primary key of the role 779 * @throws PortalException if a resource permission or role with the primary 780 key could not be found 781 * @throws SystemException if a system exception occurred 782 */ 783 public static void reassignPermissions(long resourcePermissionId, 784 long toRoleId) 785 throws com.liferay.portal.kernel.exception.PortalException, 786 com.liferay.portal.kernel.exception.SystemException { 787 getService().reassignPermissions(resourcePermissionId, toRoleId); 788 } 789 790 /** 791 * Revokes permission at the scope from the role to perform the action on 792 * resources of the type. For example, this method could be used to revoke a 793 * group scope permission to edit blog posts. 794 * 795 * <p> 796 * Depending on the scope, the value of <code>primKey</code> will have 797 * different meanings. For more information, see {@link 798 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 799 * </p> 800 * 801 * @param companyId the primary key of the company 802 * @param name the resource's name, which can be either a class name or a 803 portlet ID 804 * @param scope the scope 805 * @param primKey the primary key 806 * @param roleId the primary key of the role 807 * @param actionId the action ID 808 * @throws PortalException if a role with the primary key or a resource 809 action with the name and action ID could not be found 810 * @throws SystemException if a system exception occurred 811 */ 812 public static void removeResourcePermission(long companyId, 813 java.lang.String name, int scope, java.lang.String primKey, 814 long roleId, java.lang.String actionId) 815 throws com.liferay.portal.kernel.exception.PortalException, 816 com.liferay.portal.kernel.exception.SystemException { 817 getService() 818 .removeResourcePermission(companyId, name, scope, primKey, roleId, 819 actionId); 820 } 821 822 /** 823 * Revokes all permissions at the scope from the role to perform the action 824 * on resources of the type. For example, this method could be used to 825 * revoke all individual scope permissions to edit blog posts from site 826 * members. 827 * 828 * @param companyId the primary key of the company 829 * @param name the resource's name, which can be either a class name or a 830 portlet ID 831 * @param scope the scope 832 * @param roleId the primary key of the role 833 * @param actionId the action ID 834 * @throws PortalException if a role with the primary key or a resource 835 action with the name and action ID could not be found 836 * @throws SystemException if a system exception occurred 837 */ 838 public static void removeResourcePermissions(long companyId, 839 java.lang.String name, int scope, long roleId, java.lang.String actionId) 840 throws com.liferay.portal.kernel.exception.PortalException, 841 com.liferay.portal.kernel.exception.SystemException { 842 getService() 843 .removeResourcePermissions(companyId, name, scope, roleId, actionId); 844 } 845 846 /** 847 * Updates the role's permissions at the scope, setting the actions that can 848 * be performed on resources of the type, also setting the owner of any 849 * newly created resource permissions. Existing actions are replaced. 850 * 851 * <p> 852 * This method can be used to set permissions at any scope, but it is 853 * generally only used at the individual scope. For example, it could be 854 * used to set the guest permissions on a blog post. 855 * </p> 856 * 857 * <p> 858 * Depending on the scope, the value of <code>primKey</code> will have 859 * different meanings. For more information, see {@link 860 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 861 * </p> 862 * 863 * @param companyId the primary key of the company 864 * @param name the resource's name, which can be either a class name or a 865 portlet ID 866 * @param scope the scope 867 * @param primKey the primary key 868 * @param roleId the primary key of the role 869 * @param ownerId the primary key of the owner (generally the user that 870 created the resource) 871 * @param actionIds the action IDs of the actions 872 * @throws PortalException if a role with the primary key or a resource 873 action with the name and action ID could not be found 874 * @throws SystemException if a system exception occurred 875 */ 876 public static void setOwnerResourcePermissions(long companyId, 877 java.lang.String name, int scope, java.lang.String primKey, 878 long roleId, long ownerId, java.lang.String[] actionIds) 879 throws com.liferay.portal.kernel.exception.PortalException, 880 com.liferay.portal.kernel.exception.SystemException { 881 getService() 882 .setOwnerResourcePermissions(companyId, name, scope, primKey, 883 roleId, ownerId, actionIds); 884 } 885 886 /** 887 * Updates the role's permissions at the scope, setting the actions that can 888 * be performed on resources of the type. Existing actions are replaced. 889 * 890 * <p> 891 * This method can be used to set permissions at any scope, but it is 892 * generally only used at the individual scope. For example, it could be 893 * used to set the guest permissions on a blog post. 894 * </p> 895 * 896 * <p> 897 * Depending on the scope, the value of <code>primKey</code> will have 898 * different meanings. For more information, see {@link 899 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 900 * </p> 901 * 902 * @param companyId the primary key of the company 903 * @param name the resource's name, which can be either a class name or a 904 portlet ID 905 * @param scope the scope 906 * @param primKey the primary key 907 * @param roleId the primary key of the role 908 * @param actionIds the action IDs of the actions 909 * @throws PortalException if a role with the primary key or a resource 910 action with the name and action ID could not be found 911 * @throws SystemException if a system exception occurred 912 */ 913 public static void setResourcePermissions(long companyId, 914 java.lang.String name, int scope, java.lang.String primKey, 915 long roleId, java.lang.String[] actionIds) 916 throws com.liferay.portal.kernel.exception.PortalException, 917 com.liferay.portal.kernel.exception.SystemException { 918 getService() 919 .setResourcePermissions(companyId, name, scope, primKey, roleId, 920 actionIds); 921 } 922 923 /** 924 * Updates the role's permissions at the scope, setting the actions that can 925 * be performed on resources of the type. Existing actions are replaced. 926 * 927 * <p> 928 * This method can be used to set permissions at any scope, but it is 929 * generally only used at the individual scope. For example, it could be 930 * used to set the guest permissions on a blog post. 931 * </p> 932 * 933 * <p> 934 * Depending on the scope, the value of <code>primKey</code> will have 935 * different meanings. For more information, see {@link 936 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 937 * </p> 938 * 939 * @param companyId the primary key of the company 940 * @param name the resource's name, which can be either a class name or a 941 portlet ID 942 * @param scope the scope 943 * @param primKey the primary key 944 * @param roleIdsToActionIds a map of role IDs to action IDs of the actions 945 * @throws PortalException if a role with the primary key or a resource 946 action with the name and action ID could not be found 947 * @throws SystemException if a system exception occurred 948 */ 949 public static void setResourcePermissions(long companyId, 950 java.lang.String name, int scope, java.lang.String primKey, 951 java.util.Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds) 952 throws com.liferay.portal.kernel.exception.PortalException, 953 com.liferay.portal.kernel.exception.SystemException { 954 getService() 955 .setResourcePermissions(companyId, name, scope, primKey, 956 roleIdsToActionIds); 957 } 958 959 public static ResourcePermissionLocalService getService() { 960 if (_service == null) { 961 _service = (ResourcePermissionLocalService)PortalBeanLocatorUtil.locate(ResourcePermissionLocalService.class.getName()); 962 963 ReferenceRegistry.registerReference(ResourcePermissionLocalServiceUtil.class, 964 "_service"); 965 } 966 967 return _service; 968 } 969 970 /** 971 * @deprecated As of 6.2.0 972 */ 973 public void setService(ResourcePermissionLocalService service) { 974 } 975 976 private static ResourcePermissionLocalService _service; 977 }