[Zope] changing permissions on classes/methods at runtime?

Jürgen Herrmann Juergen.Herrmann at XLhost.de
Wed Feb 29 14:12:37 UTC 2012


hi all!

is it possible to change permissions and roles on classes/methods
at runtime? normally you'd attach security declarations inline in
your class definition code:

from AccessControl import ClassSecurityInfo
from AccessControl.class_init import InitializeClass
class Cls():
   security = ClassSecurityInfo()
   security.declarePrivate('foo')
   def foo(self):
     pass
InitializeClass(Cls)


now what i tried at runtime is:

from mycode import Cls
from AccessControl import ClassSecurityInfo
security = ClassSecurityInfo()
security.declarePublic('foo')
security.apply(Cls)

but this does not what i want it to, in fact it doesn't seem
to do anything yet - probably because i'm using the wrong way :)

any hints how to do this correctly would be greatly appreciated.

thank you very much in advance and best regards,
Jürgen Herrmann
-- 
>> XLhost.de ® - Webhosting von supersmall bis eXtra Large <<

XLhost.de GmbH
Jürgen Herrmann, Geschäftsführer
Boelckestrasse 21, 93051 Regensburg, Germany

Geschäftsführer: Jürgen Herrmann
Registriert unter: HRB9918
Umsatzsteuer-Identifikationsnummer: DE245931218

Fon:  +49 (0)800 XLHOSTDE [0800 95467833]
Fax:  +49 (0)800 95467830
Web:  http://www.XLhost.de


More information about the Zope mailing list