[opencms-dev] Adding a custom CmsRole

Robert Spielmann robert.spielmann at codecentric.de
Mon Feb 8 23:36:26 CET 2010


Am 13.01.2010 12:02, schrieb Tobias Knierim:
> HI there,
>
> I was wondering if it's possible to add a new role to OpenCMS and use
> this role in a customized ToolHandler to set permissions.
> A search in the mailing list archive gave me  this posting:
> http://mail.opencms.org/pipermail/opencms-dev/2005q4/020289.html
>
> <http://mail.opencms.org/pipermail/opencms-dev/2005q4/020289.html>But
> where should I create the new CmsRole? It seems that it's not sufficient
> to create it in the custom ToolHandler.
>
> "but what is if no system role (defined in the org.opencms.security.CmsRole
>
> class) fits your needs 100%?
> Just create a new role, for instance:
> -------------
> public static final CmsRole SAMPLE = new CmsRole("SAMPLE","Sample Group", new
> CmsRole[] {CmsRole.ADMINISTRATOR});
> -------------
> Every direct or indirect member of the"Sample Group"  group will have this role,
> and also everybody having the ADMINISTRATOR role."
>
> Also, if I understand this correctly every user in the specified group
> gets the newly created custom role, but
>
> public static final CmsRole NEW_ROLE= new CmsRole("NEW_ROLE",
> CmsRole.ADMINISTRATOR, "customgroup",false);
>
> public boolean isVisible(CmsObject cms) {
>
> return OpenCms.getRoleManager().hasRole(cms, NEW_ROLE);
> }
>
> returns false. Even if the specified user has the correct group. Any ideas?
>

Hello world,

we are working on this matter again. The posting Tobias mentioned dates 
back to 2005. Is there any kind of more recent input on this matter?

Regards,

Robert Spielmann
IT Consultant

-- 
codecentric GmbH
Merscheider Str. 1
42699 Solingen

Büro:  +49 (212) 233628-42
Mobil: +49 (151) 14705709
Fax:   +49 (212) 233628-79

Mail:  spielmann at codecentric.de
Web:   http://www.codecentric.de
Blog:  http://blog.codecentric.de

Geschäftsführer: Mirko Novakovic, Rainer Vehns
Sitz der Gesellschaft: Solingen
Registergericht: Amtsgericht Wuppertal, HRB 19214

Diese E-Mail einschließlich evtl. angehängter Dateien enthält 
vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht 
der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, 
informieren Sie bitte sofort den Absender und löschen Sie diese E-Mail 
und evtl. anhängende Dateien umgehend. Das unerlaubte Kopieren, Nutzen 
oder Öffnen evtl. anhängender Dateien sowie die unbefugte Weitergabe 
dieser E-Mail ist nicht gestattet.



More information about the opencms-dev mailing list