From dev-return-30978-apmail-jackrabbit-dev-archive=jackrabbit.apache.org@jackrabbit.apache.org Tue Mar 08 13:21:25 2011 Return-Path: Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: (qmail 11816 invoked from network); 8 Mar 2011 13:21:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Mar 2011 13:21:24 -0000 Received: (qmail 17383 invoked by uid 500); 8 Mar 2011 13:21:24 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 17343 invoked by uid 500); 8 Mar 2011 13:21:24 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 17336 invoked by uid 99); 8 Mar 2011 13:21:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Mar 2011 13:21:24 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Mar 2011 13:21:21 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id DD51939D4D8 for ; Tue, 8 Mar 2011 13:20:59 +0000 (UTC) Date: Tue, 8 Mar 2011 13:20:59 +0000 (UTC) From: "Jukka Zitting (JIRA)" To: dev@jackrabbit.apache.org Message-ID: <1983390793.4290.1299590459903.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <917978550.4119.1299583019431.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] Commented: (JCR-2910) Please add JackrabbitSession.isAdmin MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/JCR-2910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13003925#comment-13003925 ] Jukka Zitting commented on JCR-2910: ------------------------------------ > backup the repository, or change the configuration The code that actually implements these features should already have access to internal methods like SessionImpl.isAdmin(), so I don't see why we'd need to expose it to external clients. The API we expose for these operations should simply throw exceptions if the user doesn't have enough access rights. If the user interface needs to be able to determine whether the current user is allowed to perform such operations (for example to grey out or hide certain UI elements), it should use the Session.hasCapability() method for that. > 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