[opencms-dev] Adding users with Guest

Christian Pöcher Poecher at gmx.net
Thu Apr 1 17:12:01 CEST 2004


Hi there again,

I am having a problem I don't understand. Maybe some of you can help.
I want to add users via Code to my OpenCMS app. A surfer from the depths of
the net should fill in a form and after he has done so a login should be
created automatically, so he can log in and be in a specific group. I'll try
this by using the following lines in a jsp:

  cmsObject.loginUser("admin", "mysecretpwd");
  cmsObject.addUser("theTestUser3", "1234", "Guests", "some comment.", new
Hashtable() , I_CmsConstants.C_FLAG_ENABLED);

The problem is, that after executing the code, the session has admin rights.
Of course this is a major security breach, which may not be. Therefore I
looked for a method like CmsObject.logout(), but didn't find it. I tried
adding this after the call of addUser:

cmsObject.loginUser(cmsObject.anonymousUser().getName(),
cmsObject.anonymousUser().getPassword());

but execution fails with

javax.servlet.ServletException: Resource loader error in file
'/cmstestrequest.jsp'
Root cause:
org.apache.jasper.JasperException: com.opencms.core.CmsException:
[com.opencms.file.mySql.CmsDbAccess]Guest

At this time the user has already been created and the rights have been
reset to Guest rights. So the code works as expected, except the error
message.

Any hints how to solve this puzzle?

TIA chris
--
First transmission from NASA lander Spirit:
"Uuuulaaa!"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2761 bytes
Desc: not available
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20040401/2d3ed7da/attachment.bin>


More information about the opencms-dev mailing list