public class Api extends Object
Modifier and Type | Field and Description |
---|---|
protected XWikiContext |
context
The current context, needed by the underlying protected object.
|
Constructor and Description |
---|
Api(XWikiContext context) |
Modifier and Type | Method and Description |
---|---|
protected List<Document> |
convert(List<XWikiDocument> xdocList)
Convert a list of internal representation of documents to public api documents.
|
protected Attachment |
convert(XWikiAttachment xattach)
Convert an internal representation of an attachment to the public api Attachment.
|
protected Document |
convert(XWikiDocument xdoc)
Convert an internal representation of document to public api document.
|
protected List<Attachment> |
convertAttachments(List<XWikiAttachment> xattaches)
Convert a list of attachments in their internal form to a list of public api Attachments.
|
protected AuthorizationManager |
getAuthorizationManager() |
protected ContextualAuthorizationManager |
getContextualAuthorizationManager() |
protected XWikiContext |
getXWikiContext()
Note 1: This method is protected so that users of this API do not get to see the XWikiContext object which should
not be exposed.
|
protected boolean |
hasAccess(Right right,
DocumentReference entityReference)
Verifies if the context user has the access identified by
right on the entity identified by
entityReference . |
boolean |
hasAccessLevel(String right,
String docname)
Check if the current user has an access level on a given document.
|
boolean |
hasAdminRights()
Check if the current user has administration rights either on the current wiki or on the current space.
|
boolean |
hasProgrammingRights()
Check if the current document has programming rights, meaning that it was last saved by a user with the
programming right globally granted.
|
boolean |
hasWikiAdminRights()
Check if the current user has administration rights on the current wiki, regardless of any space admin rights
that might also be available.
|
protected XWikiContext context
getXWikiContext()
public Api(XWikiContext context)
context
- the XWiki Context objectgetXWikiContext()
protected XWikiContext getXWikiContext()
Note 2: This is not longer the canonical way of retrieving the XWiki Context. The new way is to get it from the
ExecutionContext
.
protected AuthorizationManager getAuthorizationManager()
AuthorizationManager
componentprotected ContextualAuthorizationManager getContextualAuthorizationManager()
ContextualAuthorizationManager
componentpublic boolean hasProgrammingRights()
public boolean hasAdminRights()
true
if the current user has the admin
right or false
otherwise.public boolean hasWikiAdminRights()
true
if the current user has the admin
right or false
otherwise.public boolean hasAccessLevel(String right, String docname) throws XWikiException
right
- The name of the right to verify (eg "programming", "admin", "register", etc).docname
- The document for which to verify the right.XWikiException
- In case of an error finding the document or accessing groups information.protected boolean hasAccess(Right right, DocumentReference entityReference)
right
on the entity identified by
entityReference
. Note that some rights may be checked higher in hierarchy of the provided entity if such
right is not enabled at lowest hierarchy level provided.right
- the right to checkentityReference
- the entity on which to check the righttrue
if the user has the specified right on the entity, false
otherwiseprotected List<Document> convert(List<XWikiDocument> xdocList)
xdocList
- the internal documents.protected Document convert(XWikiDocument xdoc)
xdoc
- the internal document.protected Attachment convert(XWikiAttachment xattach)
xattach
- The internal XWikiAttachment objectprotected List<Attachment> convertAttachments(List<XWikiAttachment> xattaches)
xattaches
- The List of XWikiAttachment objectsCopyright © 2004–2021 XWiki. All rights reserved.