com.xpn.xwiki.user.api
Interface XWikiRightService

All Known Implementing Classes:
XWikiRightServiceImpl

public interface XWikiRightService


Field Summary
static String ALLGROUP_GROUP
          The AllGroup username.
static String ALLGROUP_GROUP_FULLNAME
          The AllGroup full name.
static String GUEST_USER
          The Guest username.
static String GUEST_USER_FULLNAME
          The Guest full name.
static String SUPERADMIN_USER
          The Superadmin username.
static String SUPERADMIN_USER_FULLNAME
          The Superadmin full name.
 
Method Summary
 boolean checkAccess(String action, XWikiDocument doc, XWikiContext context)
          Checks if the wiki current user has the right to execute (@code action} on the document doc, along with redirecting to the login if it's not the case and there is no logged in user (the user is the guest user).
 boolean hasAccessLevel(String right, String username, String docname, XWikiContext context)
          Verifies if the user identified by username has the access level identified by right on the document with the name docname.
 boolean hasAdminRights(XWikiContext context)
          Checks that the current user in the context (the currently authenticated user) has administration rights either on the current wiki or on the current space.
 boolean hasProgrammingRights(XWikiContext context)
          Checks if the author of the context document (last editor of the content of the document) has programming rights (used to determine if the protected calls in the script contained in the document should be executed or not).
 boolean hasProgrammingRights(XWikiDocument doc, XWikiContext context)
          Checks if the author of the passed document (last editor of the content of the document) has programming rights (used to determine if the protected calls in the script contained in the document should be executed or not).
 boolean hasWikiAdminRights(XWikiContext context)
          Checks that the current user in the context (the currently authenticated user) has administration rights on the current wiki, regardless of any space admin rights that might also be available.
 List<String> listAllLevels(XWikiContext context)
           
 

Field Detail

SUPERADMIN_USER

static final String SUPERADMIN_USER
The Superadmin username.

See Also:
Constant Field Values

SUPERADMIN_USER_FULLNAME

static final String SUPERADMIN_USER_FULLNAME
The Superadmin full name.

See Also:
Constant Field Values

GUEST_USER

static final String GUEST_USER
The Guest username.

See Also:
Constant Field Values

GUEST_USER_FULLNAME

static final String GUEST_USER_FULLNAME
The Guest full name.

See Also:
Constant Field Values

ALLGROUP_GROUP

static final String ALLGROUP_GROUP
The AllGroup username.

See Also:
Constant Field Values

ALLGROUP_GROUP_FULLNAME

static final String ALLGROUP_GROUP_FULLNAME
The AllGroup full name.

See Also:
Constant Field Values
Method Detail

checkAccess

boolean checkAccess(String action,
                    XWikiDocument doc,
                    XWikiContext context)
                    throws XWikiException
Checks if the wiki current user has the right to execute (@code action} on the document doc, along with redirecting to the login if it's not the case and there is no logged in user (the user is the guest user).

Parameters:
action - the action to be executed on the document
doc - the document to perform action on
context - the xwiki context in which to perform the verification (from which to get the user, for example)
Returns:
true if the user has right to execute action on doc, false otherwise and requests the login from the authentication service (redirecting to the login page in the case of a form authenticator, for example) when no user is logged in.
Throws:
XWikiException - if something goes wrong during the rights checking process

hasAccessLevel

boolean hasAccessLevel(String right,
                       String username,
                       String docname,
                       XWikiContext context)
                       throws XWikiException
Verifies if the user identified by username has the access level identified by right on the document with the name docname.

Parameters:
right - the access level to check (for example, 'view' or 'edit' or 'comment').
username - the name of the user to check the right for
docname - the document on which to check the right
context - the xwiki context in which to perform the verification
Returns:
true if the user has the specified right on the document, false otherwise
Throws:
XWikiException - if something goes wrong during the rights checking process

hasProgrammingRights

boolean hasProgrammingRights(XWikiContext context)
Checks if the author of the context document (last editor of the content of the document) has programming rights (used to determine if the protected calls in the script contained in the document should be executed or not).

Parameters:
context - the xwiki context of this request
Returns:
true if the author of the context document has programming rights, false otherwise.

hasProgrammingRights

boolean hasProgrammingRights(XWikiDocument doc,
                             XWikiContext context)
Checks if the author of the passed document (last editor of the content of the document) has programming rights (used to determine if the protected calls in the script contained in the document should be executed or not).

Parameters:
doc - the document to check programming rights for
context - the xwiki context of this request
Returns:
true if the author of doc has programming rights, false otherwise.

hasAdminRights

boolean hasAdminRights(XWikiContext context)
Checks that the current user in the context (the currently authenticated user) has administration rights either on the current wiki or on the current space.

Parameters:
context - the xwiki context of this request
Returns:
true if the current user in the context has the admin right, false otherwise

hasWikiAdminRights

boolean hasWikiAdminRights(XWikiContext context)
Checks that the current user in the context (the currently authenticated user) has administration rights on the current wiki, regardless of any space admin rights that might also be available.

Parameters:
context - the xwiki context of this request
Returns:
true if the current user in the context has the admin right, false otherwise
Since:
3.2M3

listAllLevels

List<String> listAllLevels(XWikiContext context)
                           throws XWikiException
Parameters:
context - the xwiki context of this request
Returns:
the list of all the known access levels
Throws:
XWikiException - if something goes wrong during the rights checking process


Copyright © 2004-2013 XWiki. All Rights Reserved.