On Mon, Mar 31, 2008 at 5:09 PM, Glenn Everitt
<Glenn.Everitt(a)compuware.com> wrote:
Whoops..
Well here is what I coded but it did something really bad - I can't even log
in with superadmin. I guess I trashed the main XWiki.XWikiGlobalRight
Do you have any error log when you try to log in as superadmin ? Are
you sure superadmin password is configured in xwiki.cfg (better to ask
;) ) ?
somehow. So is there a way to recover or do just
need to reinstall? or
could I just import an old export. Any hints on where I went wrong would be
a big help.
WARNING DO NOT USE THIS CODE!
XWikiDocument spaceDoc = context.getWiki().getDocument(spaceName+
"." + "WebPreferences", context);
spaceDoc.setParent("");
You should not change parent has it is used for rights inheritance.
spaceDoc.setAuthor("UGM");
I suppose this user does not exists, right ? I'm wondering if it what
breaks xwiki space WebPreferences document in some way...
context.getWiki().saveDocument(spaceDoc,
"UGM Created Space",
context);
BaseObject rightsObject =
spaceDoc.getObject("XWiki.XWikiGlobalRights", true, context);
rightsObject.setLargeStringValue("groups", wikiGroupName);
rightsObject.setStringValue("levels", "view");
rightsObject.setLargeStringValue("users", "");
rightsObject.setIntValue("allow", 1);
context.getWiki().saveDocument(spaceDoc,
context.getMessageTool().get("core.comment.createdUser"), context);
Thanks again
Glenn Everitt
Thomas Mortagne wrote:
Hi,
On Mon, Mar 31, 2008 at 4:45 AM, Glenn Everitt
<Glenn.Everitt(a)compuware.com> wrote:
I've got existing groups of users in a proprietary system and I want to
automatically create a new XWiki user and if this is the first user in
the
group I want to create a XWiki Space and an XWiki group. Finally, I want
to
authorize the XWiki Group within the XWiki Space.
I can create the user similar to the CreateUserFromLDAP and I can create
a
group by creating a new XWikiDocument and adding a GroupClass object to
it.
Then I can add the user into the group by using
XWikiGroupService.addUserToGroup. Next, I can create the space using
SpaceManagerPluginApi.createSpace but I don't know how to give the group
justed added rights in the space just added.
I think I should use Xwiki.XWikiRights and Xwiki.XWikiGlobalRights but I
can't figure out how to do this.
I want to give Access Level rights to the added Group for the added
Space.
Look at
http://code.xwiki.org/xwiki/bin/view/Snippets/SettingRightsSnippet
for an example of how to configure a XWiki.XWikiRights (same as
XWiki.XWikiGlobalRights but on different scope) object.
For you particular case you should edit <Space>.WebPreferences (where
are listed space rights) and edit/add XWiki.XWikiGlobalRights (because
you want to "globally" configure <Space> and not configure just
<Space>.WebPreferences document).
It would be great if someone could point me to an example or explanation
of
how to use XWikiRights.
Help is always appreciated.
Thanks
Glenn Everitt
--
View this message in context:
http://www.nabble.com/How-can-I-dynamically-add-group-rights-to-a-space--tp…
Sent from the XWiki- Dev mailing list archive at
Nabble.com.
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
--
Thomas Mortagne
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
--
View this message in context:
http://www.nabble.com/How-can-I-dynamically-add-group-rights-to-a-space--tp…
I guess I trashed the main XWiki.XWikiGlobalRight
Sent from the XWiki- Dev mailing list archive at
Nabble.com.
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
--
Thomas Mortagne