Hi
Regarding permissions when creating a new space :
//add the rights for the group
XWikiDocument spaceDoc =
context.getWiki().getDocument(newspace.getSpaceName()+ "." +
"WebPreferences", context);
BaseObject rightsObject =
spaceDoc.getObject("XWiki.XWikiGlobalRights", false, context);
rightsObject.setLargeStringValue("groups",
"XWiki.".concat(MyGroupName));
rightsObject.setStringValue("levels",
"view,comment,edit");
rightsObject.setLargeStringValue("users", "");
rightsObject.setIntValue("allow", 1);
spaceDoc.setMetaDataDirty(true);
context.getWiki().saveDocument(spaceDoc,
context.getMessageTool().get("core.comment.createdUser"), context);
context.getWiki().getGroupService(context).flushCache();
context.getWiki().flushCache();
//add the rights for the admin
spaceDoc =
context.getWiki().getDocument(newspace.getSpaceName()+ "." +
"WebPreferences", context);
rightsObject =
spaceDoc.getObject("XWiki.XWikiGlobalRights", false, context);
rightsObject.setLargeStringValue("groups", "");
rightsObject.setStringValue("levels",
"view,comment,edit,delete,admin");
rightsObject.setLargeStringValue("users",
"XWiki.".concat(MyuserName));
rightsObject.setIntValue("allow", 1);
spaceDoc.setMetaDataDirty(true);
context.getWiki().saveDocument(spaceDoc,
context.getMessageTool().get("core.comment.createdUser"), context);
Only the second part works, the first part is overwrited by the second, so,
how can i set one level(s) for a group and another level(s) for a user ?
Thanks !
Show replies by date