jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JCR-2910) Please add JackrabbitSession.isAdmin()
Date Tue, 08 Mar 2011 17:41:00 GMT

    [ https://issues.apache.org/jira/browse/JCR-2910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13004084#comment-13004084

Jukka Zitting commented on JCR-2910:

> Within Unix systems, there is a very simple way to find out if the user is root.

That's just because Unix defines the special user id zero as root. The equivalent solution
for us would be to define "admin" as the one and only administrator account.

> the only reason for you to be against this feature is to make my work harder? :-)

:-) In the short term perhaps, but I strongly believe that a solution like the one proposed
leads to more work in the long run.

For example, what if we later decided to extend backup rights also to some special system
account that only needs read access to everything but should never be able to write anything?
This is fairly common in many environments, but would be impossible to implement if our backup
tools relied on an isAdmin() method. However, a backup() API method could easily be modified
to do this.

Similarly, having administrative operations behind an API makes it possible to easily access
that functionality through not just multiple different user interfaces (including JMX) but
also from automated tests or things like scheduled backups.

> 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

View raw message