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

Stephan Hartmann hartmann at metamesh.de
Thu May 28 20:55:20 CEST 2009


Mathias,

there is a public static method in OpenCms class:

OpenCms.getRoleManager()

Regards,
Stephan


Mathias Lin | SYSVISION schrieb:
> 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
>   




More information about the opencms-dev mailing list