[Zope-dev] Defining permissions in inherited classes

Itai Tavor itavor@bigpond.net.au
Wed, 15 Dec 1999 16:29:12 +1100


Hi,

I've been stuck with this problems for weeks... I posted an earlier 
question bug got no replies, so I thought I'd try again.

I have a product that is used as a mix-in class in several other 
products. This product adds a management interface screen and I want 
to define permissions to control that screen in this class. So, I do:

class Publisher(RoleManager):

     __ac_permissions__ = (
         ('Change publishing', ('manage_publish'))
     )

     manage_publish = HTMLFile('publish', globals())

In the product that uses this class:

class Something(Folder, Publisher.Publisher):

     __ac_permissions__ = (
         ('View management screens', ('manage_tabs', 'manage_main', ....))
        .....
     )

     manage_options = (
         {'label':'Edit', 'action':'manage_main'},
         {'label':'Publish', 'action':'manage_publish'}
     )

Now, I think this should work... that's how it's done in 
AccessRole.Role.RoleManager - it defines __ac_permissions__ that get 
added to the classes that inherit from it. But it doesn't work for 
me... the permissions defined in Publisher don't appear anywhere. Any 
idea why, or what I'm doing wrong?

Thanks

Itai
--
Itai Tavor                      -- "Je sautille, donc je suis."    --
itavor@vic.bigpond.net.au       --               - Kermit the Frog --
-- "What he needs now is understanding... and a confederate victory" --
-- Dr. Jacobi, Twin Peaks         --