All - I am trying to use the XWiki REST APIs to create a user in our XWiki system, but I am not able to give them admin rights.
Background: I have an empty database (mysql) and I am running an XWiki war inside a tomcat server. The system starts correctly and creates the database with default data. No issues at this point. Next I want to create an admin user with the REST APIs. What I want to accomplish with REST APIs: 1) Create an admin user using REST API. 2) Login to the XWiki with that admin user. 3) import the XAR file (xwiki-enterprise-ui-mainwiki-all-8.1.xar). 4) Change the admin user back to a normal user using the REST API. 5) Add the user to the XWikiAdminGroup and use those group rights going forward. 6) Login again as an admin user as part of the XWikiAdminGroup group. 7) Any user can edit their own profile (admin or not). Currently it can only be edited by admin users. 8) User is assigned the home wiki as a default wiki. I have two issues at this point. One there is no way to run the REST call except as a superadmin, because there are no admin users created during the initial data load (I think that I saw that admin users are not created when running just the xwiki.war). If I add a new user to the system, the user is created, but I cannot seem to find a way to make them an admin user so that I can import an xar file to load the extra setup for the XWiki. I cannot login to the XWiki as a superadmin, because I have enabled CAS SSO. REST API to create admin group: curl -v -u superadmin:system -X PUT -H "Content-type: text/plain" --data-ascii ' ' http://<ipaddr>/xwiki-enterprise-web-8.1-SNAPSHOT/rest/wikis/xwiki/spaces/XWiki/pages/XWikiAdminGroup curl -v -u superadmin:system -X POST -d "className=XWiki.XWikiRights&property#levels=login,view,edit,delete,creator,register,comment,script,admin,createwiki,programming&property#allow=1" http://localhost:8080/xwiki-enterprise-web-8.1-SNAPSHOT/rest/wikis/xwiki/spaces/XWiki/pages/XWikiAdminGroup/objects REST API to create user: curl -v -u superadmin:system -X PUT -H "Content-type: text/plain" --data-ascii '{{include document="XWiki.XWikiUserSheet"/}}' http://<ipaddr>/xwiki-enterprise-web-8.1-SNAPSHOT/rest/wikis/xwiki/spaces/XWiki/pages/foo curl -v -u superadmin:system -X POST -d "className=XWiki.XWikiUsers&property#first_name=FooFirst&property#last_name=FooLast&property#password=foo" http://<ipaddr>/xwiki-enterprise-web-8.1-SNAPSHOT/rest/wikis/xwiki/spaces/XWiki/pages/foo/objects curl -v -u superadmin:system -X POST -d "className=XWiki.XWikiRights&property#levels=edit&property#allow=1&property#users=XWiki.foo" http://<ipaddr>/xwiki-enterprise-web-8.1-SNAPSHOT/rest/wikis/xwiki/spaces/XWiki/pages/foo/objects curl -v -u superadmin:system -X POST -d "className=XWiki.XWikiGroups&property#member=XWiki.foo" http://<ipaddr>/xwiki-enterprise-web-8.1-SNAPSHOT/rest/wikis/xwiki/spaces/XWiki/pages/XWikiAdminGroup/objects Any help would be greatly appreciated! Thanks, John -- View this message in context: http://xwiki.475771.n2.nabble.com/Using-REST-APIs-to-create-Users-and-give-them-Access-Rights-tp7600005.html Sent from the XWiki- Users mailing list archive at Nabble.com. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
