Adding a webuser programatically
From OpenCms Wiki
(Difference between revisions)
(added most basic sample code for creating a webuser) |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
Example: | Example: | ||
− | CmsDefaultUsers defaultUsers = new CmsDefaultUsers(); | + | CmsDefaultUsers defaultUsers = new CmsDefaultUsers(); |
− | CmsObject obj= OpenCms.initCmsObject( | + | CmsObject obj= OpenCms.initCmsObject(defaultUsers.getUserGuest()); |
− | CmsUser user = obj.addWebUser(userId, password, group, "Web User", new Hashtable() ); | + | CmsUser user = obj.addWebUser(userId, password, group, "Web User", new Hashtable() ); |
− | obj.writeWebUser(user); | + | obj.writeWebUser(user); |
The new hashtable is the additional information that OpenCms can store about a user. | The new hashtable is the additional information that OpenCms can store about a user. | ||
+ | |||
+ | <u>addWebUser syntax</u><br /> | ||
+ | '''addWebUser'''(String name, String password, String group, String description, Hashtable additionalInfos) |
Latest revision as of 17:50, 10 December 2010
The default guest user has permissions to create a new webuser.
Example:
CmsDefaultUsers defaultUsers = new CmsDefaultUsers(); CmsObject obj= OpenCms.initCmsObject(defaultUsers.getUserGuest()); CmsUser user = obj.addWebUser(userId, password, group, "Web User", new Hashtable() ); obj.writeWebUser(user);
The new hashtable is the additional information that OpenCms can store about a user.
addWebUser syntax
addWebUser(String name, String password, String group, String description, Hashtable additionalInfos)