Исходный код вики BlockUserInfo


Последние авторы
1 {{groovy}}
2 import org.xwiki.model.reference.EntityReference;
3 import org.xwiki.model.EntityType;
4 import org.xwiki.logging.LogLevel;
5 if(request.action == "protect"){
6 def log = services.logging.getLogger(doc.fullName)
7 services.logging.setLevel(doc.fullName, LogLevel.INFO);
8 def RIGHT_CLASS_REFERENCE = new EntityReference("XWikiRights", EntityType.DOCUMENT, new EntityReference("XWiki", EntityType.SPACE));
9
10 def context = xcontext.context;
11
12 def users = services.query.xwql("select doc.fullName from Document doc, doc.object(XWiki.XWikiUsers) user").setWiki('xwiki').execute()
13 def currentDomainId = xcontext.getContext().getWikiId()
14 def d = xcontext.getContext().setWikiId("xwiki")
15 log.info("Updating [{}] users", users.size())
16 services.progress.pushLevel(users.size())
17 for (String user : users) {
18 log.info("Updating user [{}]", user)
19 if(xwiki.exists(user)){
20 def page = xwiki.getDocument(user).getDocument()
21
22 def rightObj = page.newXObject(RIGHT_CLASS_REFERENCE, context);
23 rightObj.setLargeStringValue("users", "XWiki.XWikiGuest");
24 rightObj.setStringValue("levels","view,edit,delete,comment,script");
25
26 rightObj.setIntValue("allow", 0);
27
28 context.getWiki().saveDocument(page, "Protect user", true, context)
29 }
30 }
31 d = xcontext.getContext().setWikiId(currentDomainId)
32 println("Users protected")
33 }
34 {{/groovy}}
35
36 {{velocity}}
37 #if($hasAdmin || $services.user.group.getGroups($xcontext.userReference, $NULL, false).contains($services.model.resolveDocument('xwiki:XWiki.XWikiAdminGroup')))
38 #if ("$!request.action" == '')
39 [[Update profiles>>$doc.fullName||queryString="action=protect" class="btn btn-primary"]]
40 #elseif ($!request.confirm)
41 $response.sendRedirect($doc.getURL('view',"protect=$request.protect"))
42 #end
43 #end
44 {{/velocity}}

Содружество стран

Языки