Check Content Author
Check the content author of a page and if that user has Programming and Script rights. |
Type | XAR |
Category | Application |
Developed by | |
Rating | |
License | GNU Lesser General Public License 2.1 |
Table of contents
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.
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:
#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:
- Log in the wiki with a user having Administration rights
- Go to the Administration page and select the Import category
- Follow the on-screen instructions to upload the downloaded XAR
- Click on the uploaded XAR and follow the instructions
- You'll also need to install all dependent Extensions that are not already installed in your wiki