Check Content Author

Last modified by Eduard Moraru on 2021/03/17 21:37

lock_goCheck the content author of a page and if that user has Programming and Script rights.
TypeXAR
CategoryApplication
Developed by

Eduard Moraru

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Installable with the Extension Manager

Description

XWiki does not really have an UI to display the current content author of a page and this information is needed when debugging problems related to Programming or Script rights.

This simple app shows you this information, together with the current rights status of the content author on the page.

screenshot1.png

screenshot2.png

If you do not see any suggestions in the dropdown, then you might need to enable "Show hidden documents" in your user profile's preferences.

No Programming rights is needed to run this app.

Source

In case you just want this as a snippet and can't/won't install it with Extension Manager or with XAR import, you can examine the source below:

{{velocity}}
#set ($documentId = "$!request.documentId")
#if ($documentId == '')
 Check the content author of a page and if that user has Programming and Script rights.

  {{html}}
 <form>
   Document to check: <input type='text' name='documentId' class='suggestDocuments' />
   <input  type='submit' value='Check'/>
 </form>
  {{/html}}
#else
  #set ($document = $xwiki.getDocument($documentId))
  #if ($document.isNew())
   The document **$documentId** does not exist!
  #else
    #set ($author = $document.author)
    #set ($contentAuthor = $document.getContentAuthor())
    #if ("$!contentAuthor" == '')
      #set ($implied = true)
      #set ($contentAuthor = $author)
    #end
   ; Document
    : $documentId

   ; Author
    : $author

   ; Content author
    : $contentAuthor {{{#if ($implied)(Not explicitly set, falling back on author)#end}}}

   ; Has Script right
    : $xwiki.hasAccessLevel('script', $contentAuthor, $documentId)

   ; Has Programming right
    : $xwiki.hasAccessLevel('programming', $contentAuthor, $documentId)
  #end

  [[Back>>path:$doc.getURL()]]
#end
{{/velocity}}

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:

  1. Log in the wiki with a user having Administration rights
  2. Go to the Administration page and select the Import category
  3. Follow the on-screen instructions to upload the downloaded XAR
  4. Click on the uploaded XAR and follow the instructions
  5. You'll also need to install all dependent Extensions that are not already installed in your wiki
Tags:
    

Get Connected