You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Julian Reschke (Jira)" <ji...@apache.org> on 2022/05/11 15:03:00 UTC

[jira] [Comment Edited] (OAK-9494) Check if a privilege name is included in a set/array of Privileges obtained from AccessControlManager.getPrivileges

    [ https://issues.apache.org/jira/browse/OAK-9494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17534945#comment-17534945 ] 

Julian Reschke edited comment on OAK-9494 at 5/11/22 3:02 PM:
--------------------------------------------------------------

trunk: [111c0af140|https://github.com/apache/jackrabbit-oak/commit/111c0af1407402bd4eafd5a7a621e1dd57ef6841] [5f241a4426|https://github.com/apache/jackrabbit-oak/commit/5f241a44263ae5b07d1d2e2966e5d2d7b0b5dfee] [7d4d1f9314|https://github.com/apache/jackrabbit-oak/commit/7d4d1f9314244db91d2d4f4468727e876e3c92f1]


was (Author: reschke):
trunk: [111c0af140|https://github.com/apache/jackrabbit-oak/commit/111c0af1407402bd4eafd5a7a621e1dd57ef6841] [5f241a4426|https://github.com/apache/jackrabbit-oak/commit/5f241a44263
ae5b07d1d2e2966e5d2d7b0b5dfee] [7d4d1f9314|https://github.com/apache/jackrabbit-oak/commit/7d4d1f9314244db91d2d4f4468727e876e3c92f1]

> Check if a privilege name is included in a set/array of Privileges obtained from AccessControlManager.getPrivileges
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: OAK-9494
>                 URL: https://issues.apache.org/jira/browse/OAK-9494
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: jackrabbit-api, security
>            Reporter: Joerg Hoh
>            Assignee: Angela Schreiber
>            Priority: Major
>             Fix For: 1.42.0
>
>         Attachments: GetPrivilegeCollectionIncludeNamesTest_ACCESSCONTORL_MANAGER_GET_PRIVILEGE_COLLECTION_20210720_142800.csv, GetPrivilegeCollectionIncludeNamesTest_ACCESSCONTORL_MANAGER_HAS_PRIVILEGES_20210720_145010.csv, GetPrivilegeCollectionIncludeNamesTest_JCR_PRIVILEGE_NAME_AGGREGATION_20210720_144405.csv
>
>
> I have a case where I need to check for a session if individual privileges are available for a specific node. For performance reasons I want to avoid to execute multiple calls to {{accessControlManager.hasPrivilege(...)}}, but get all Privileges of that node once and the set various flags based on the presene of certain privileges or not.
> I want to use something like this:
> {code}
> Set<String> applicablePrivilegeNames = ...(accessControlManager.getPrivileges(path))...
> boolean canAddChildNodes = applicablePrivilegeNames.contains(Privilege.JCR_ADD_CHILD_NODES);
> boolean canWrite = applicablePrivilegeNames.contains(Privilege.WRITE);
> {code}
> It should work with aggregates as well.
> Right now it's a bit problematic because {{privilege.getName()}} resolves to something like {{jcr:read}}, while the value of {{Privilege.JCR_READ}} is {{\{http://www.jcp.org/jcr/1.0}read}}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)