Hi, Le Wed, 29 Feb 2012 15:12:37 +0100, Jürgen Herrmann <Juergen.Herrmann@XLhost.de> a écrit:
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,
The way I handle this kind of problem is: - declare me method as protected, with a specific permission - grant this permission to roles or users (which can be "anybody") according to your context. Best regards, Thierry -- Chef de projets internet/intranet Office National des Forêts Direction des Systèmes d'Information 2, Avenue de Saint Mandé 75570 PARIS Cedex 12 Tél. : 01 40 19 59 64 Fax. : 01 40 19 59 85 Mél. : thierry.florac@onf.fr WWW : http://www.onf.fr