Well, it's hard to explain, but I'll try :).

I'm working on a kind of multiproject plugin (just adding some
multi-project functionality to a group of Trac projects). One of the
modules is "Shared Templates". You can define some templates in the
master project, with a special name like GlobalTemplates/MyTemplate,
and you can "inherit" these templates in all the other projects. So,
when you create a blank wiki page, you are shown the local templates,
and the templates from master project that match a given pattern (e.j.
GlobalTemplates/*).

Right now this is working, so global templates are listed in the child
projects when doing a [[TitleIndex]], shown in the available templates
list when creating a new page, and the contents of the template is
recovered.

Also, when you go to /wiki/PageTemplates/GlobalTemplates/MyTemplate in
the child project, the template from the master project is displayed.
Here is where I want to cheat permissions. I don't want to allow
editing / deleting of the master project templates from a child
project. It doesn't work anyways, but I don't want the "Edit" or
"Delete" button to be displayed, among others. So I thought I could
add a PermissionPolicy to detect this situation, and deny all
permissions except WIKI_VIEW.

I algo thought about messing with req.perm (permission cache), but I
found both options too intrusive.

What do you think is the best approach?

Thanks.

On Wed, Apr 15, 2009 at 6:51 PM,  <[email protected]> wrote:
> On Apr 15, 2009 10:33am, "Álvaro J. Iradier" <[email protected]>
> wrote:
>>
>>
>> Hi everybody,
>>
>>
>>
>> I'm working on a plugin that needs to add itself to the list of
>>
>> IPermissionPolicies, something like:
>>
>>
>>
>>        permission_system = PermissionSystem(self.env)
>>
>>        permission_system.policies.insert(0, self)
>>
>>
>>
>> However this isn't working, because "policies" is a property:
>>
>>
>>
>>  policies = OrderedExtensionsOption('trac', 'permission_policies',
>>
>>       IPermissionPolicy,
>>
>>       'DefaultPermissionPolicy, LegacyAttachmentPolicy',
>>
>>       False,
>>
>>       """List of components implementing `IPermissionPolicy`, in the order
>> in
>>
>>       which they will be applied. These components manage fine-grained
>> access
>>
>>       control to Trac resources.
>>
>>       Defaults to the DefaultPermissionPolicy (pre-0.11 behavior) and
>>
>>       LegacyAttachmentPolicy (map ATTACHMENT_* permissions to realm
>> specific
>>
>>       ones)""")
>>
>>
>>
>>
>>
>> Deleting the property doesn't work either.
>>
>>
>>
>> Is there a "clean" or black-magic way of programatically doing this,
>>
>> with no need to set the permission policies in trac.ini?
>
> Possibly, but why do you think you need this?



-- 
Álvaro J. Iradier Muro
Departamento de Desarrollo
[email protected]

Polar Technologies
T +34 976 527 952
F +34 976 466 125
www.polartech.es

Antes de imprimir este mensaje, por favor, compruebe que es verdaderamente
necesario. El medioambiente es cosa de todos.

AVISO LEGAL
Este mensaje, y en su caso, cualquier fichero anexo al mismo, puede contener
información confidencial, siendo para uso exclusivo del destinatario,
quedando prohibida su divulgación, copia o distribución a terceros sin la
autorización expresa del remitente. Si Vd. ha recibido este mensaje
erróneamente, se ruega lo notifique al remitente y proceda a su borrado.
Gracias por su colaboración.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to