Adding a webuser programatically

(Difference between revisions)
Jump to: navigation, search
(added most basic sample code for creating a webuser)
 
m (formatting)
Line 2: Line 2:
  
 
Example:
 
Example:
CmsDefaultUsers defaultUsers = new CmsDefaultUsers();
+
CmsDefaultUsers defaultUsers = new CmsDefaultUsers();
CmsObject obj= OpenCms.initCmsObject(cmsUsers.getUserGuest());  
+
CmsObject obj= OpenCms.initCmsObject(cmsUsers.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.

Revision as of 17:29, 13 June 2007

The default guest user has permissions to create a new webuser.

Example:

CmsDefaultUsers defaultUsers = new CmsDefaultUsers();
CmsObject obj= OpenCms.initCmsObject(cmsUsers.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.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox