Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Is there way to get ACL list for given resource path.?

Avatar

Level 4

Hello Experts,

 

I would like to get all allowed users (read/write) list for a given resource path.
Let say I have a user called 'test-user' and I gave read/write permissions for  '/content' folder and all child folders under '/content' folder.
I would like to write a API bypassing a resource path as a request parameter (could be '/content' or any children of '/content')
and get all the allowed users (read/write) for that given path.

I wrote the below code, but it's returning the only configured users for the given resource node.
let say as I said above, 'test-user' configured for '/content' folder and all children, when I called below code for '/content/dam' folder 'test-user' isn't returning.

	@Override
	public JackrabbitAccessControlList getAccessControlList(final @notnull String path) {
		//Getting resource resolver by using service user
		ResourceResolver resolver = getResourceResolver();
		Resource resource = resolver.getResource(path);
		Session session = resolver.adaptTo(Session.class);
		JackrabbitAccessControlList acl = null;

		try {
			acl = AccessControlUtils.getAccessControlList(session, resource.getPath());

		} catch (RepositoryException e) {
			logger.error("Failed to retrive the user permission ", e);
		}

		return acl;
	}


Any thoughts.?

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
3 Replies

Avatar

Correct answer by
Community Advisor

Avatar

Level 4
Thanks @arunpatidar, I've achieved the solution. Just FYI, I got all the user from the SQL2 query and used UserManager API to get the permission for given path.