Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
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

Cna you please check if this helps

https://jackrabbit.apache.org/oak/docs/security/permission.html



Arun Patidar

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.

Avatar

Community Advisor
Thanks for sharing the solution


Arun Patidar