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

Justin Edelson commented on SLING-6504:
---------------------------------------

This seems to me to be a slippery slope. The more "source" objects we add, the 
harder it becomes to reason about what is happening. In the specific example of 
a user related class, there is typically some ambiguity. Adapting a Resource to 
a User (generally) means that you want the User represented by the Resource 
whereas adapting a ResourceResolver to a User (generally) means you want the 
logged in User from the ResourceResolver.

To avoid more magic, I'd suggest we allow for an explicit declaration of the 
source object, e.g. something like this:

{code}
data-sly-use.user="com.myco.User from resourceResolver"
{code}

This should be relatively straightforward to parse and wouldn't conflict with 
any existing syntax.

> Use-api also adaptable from ResourceResolver
> --------------------------------------------
>
>                 Key: SLING-6504
>                 URL: https://issues.apache.org/jira/browse/SLING-6504
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>            Reporter: Feike Visser
>              Labels: Sightly
>
> The current implementation of the Use-api accept classes that are adaptable 
> from Request or Resource. But in many cases it would also be great if they 
> can be adaptable from ResourceResolver.
> Now you need to write a small wrapper to get the resourceResolver and adapt 
> to the class.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to