Class Api

    • Method Detail

      • getXWikiContext

        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.

        Note 2: This is not longer the canonical way of retrieving the XWiki Context. The new way is to get it from the ExecutionContext.

        Returns:
        the current context containing all state information about the current request
      • hasProgrammingRights

        public 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.
        Returns:
        true if the current document has the Programming right or false otherwise.
      • hasAdminRights

        public boolean hasAdminRights()
        Check if the current user has administration rights either on the current wiki or on the current space.
        Returns:
        true if the current user has the admin right or false otherwise.
      • hasWikiAdminRights

        public 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.
        Returns:
        true if the current user has the admin right or false otherwise.
        Since:
        3.2M3
      • hasAccessLevel

        public boolean hasAccessLevel​(String right,
                                      String docname)
                               throws XWikiException
        Check if the current user has an access level on a given document.
        Parameters:
        right - The name of the right to verify (eg "programming", "admin", "register", etc).
        docname - The document for which to verify the right.
        Returns:
        true if the current user has the specified right, false otherwise.
        Throws:
        XWikiException - In case of an error finding the document or accessing groups information.
      • hasAccess

        protected boolean hasAccess​(Right right,
                                    DocumentReference entityReference)
        Verifies if the context user has the access identified by 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.
        Parameters:
        right - the right to check
        entityReference - the entity on which to check the right
        Returns:
        true if the user has the specified right on the entity, false otherwise
        Since:
        11.5RC1
      • convert

        protected List<Document> convert​(List<XWikiDocument> xdocList)
        Convert a list of internal representation of documents to public api documents.
        Parameters:
        xdocList - the internal documents.
        Returns:
        the plublic api documents.
      • convert

        protected Document convert​(XWikiDocument xdoc)
        Convert an internal representation of document to public api document.
        Parameters:
        xdoc - the internal document.
        Returns:
        the plublic api document.
      • convert

        protected Attachment convert​(XWikiAttachment xattach)
        Convert an internal representation of an attachment to the public api Attachment.
        Parameters:
        xattach - The internal XWikiAttachment object
        Returns:
        The public api Attachment object
        Since:
        5.0M2
      • convertAttachments

        protected List<Attachment> convertAttachments​(List<XWikiAttachment> xattaches)
        Convert a list of attachments in their internal form to a list of public api Attachments.
        Parameters:
        xattaches - The List of XWikiAttachment objects
        Returns:
        A List of Attachment objects
        Since:
        5.0M2