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 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
All Methods Static Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description boolean
checkAccess(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).boolean
hasAccessLevel(String right, String username, String docname, XWikiContext context)
boolean
hasAdminRights(XWikiContext context)
Deprecated.since 6.1RC1, useContextualAuthorizationManager.hasAccess(org.xwiki.security.authorization.Right)
insteadboolean
hasProgrammingRights(XWikiDocument doc, XWikiContext context)
Deprecated.boolean
hasProgrammingRights(XWikiContext context)
Deprecated.since 6.1RC1, useContextualAuthorizationManager.hasAccess(org.xwiki.security.authorization.Right)
insteadboolean
hasWikiAdminRights(XWikiContext context)
Deprecated.static boolean
isGuest(EntityReference userReference)
static boolean
isSuperAdmin(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:
true
if the user has right to executeaction
ondoc
,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
@Deprecated boolean hasAccessLevel(String right, String username, String docname, XWikiContext context) throws XWikiException
Deprecated.Verifies if the user identified byusername
has the access level identified byright
on 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:
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
@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:
true
if the author of the context document has programming rights,false
otherwise.
-
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:
true
if the author ofdoc
has programming rights,false
otherwise.
-
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:
true
if the current user in the context has theadmin
right,false
otherwise
-
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:
true
if the current user in the context has theadmin
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
-
-