[Zope-CMF] Re: GenericSetup "rolemap" importer does not register new permissions

Laurence Rowe l at lrowe.co.uk
Mon Dec 10 08:11:58 EST 2007


Damien Baty (ML) wrote:
>     Hello,
> 
>   I am trying to use GenericSetup to define permissions/roles mappings 
> for a product. As far as I can see, the current version of GenericSetup 
> does not register the permission if it does not exist. It supposes that 
> the permission exists and calls 'manage_permission()'. Naturally, it 
> breaks with new (unregistered) permissions.
> 
>   All I need to do is to register this new permission, e.g. with 
> 'CMFCore.permissions.setDefaultRoles()'. Is there any reason why this is 
> not done by the 'rolemap' importer? If not, I would be willing to 
> propose a patch.
> 
>   (I am not totally sure that this is the right place to ask about 
> GenericSetup. If it is not, feel free to redirect me to the proper 
> mailing-list.)
> 
>     Regards,
> 

Can you not simply define the permission itself in zcml:

   <permission
     id="my.package.SomePermission"
     title="My Package: Some permission"
     />

I _think_ that should then let you then import a rolemap for it.

(IMO it's a good thing that importing a rolemap for an unregistered 
raises an error - imagine chasing an error because you have put 'List 
Folder Contents' instead of 'List folder contents' in your rolemap.xml)

Laurence



More information about the Zope-CMF mailing list