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

Jürgen Herrmann Juergen.Herrmann at XLhost.de
Wed Mar 7 10:47:14 UTC 2012


Am 06.03.2012 09:02, schrieb Lennart Regebro:
> On Mon, Mar 5, 2012 at 19:22, Sean Upton <sdupton at gmail.com> wrote:
>> On Wed, Feb 29, 2012 at 7:12 AM, Jürgen Herrmann
>> <Juergen.Herrmann at xlhost.de> wrote:
>>> 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:
>>
>> I don't off-hand know why just monkey-patching the security 
>> attribute
>> of your class and then calling InitializeClass() again would not 
>> work,
>> but the idea of changing these at runtime after initial zope startup
>> sounds a bit odd, possibly dangerous.  What is it that you are 
>> trying
>> to do?
>
> When I needed this to be dynamic I simply did not have any security
> declaration and instead tested the permissions the first thing I did
> in the method. That worked fine. It is however probably ten years 
> ago,
> and I don't remember or have the code. But it was quite simple, I
> think.
>
> //Lennart

Since a long time i have a mechanism in place that scans class-specific
directories for page templates, dtml files, images, sql-methods etc.
and attaches these to the classes. up to now i did mark everything as
protected, with a fixed permission, worked fine for my purposes.

now i had a use case where i need to mark some templates and methods
as public because they use an internal authentication.

best regards, jürgen
-- 
>> 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