Sorry, I didn't intend to send this message to
group already.
I hope you don't mind.
Since I was out of the office on Friday, and the group could almost
always better answer any questions than I could alone, I think it would
be in bad taste for me to object (and just in case there's any chance of
cross-cultural confusion as to the import of that answer, I'll state it
directly: No, I certainly don't mind, but thanks for your
consideration).
I have some dummy questions for you:
We'll see...
- How do I remove an entire space? (in the GUI)
If that's a dummy question, you can call me a dummy.
There is no direct GUI command to do it, but you can create a document
that will do it.
First, get the space name from the request parameters. For example, if
you name the parameter "space", then the reference $request.space will
contain its value:
#set($spacename=$request.space) ## Velocity maps this reference to
$request.getParameter("space")
Next, use the XWiki API to get the list of documents in that space:
#set($docNamelist = $xwiki.getSpaceDocsName($spacename))
Because the method needed to delete a document uses the raw XWiki,
XWikiDocument, and XWikiContext classes directly, instead of through the
com.xpn.xwiki.api classes XWiki, Document, and Context, getting these
objects is a privileged operation that requires that the last author of
the document have the "programming" right on the document (to understand
why, think of the set-user- and set-group-ID bits on a Unix file;
writing a document that has these bits set clears them if the writer is
not the owner).
So, we have:
#set($rawWiki = $xwiki.xWiki)
#set($ctx = $context.context)
Then, loop through the list:
#foreach($docName in $docNamelist)
#set($rawDoc = $xwiki.getDocument($docName).document)
$rawWiki.deleteDocument($rawDoc, $ctx)
#end
Then, if you wish to make the document easier to use, create a form that
allows the user to select the space, with an "action" attribute that is
empty, which will submit the form to the current URL. In the example
above, the input field would be named "space", and it wouldn't matter
whether the form used GET or POST, since XWiki makes either avaliable
through $request.
Note, of course, that by creating the document in this way, your initial
view of the document would do nothing, since the "space" parameter was
empty, so the list will also be empty. And, of course, the power of
this document means that it should check
$xwiki.getDocument("${space}.WebHome").hasAdminRights() if $space is
non-null and non-empty before executing the deletion loop.
The rest of your questions are mostly beyond my ability, so I'm glad you
forwarded to the group as well - with the exception of whether I looked
at your LDAP module, which I did not, since your attachment was detached
and destroyed by our network watchdogs because of its "suspicious"
content. I resolved to look at the JIRA attachment, but have been too
busy as yet to get to it. Probably, though, the only parts I could
really help with that I haven't already given you pointers to would be
adding a group membership. You can find the way to do that inside your
code by looking at the XWiki code invoked by the group sheet when adding
a new group member.
brain[sic]