Package com.xpn.xwiki.user.api
Interface XWikiRightService
-
- All Known Implementing Classes:
XWikiRightServiceImpl
public interface XWikiRightService
-
-
Field Summary
Fields Modifier and Type Field Description static StringALLGROUP_GROUPThe AllGroup username.static StringALLGROUP_GROUP_FULLNAMEThe AllGroup full name.static StringGUEST_USERThe Guest username.static StringGUEST_USER_FULLNAMEThe Guest full name.static StringSUPERADMIN_USERThe Superadmin username.static StringSUPERADMIN_USER_FULLNAMEThe Superadmin full name.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description booleancheckAccess(String action, XWikiDocument doc, XWikiContext context)Checks if the wiki current user has the right to execute (@code action} on the documentdoc, 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).booleanhasAccessLevel(String right, String username, String docname, XWikiContext context)booleanhasAdminRights(XWikiContext context)Deprecated.since 6.1RC1, useContextualAuthorizationManager.hasAccess(org.xwiki.security.authorization.Right)insteadbooleanhasProgrammingRights(XWikiDocument doc, XWikiContext context)Deprecated.booleanhasProgrammingRights(XWikiContext context)Deprecated.since 6.1RC1, useContextualAuthorizationManager.hasAccess(org.xwiki.security.authorization.Right)insteadbooleanhasWikiAdminRights(XWikiContext context)Deprecated.static booleanisGuest(EntityReference userReference)static booleanisSuperAdmin(EntityReference userReference)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
-
isSuperAdmin
static boolean isSuperAdmin(EntityReference userReference)
- Parameters:
userReference- the user reference- Returns:
- true if the passed reference belong to superadmin
- Since:
- 9.2RC1
-
isGuest
static boolean isGuest(EntityReference userReference)
- Parameters:
userReference- the user reference- Returns:
- true if the passed reference belong to superadmin
- Since:
- 9.2RC1
-
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 documentdoc, 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 documentdoc- the document to perform action oncontext- the xwiki context in which to perform the verification (from which to get the user, for example)- Returns:
trueif the user has right to executeactionondoc,falseotherwise 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
@Deprecated boolean hasAccessLevel(String right, String username, String docname, XWikiContext context) throws XWikiException
Deprecated.Verifies if the user identified byusernamehas the access level identified byrighton the document with the namedocname.- Parameters:
right- the access level to check (for example, 'view' or 'edit' or 'comment').username- the name of the user to check the right fordocname- the document on which to check the rightcontext- the xwiki context in which to perform the verification- Returns:
trueif the user has the specified right on the document,falseotherwise- Throws:
XWikiException- if something goes wrong during the rights checking process
-
hasProgrammingRights
@Deprecated boolean hasProgrammingRights(XWikiContext context)
Deprecated.since 6.1RC1, useContextualAuthorizationManager.hasAccess(org.xwiki.security.authorization.Right)insteadChecks 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:
trueif the author of the context document has programming rights,falseotherwise.
-
hasProgrammingRights
@Deprecated boolean hasProgrammingRights(XWikiDocument doc, XWikiContext context)
Deprecated.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 forcontext- the xwiki context of this request- Returns:
trueif the author ofdochas programming rights,falseotherwise.
-
hasAdminRights
@Deprecated boolean hasAdminRights(XWikiContext context)
Deprecated.since 6.1RC1, useContextualAuthorizationManager.hasAccess(org.xwiki.security.authorization.Right)insteadChecks 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:
trueif the current user in the context has theadminright,falseotherwise
-
hasWikiAdminRights
@Deprecated boolean hasWikiAdminRights(XWikiContext context)
Deprecated.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:
trueif the current user in the context has theadminright,falseotherwise- 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
-
-