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 name 114 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 matching the dynamic query. 260 * 261 * @param dynamicQuery the dynamic query 262 * @return the number of rows matching 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 matching 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 matching 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 companyId, java.lang.String name, int scope, 281 java.lang.String primKey, long roleId); 282 283 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 284 public com.liferay.portal.model.ResourcePermission fetchResourcePermission( 285 long resourcePermissionId); 286 287 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 288 public com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery getActionableDynamicQuery(); 289 290 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 291 public java.util.Map<java.lang.Long, java.util.Set<java.lang.String>> getAvailableResourcePermissionActionIds( 292 long companyId, java.lang.String name, int scope, 293 java.lang.String primKey, 294 java.util.Collection<java.lang.String> actionIds); 295 296 /** 297 * Returns the intersection of action IDs the role has permission at the 298 * scope to perform on resources of the type. 299 * 300 * @param companyId he 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 304 * @param primKey the primary key 305 * @param roleId the primary key of the role 306 * @param actionIds the action IDs 307 * @return the intersection of action IDs the role has permission at the 308 scope to perform on resources of the type 309 * @throws PortalException if a resouce action could not be found for any 310 one of the actions on the resource 311 */ 312 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 313 public java.util.List<java.lang.String> getAvailableResourcePermissionActionIds( 314 long companyId, java.lang.String name, int scope, 315 java.lang.String primKey, long roleId, 316 java.util.Collection<java.lang.String> actionIds) 317 throws com.liferay.portal.kernel.exception.PortalException; 318 319 /** 320 * @deprecated As of 7.0.0, replaced by {@link 321 #getAvailableResourcePermissionActionIds(long, String, int, 322 String, Collection)} 323 */ 324 @java.lang.Deprecated 325 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 326 public java.util.Map<java.lang.Long, java.util.Set<java.lang.String>> getAvailableResourcePermissionActionIds( 327 long companyId, java.lang.String name, int scope, 328 java.lang.String primKey, long[] roleIds, 329 java.util.Collection<java.lang.String> actionIds); 330 331 /** 332 * Returns the Spring bean ID for this bean. 333 * 334 * @return the Spring bean ID for this bean 335 */ 336 public java.lang.String getBeanIdentifier(); 337 338 @Override 339 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 340 public com.liferay.portal.model.PersistedModel getPersistedModel( 341 java.io.Serializable primaryKeyObj) 342 throws com.liferay.portal.kernel.exception.PortalException; 343 344 /** 345 * Returns the resource permission for the role at the scope to perform the 346 * actions on resources of the type. 347 * 348 * @param companyId the primary key of the company 349 * @param name the resource's name, which can be either a class name or a 350 portlet ID 351 * @param scope the scope 352 * @param primKey the primary key 353 * @param roleId the primary key of the role 354 * @return the resource permission for the role at the scope to perform the 355 actions on resources of the type 356 * @throws PortalException if no matching resources could be found 357 */ 358 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 359 public com.liferay.portal.model.ResourcePermission getResourcePermission( 360 long companyId, java.lang.String name, int scope, 361 java.lang.String primKey, long roleId) 362 throws com.liferay.portal.kernel.exception.PortalException; 363 364 /** 365 * Returns the resource permission with the primary key. 366 * 367 * @param resourcePermissionId the primary key of the resource permission 368 * @return the resource permission 369 * @throws PortalException if a resource permission with the primary key could not be found 370 */ 371 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 372 public com.liferay.portal.model.ResourcePermission getResourcePermission( 373 long resourcePermissionId) 374 throws com.liferay.portal.kernel.exception.PortalException; 375 376 /** 377 * Returns all the resource permissions at the scope of the type. 378 * 379 * @param companyId the primary key of the company 380 * @param name the resource's name, which can be either a class name or a 381 portlet ID 382 * @param scope the scope 383 * @param primKey the primary key 384 * @return the resource permissions at the scope of the type 385 */ 386 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 387 public java.util.List<com.liferay.portal.model.ResourcePermission> getResourcePermissions( 388 long companyId, java.lang.String name, int scope, 389 java.lang.String primKey); 390 391 /** 392 * Returns a range of all the resource permissions. 393 * 394 * <p> 395 * 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. 396 * </p> 397 * 398 * @param start the lower bound of the range of resource permissions 399 * @param end the upper bound of the range of resource permissions (not inclusive) 400 * @return the range of resource permissions 401 */ 402 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 403 public java.util.List<com.liferay.portal.model.ResourcePermission> getResourcePermissions( 404 int start, int end); 405 406 /** 407 * Returns the number of resource permissions. 408 * 409 * @return the number of resource permissions 410 */ 411 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 412 public int getResourcePermissionsCount(); 413 414 /** 415 * Returns the number of resource permissions at the scope of the type. 416 * 417 * @param companyId the primary key of the company 418 * @param name the resource's name, which can be either a class name or a 419 portlet ID 420 * @param scope the scope 421 * @param primKey the primary key 422 * @return the number of resource permissions at the scope of the type 423 */ 424 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 425 public int getResourcePermissionsCount(long companyId, 426 java.lang.String name, int scope, java.lang.String primKey); 427 428 /** 429 * Returns the resource permissions that apply to the resource. 430 * 431 * @param companyId the primary key of the resource's company 432 * @param groupId the primary key of the resource's group 433 * @param name the resource's name, which can be either a class name or a 434 portlet ID 435 * @param primKey the primary key of the resource 436 * @return the resource permissions associated with the resource 437 */ 438 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 439 public java.util.List<com.liferay.portal.model.ResourcePermission> getResourceResourcePermissions( 440 long companyId, long groupId, java.lang.String name, 441 java.lang.String primKey); 442 443 /** 444 * Returns all the resource permissions for the role. 445 * 446 * @param roleId the primary key of the role 447 * @return the resource permissions for the role 448 */ 449 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 450 public java.util.List<com.liferay.portal.model.ResourcePermission> getRoleResourcePermissions( 451 long roleId); 452 453 /** 454 * Returns a range of all the resource permissions for the role at the 455 * scopes. 456 * 457 * <p> 458 * Useful when paginating results. Returns a maximum of <code>end - 459 * start</code> instances. <code>start</code> and <code>end</code> are not 460 * primary keys, they are indexes in the result set. Thus, <code>0</code> 461 * refers to the first result in the set. Setting both <code>start</code> 462 * and <code>end</code> to {@link 463 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 464 * result set. 465 * </p> 466 * 467 * @param roleId the primary key of the role 468 * @param scopes the scopes 469 * @param start the lower bound of the range of results 470 * @param end the upper bound of the range of results (not inclusive) 471 * @return the range of resource permissions for the role at the scopes 472 */ 473 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 474 public java.util.List<com.liferay.portal.model.ResourcePermission> getRoleResourcePermissions( 475 long roleId, int[] scopes, int start, int end); 476 477 /** 478 * Returns all the resource permissions where scope = any ?. 479 * 480 * <p> 481 * Useful when paginating results. Returns a maximum of <code>end - 482 * start</code> instances. <code>start</code> and <code>end</code> are not 483 * primary keys, they are indexes in the result set. Thus, <code>0</code> 484 * refers to the first result in the set. Setting both <code>start</code> 485 * and <code>end</code> to {@link 486 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 487 * result set. 488 * </p> 489 * 490 * @param scopes the scopes 491 * @return the resource permissions where scope = any ? 492 */ 493 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 494 public java.util.List<com.liferay.portal.model.ResourcePermission> getScopeResourcePermissions( 495 int[] scopes); 496 497 /** 498 * Returns <code>true</code> if the resource permission grants permission to 499 * perform the resource action. Note that this method does not ensure that 500 * the resource permission refers to the same type of resource as the 501 * resource action. 502 * 503 * @param resourcePermission the resource permission 504 * @param resourceAction the resource action 505 * @return <code>true</code> if the resource permission grants permission to 506 perform the resource action 507 */ 508 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 509 public boolean hasActionId( 510 com.liferay.portal.model.ResourcePermission resourcePermission, 511 com.liferay.portal.model.ResourceAction resourceAction); 512 513 /** 514 * Returns <code>true</code> if the role has permission at the scope to 515 * perform the action on resources of the type. 516 * 517 * <p> 518 * Depending on the scope, the value of <code>primKey</code> will have 519 * different meanings. For more information, see {@link 520 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 521 * </p> 522 * 523 * @param companyId the primary key of the company 524 * @param name the resource's name, which can be either a class name or a 525 portlet ID 526 * @param scope the scope 527 * @param primKey the primary key 528 * @param roleId the primary key of the role 529 * @param actionId the action ID 530 * @return <code>true</code> if the role has permission to perform the 531 action on the resource; <code>false</code> otherwise 532 * @throws PortalException if a role with the primary key or a resource 533 action with the name and action ID could not be found 534 */ 535 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 536 public boolean hasResourcePermission(long companyId, java.lang.String name, 537 int scope, java.lang.String primKey, long roleId, 538 java.lang.String actionId) 539 throws com.liferay.portal.kernel.exception.PortalException; 540 541 /** 542 * Returns <code>true</code> if the roles have permission at the scope to 543 * perform the action on resources of the type. 544 * 545 * <p> 546 * Depending on the scope, the value of <code>primKey</code> will have 547 * different meanings. For more information, see {@link 548 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 549 * </p> 550 * 551 * @param companyId the primary key of the company 552 * @param name the resource's name, which can be either a class name or a 553 portlet ID 554 * @param scope the scope 555 * @param primKey the primary key 556 * @param roleIds the primary keys of the roles 557 * @param actionId the action ID 558 * @return <code>true</code> if any one of the roles has permission to 559 perform the action on the resource; <code>false</code> otherwise 560 * @throws PortalException if any one of the roles with the primary keys 561 could not be found or if a resource action with the name and 562 action ID could not be found 563 */ 564 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 565 public boolean hasResourcePermission(long companyId, java.lang.String name, 566 int scope, java.lang.String primKey, long[] roleIds, 567 java.lang.String actionId) 568 throws com.liferay.portal.kernel.exception.PortalException; 569 570 /** 571 * Returns <code>true</code> if the roles have permission at the scope to 572 * perform the action on the resources. 573 * 574 * <p> 575 * Depending on the scope, the value of <code>primKey</code> will have 576 * different meanings. For more information, see {@link 577 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 578 * </p> 579 * 580 * @param resources the resources 581 * @param roleIds the primary keys of the roles 582 * @param actionId the action ID 583 * @return <code>true</code> if any one of the roles has permission to 584 perform the action on any one of the resources; 585 <code>false</code> otherwise 586 * @throws PortalException if any one of the roles with the primary keys 587 could not be found or if a resource action with the name and 588 action ID could not be found 589 */ 590 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 591 public boolean hasResourcePermission( 592 java.util.List<com.liferay.portal.model.Resource> resources, 593 long[] roleIds, java.lang.String actionId) 594 throws com.liferay.portal.kernel.exception.PortalException; 595 596 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 597 public boolean[] hasResourcePermissions(long companyId, 598 java.lang.String name, int scope, java.lang.String primKey, 599 long[] roleIds, java.lang.String actionId) 600 throws com.liferay.portal.kernel.exception.PortalException; 601 602 /** 603 * Returns <code>true</code> if the role has permission at the scope to 604 * perform the action on the resource. 605 * 606 * <p> 607 * Depending on the scope, the value of <code>primKey</code> will have 608 * different meanings. For more information, see {@link 609 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 610 * </p> 611 * 612 * @param companyId the primary key of the company 613 * @param name the resource's name, which can be either a class name or a 614 portlet ID 615 * @param scope the scope 616 * @param roleId the primary key of the role 617 * @param actionId the action ID 618 * @return <code>true</code> if the role has permission to perform the 619 action on the resource; <code>false</code> otherwise 620 * @throws PortalException if a role with the primary key or a resource 621 action with the name and action ID could not be found 622 */ 623 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 624 public boolean hasScopeResourcePermission(long companyId, 625 java.lang.String name, int scope, long roleId, java.lang.String actionId) 626 throws com.liferay.portal.kernel.exception.PortalException; 627 628 /** 629 * Reassigns all the resource permissions from the source role to the 630 * destination role, and deletes the source role. 631 * 632 * @param fromRoleId the primary key of the source role 633 * @param toRoleId the primary key of the destination role 634 * @throws PortalException if a role with the primary key could not be found 635 */ 636 public void mergePermissions(long fromRoleId, long toRoleId) 637 throws com.liferay.portal.kernel.exception.PortalException; 638 639 /** 640 * Grants the role default permissions to all the resources of the type and 641 * at the scope stored in the resource permission, deletes the resource 642 * permission, and deletes the resource permission's role if it has no 643 * permissions remaining. 644 * 645 * @param resourcePermissionId the primary key of the resource permission 646 * @param toRoleId the primary key of the role 647 * @throws PortalException if a resource permission or role with the primary 648 key could not be found 649 */ 650 public void reassignPermissions(long resourcePermissionId, long toRoleId) 651 throws com.liferay.portal.kernel.exception.PortalException; 652 653 /** 654 * Revokes permission at the scope from the role to perform the action on 655 * resources of the type. For example, this method could be used to revoke a 656 * group scope permission to edit blog posts. 657 * 658 * <p> 659 * Depending on the scope, the value of <code>primKey</code> will have 660 * different meanings. For more information, see {@link 661 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 662 * </p> 663 * 664 * @param companyId the primary key of the company 665 * @param name the resource's name, which can be either a class name or a 666 portlet ID 667 * @param scope the scope 668 * @param primKey the primary key 669 * @param roleId the primary key of the role 670 * @param actionId the action ID 671 * @throws PortalException if a role with the primary key or a resource 672 action with the name and action ID could not be found 673 */ 674 public void removeResourcePermission(long companyId, java.lang.String name, 675 int scope, java.lang.String primKey, long roleId, 676 java.lang.String actionId) 677 throws com.liferay.portal.kernel.exception.PortalException; 678 679 /** 680 * Revokes all permissions at the scope from the role to perform the action 681 * on resources of the type. For example, this method could be used to 682 * revoke all individual scope permissions to edit blog posts from site 683 * members. 684 * 685 * @param companyId the primary key of the company 686 * @param name the resource's name, which can be either a class name or a 687 portlet ID 688 * @param scope the scope 689 * @param roleId the primary key of the role 690 * @param actionId the action ID 691 * @throws PortalException if a role with the primary key or a resource 692 action with the name and action ID could not be found 693 */ 694 public void removeResourcePermissions(long companyId, 695 java.lang.String name, int scope, long roleId, java.lang.String actionId) 696 throws com.liferay.portal.kernel.exception.PortalException; 697 698 /** 699 * Sets the Spring bean ID for this bean. 700 * 701 * @param beanIdentifier the Spring bean ID for this bean 702 */ 703 public void setBeanIdentifier(java.lang.String beanIdentifier); 704 705 /** 706 * Updates the role's permissions at the scope, setting the actions that can 707 * be performed on resources of the type, also setting the owner of any 708 * newly created resource permissions. Existing actions are replaced. 709 * 710 * <p> 711 * This method can be used to set permissions at any scope, but it is 712 * generally only used at the individual scope. For example, it could be 713 * used to set the guest permissions on a blog post. 714 * </p> 715 * 716 * <p> 717 * Depending on the scope, the value of <code>primKey</code> will have 718 * different meanings. For more information, see {@link 719 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 720 * </p> 721 * 722 * @param companyId the primary key of the company 723 * @param name the resource's name, which can be either a class name or a 724 portlet ID 725 * @param scope the scope 726 * @param primKey the primary key 727 * @param roleId the primary key of the role 728 * @param ownerId the primary key of the owner (generally the user that 729 created the resource) 730 * @param actionIds the action IDs of the actions 731 * @throws PortalException if a role with the primary key or a resource 732 action with the name and action ID could not be found 733 */ 734 public void setOwnerResourcePermissions(long companyId, 735 java.lang.String name, int scope, java.lang.String primKey, 736 long roleId, long ownerId, java.lang.String[] actionIds) 737 throws com.liferay.portal.kernel.exception.PortalException; 738 739 /** 740 * Updates the role's permissions at the scope, setting the actions that can 741 * be performed on resources of the type. Existing actions are replaced. 742 * 743 * <p> 744 * This method can be used to set permissions at any scope, but it is 745 * generally only used at the individual scope. For example, it could be 746 * used to set the guest permissions on a blog post. 747 * </p> 748 * 749 * <p> 750 * Depending on the scope, the value of <code>primKey</code> will have 751 * different meanings. For more information, see {@link 752 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 753 * </p> 754 * 755 * @param companyId the primary key of the company 756 * @param name the resource's name, which can be either a class name or a 757 portlet ID 758 * @param scope the scope 759 * @param primKey the primary key 760 * @param roleId the primary key of the role 761 * @param actionIds the action IDs of the actions 762 * @throws PortalException if a role with the primary key or a resource 763 action with the name and action ID could not be found 764 */ 765 public void setResourcePermissions(long companyId, java.lang.String name, 766 int scope, java.lang.String primKey, long roleId, 767 java.lang.String[] actionIds) 768 throws com.liferay.portal.kernel.exception.PortalException; 769 770 /** 771 * Updates the role's permissions at the scope, setting the actions that can 772 * be performed on resources of the type. Existing actions are replaced. 773 * 774 * <p> 775 * This method can be used to set permissions at any scope, but it is 776 * generally only used at the individual scope. For example, it could be 777 * used to set the guest permissions on a blog post. 778 * </p> 779 * 780 * <p> 781 * Depending on the scope, the value of <code>primKey</code> will have 782 * different meanings. For more information, see {@link 783 * com.liferay.portal.model.impl.ResourcePermissionImpl}. 784 * </p> 785 * 786 * @param companyId the primary key of the company 787 * @param name the resource's name, which can be either a class name or a 788 portlet ID 789 * @param scope the scope 790 * @param primKey the primary key 791 * @param roleIdsToActionIds a map of role IDs to action IDs of the actions 792 * @throws PortalException if a role with the primary key or a resource 793 action with the name and action ID could not be found 794 */ 795 public void setResourcePermissions(long companyId, java.lang.String name, 796 int scope, java.lang.String primKey, 797 java.util.Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds) 798 throws com.liferay.portal.kernel.exception.PortalException; 799 800 /** 801 * Updates the resource permission in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 802 * 803 * @param resourcePermission the resource permission 804 * @return the resource permission that was updated 805 */ 806 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.REINDEX) 807 public com.liferay.portal.model.ResourcePermission updateResourcePermission( 808 com.liferay.portal.model.ResourcePermission resourcePermission); 809 }