Hi,

I found that i can just get a user with a request on this
/system/userManager/user/<userId>.json', so I can loop on the result of
<resource>.eacl.json and do multiple calls, it works.

However, while jcr:readAccessControl seems to give me access to
<resource>.acl.json, I can't find what privilege I need to access
<node>.eacl.json. It works only with admin user, and granting jcr:all to
everyone on the root node still returns a 404 when I call this URL. The
same URL returns the ACLs with the admin user.

Any idea on how I can allow any user to read the effective acls?

Thank you very much
Guillaume

On Wed, Mar 16, 2016 at 3:24 PM, Guillaume Lucazeau <[email protected]>
wrote:

> Hello,
>
> I would need to display some properties from a user node, for now the
> displayName property.
>
> I need it for the current logged in user, the users that have jcr:write
> privileges on a resource, and also for the "lastModifiedBy" property of a
> resource.
>
> I know how to get privileges list in JSON, and I can get properties like
> this:
>
>     Session session = resourceResolver.adaptTo(Session.class);
>
>     UserManager userManager = AccessControlUtil.getUserManager(session);
>     Authorizable auth = userManager.getAuthorizable(session.getUserID());
>     Value[] names = auth.getProperty("displayName");
>
>     String displayName =  names[0].toString();
>
> Sometimes I can write the displayName directly in the view from JSP code,
> some other times I would need to get it in JSON because this would
> refreshed with an Ajax call.
>
> Is it possible to get the displayName in a JSP just by adapting some
> resources? I couldn't find how. The usermanager bundle provided as an
> example does this:
> function displayName(path) {
>     var res = request.getResourceResolver().resolve(path);
>     var resValueMap =
> res.adaptTo(Packages.org.apache.sling.api.resource.ValueMap);
>     var value = resValueMap.get("displayName");
>     if (value == null) {
>         value = path.substring(path.lastIndexOf('/') + 1)
>     }
>     return value;
> }
>
> But I don't know how to get the path to the user node from this:
> ${slingRequest.remoteUser}
>
> Is it a good idea to create a service to return an Authorizable or
> displayName from a user ID, and store this displayName value on my model,
> to easily get it in a JSP (<c:out var="${model.lastmodifiedByDisplayName}"
> />
>
> What would be the best way to map the IDs returned by <some
> resource>.eacl.json to their displayName ?
>
> Thank you very much for your help
>
> Regards,
> Guillaume
>

Reply via email to