[
https://issues.apache.org/jira/browse/JCR-2910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13003942#comment-13003942
]
angela commented on JCR-2910:
-----------------------------
> What about JackrabbitSession.getUser()?
while i would not object to move the SessionImpl.isAdmin to the API, that new
suggestion doesn't make any sense to me.
i added the former method recently to SessionImpl as we used to have plenty of
duplicate code in jackrabbit-core that retrieved the subject from the session
and tested if it contained a AdminPrincipal... thus SessionImpl.isAdmin
basically doesn't rely on user management being implemented (in fact it is an
optional feature that can be turned off by using a different security
configuration).
having this in mind Session#getUser really doesn't add any benefit over
retrieving the User from the UserManager.
> Please add JackrabbitSession.isAdmin()
> --------------------------------------
>
> Key: JCR-2910
> URL: https://issues.apache.org/jira/browse/JCR-2910
> Project: Jackrabbit Content Repository
> Issue Type: Improvement
> Reporter: Thomas Mueller
> Priority: Minor
>
> Currently finding out if the session user is an admin requires:
> JackrabbitSession js = (JackrabbitSession) session;
> User user = ((User) js.getUserManager().getAuthorizable(session.getUserID()));
> boolean isAdmin = user.isAdmin();
> Or: ((SessionImpl) session).isAdmin(). However casting to an implementation
> is problematic for several reasons.
> I think it would make sense to add isAdmin() to the JackrabbitSession
> interface, so the code above would be:
> ((JackrabbitSession) session).isAdmin()
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira