API to check user access to DAM asset where the folder is protected by CUG permissions
Is there a quick API available to say pass two parameters
User, Path of DAM asset
and returns true or false if the user has access to it?
Is there a quick API available to say pass two parameters
User, Path of DAM asset
and returns true or false if the user has access to it?
I used this and it's working as expected now
/* Retrieving User authorizable instance */
Authorizable auth = userManager.getAuthorizable(userInfo.getUserId());
final ResourceResolver resolver = resolverFactory.getAdministrativeResourceResolver(null);
final Session adminSession = resolver.adaptTo(Session.class);
//logger.info("User Id"+a.getID());
final Session userSession = adminSession.impersonate(new javax.jcr.SimpleCredentials(auth.getID(),new char[0]));
AccessControlManager acMgr = userSession.getAccessControlManager();
hasAccess = userSession.getAccessControlManager().hasPrivileges(resourcePath, new Privilege[] {acMgr.privilegeFromName(Privilege.JCR_READ)});
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.