The first thing you ask, which is about modifying the group template so that a
newly-created group has edit access to it, is also fairly simple: you add an
XWiki.XWikiRights object to the document's form. First you get an XWikiClass object
by calling $xwiki.getDocument("XWiki.XWikiRights").xWikiClass, then create an
instance of that class by calling its newObject() method. You set the fields in that
object to the values needed - the "groups" field to the new group name, the
"allow" field to allow, and the "levels" field to "edit".
Do a displayHidden on that object within the form so that it's a part of the form, and
thus when the page is saved it will be added to the page.
To create a group automatically when creating a space is somewhat different. To the best
of my knowledge, scripting XWiki, to the extent that it involves sequences of operations,
is not straightforward, because each modification to a page requires a separate HTTP
request/response cycle.
In this case, creating a space (which, for purposes of establishing permissions, means
creating its WebPreferences page and adding one or more XWiki.XWikiRights objects) is one
request, and the creation of the group is another.
It's entirely possible, of course, to create a form that creates the
<newSpace>.WebPreferences page and adds the rights objects to it, but the name of
the group would have to be input into that form, and on success, its response should
redirect to the group creation page, where you would be able to add members to it.
Because the creation of a group (which is a document creation operation) is a POST method,
it can't be a simple redirect, but that's okay because you'll want to add
members to the group anyway.
You can arrange to have the form redirect to the group creation page by setting the value
of its hidden field "xredirect" to the desired URL.
Hope this is enough clue to get you started.
brain[sic]
-----Original Message-----
From: Bjørnar Libæk [mailto:blibak@gmail.com]
Sent: Tuesday, August 14, 2007 10:10 AM
To: xwiki-users(a)objectweb.org
Subject: Re: [xwiki-users] permission to grant group membership
Thanks,
You're right, that *was* ridiculous:) But this leads to my next
question: Is it somehow possible to modify the group template
so that this is automatically achieved when creating new
groups? Wait.. let me tell the whole story:
I would like members of group "EmployeeGroup" to be allowed
to create new spaces, and ideally, a group should then be
automatically created, having view and edit rights on the
respective spaces. Example: An employee creates the space
"ProjectX". Then, a group "ProjectXGroup"
should be automatically created. Now members of both
EmployeeGroup and ProjectXGroup should be granted view and
edit rights on the space as well as on the group document (to
be able to add new members).
Again, I'm prepared to do some scripting, but it would be
nice with some pointers. Hopefully however, this solution is
equally ridiculous:)
B
THOMAS, BRIAN M (ATTSI) wrote:
It's actually ridiculously easy - just grant
the group edit
permission on the group document.
brain[sic]
> -----Original Message-----
> From: Bjørnar Libæk [mailto:blibak@gmail.com]
> Sent: Tuesday, August 14, 2007 6:15 AM
> To: xwiki-users(a)objectweb.org
> Subject: [xwiki-users] permission to grant group membership
>
> I would like to let all members of a group being able to add new
> users into the same group. As far as I can see this is not
possible
with the
current version. Would this feature be achievable with
scripting, or does it require som API changes?
If this can be scripted, please give me som pointers.
----------------------------------------------------------------------
--
--
You receive this message as a subscriber of the
xwiki-users(a)objectweb.org mailing
list.
To unsubscribe:
mailto:xwiki-users-unsubscribe@objectweb.org
For general help: mailto:sympa@objectweb.org?subject=help
ObjectWeb mailing lists service home page:
http://www.objectweb.org/wws