Now I feel silly...I have been changing between my AppServerAuthServiceImpl and XWiki Form based authentication by commenting and uncommenting xwiki.authentication=form xwiki.authentication.validationKey=totototototototototototototototo xwiki.authentication.encryptionKey=titititititititititititititititi xwiki.authentication.cookiedomains=xwiki.com,wiki.fr I lost my mind and left the Form authentication commented out and surprise surprise it wouldn't authenticate! The suggestions from Thomas were very helpful. Here is the code that seems to be working //add the view rights for the group to the page XWikiDocument spaceDoc = context.getWiki().getDocument(spaceName+ "." + "WebPreferences", 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); Glenn Everitt 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 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(""); spaceDoc.setAuthor("UGM"); 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 <[email protected]> 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--tp1... Sent from the XWiki- Dev mailing list archive at Nabble.com.
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne _______________________________________________ devs mailing list [email protected] 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--tp1... Sent from the XWiki- Dev mailing list archive at Nabble.com.