[opencms-dev] Re move user's role programatically / how to get CmsSecurityManager?

Mathias Lin | SYSVISION mail at mathiaslin.com
Thu May 28 19:56:46 CEST 2009


I need to remove the role of a user programatically, I found that the
CmsObject instance doesn't provide the methods for removing a user's role,
only removing a user from a group or project.

I'd probably need to use the CmsRoleManager, but the constructor requires a
CmsSecurityManager - how can I get the default/system security manager? I
cannot get it from the CmsObject as it's not public.

new CmsRoleManager(???).removeUserFromRole(cmsObject,
CmsRole.WORKPLACE_USER, myCmsUser.getName());

Any other way to remove the user from the role programatically? Is this the
right approach?


Reg. CmsSecurityManager, I read here
http://opencms-forum.org/opencms-forum/printthread?thread=2136&printall=yes
> This class is internal and you shouldn't need it for common tasks.
but I don't see any other way at the moment?


Thanks!
Mathias

-----
Mathias Lin
SYSVISION Ltd., China
http://www.sysvision.com
-- 
View this message in context: http://www.nabble.com/Remove-user%27s-role-programatically---how-to-get-CmsSecurityManager--tp23766794p23766794.html
Sent from the OpenCMS - Dev mailing list archive at Nabble.com.




More information about the opencms-dev mailing list