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