[Zope-CMF] Re: GenericSetup "rolemap" importer does not register
new permissions
Wichert Akkerman
wichert at wiggy.net
Thu Dec 27 03:49:26 EST 2007
Previously Damien Baty (ML) wrote:
> Hello,
>
> Le 10/12/07 14:11, Laurence Rowe a écrit :
> >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.
> >>[...]
> >
> >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.
>
> As Wichert noted, this does not work.
>
> >(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)
>
> Good point. I can imagine that very well, indeed. :)
>
> For the record, I have proposed a patch that let us automatically
> register a permission if the profile explicitly asks for it, with
> something like:
>
> ...
> <permission name="My new permission"
> register="True">
> <role name="Manager"/>
> ...
>
> https://bugs.launchpad.net/zope-cmf/+bug/178810
-1
I think it's the wrong place to register permissions. Permissions are
something both code and application configuration (ie zcml) relies on.
That suggests that registering permissions in a GS profile is too late
in the game.
To me it makes a lot more sense to register permissions and their
default roles in zcml.
Wichert.
--
Wichert Akkerman <wichert at wiggy.net> It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
More information about the Zope-CMF
mailing list