Rights Preview
The following table allows to preview the rights in the current wiki: <% def showUserLine(text, user, page) { return showLine(text,user,page,true) } def showGroupLine(text, user, page) { return showLine(text,user,page,false) } def showLine(text, user, page, isuser) { rights = "view", "comment", "edit", "admin"?; str = text; for(right in rights) { str += " | " if (isuser) { str += xwiki.hasAccessLevel(right, user, page ) } else { str += xwiki.xWiki.rightService.hasAccessLevel(right, user, page, false, context.context) } } return str } def showUserTable(page) { str = "| n" | ||||
|---|---|---|---|---|
| str += "Group or user | View | Comment | Edit | Adminn" |
| str += "n" | ||||
| str += showUserLine("Anonymous Users", "XWiki.XWikiGuest", page) | ||||
| str += "n" | ||||
| str += showGroupLine("Wiki registered users", "XWiki.LudoDubo", page) | ||||
| str += "n" | ||||
| str += showUserLine(" - Ludovic Dubost", "XWiki.LudovicDubost", page) | ||||
| str += "n" | ||||
| str += showGroupLine("XWiki.com registered users", "xwiki:XWiki.LudoDubo400", page) | ||||
| str += "n" | ||||
| str += showUserLine(" - Ludovic Dubost on xwiki.com", "xwiki:XWiki.LudovicDubost", page) | ||||
| str += "n" | ||||
| str += " |
Global Wiki
<% println showUserTable("Toto.Tata") %>Home Page
<% println showUserTable("Main.WebHome") %>Overrided spaces
<% for(item in xwiki.searchDocuments(", BaseObject as obj where obj.name=doc.fullName and obj.className='XWiki.XWikiGlobalRights'", 0, 0)) { println "1.1.1 ${item}" itemdoc = xwiki.getDocument(item) if (itemdoc) println showUserTable("${itemdoc.web}.Taratata") } %>Overrided pages
<% for(item in xwiki.searchDocuments(", BaseObject as obj where obj.name=doc.fullName and obj.className='XWiki.XWikiRights' and doc.web<>'XWiki'", 0, 0)) { println "1.1.1 ${item}" println showUserTable(item) } %>
Version 1.6 last modified by VincentMassol on 13/09/2007 at 15:12
Document data
Attachments:
No attachments for this document
Comments: 0