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