>> 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. > > Couldn't you just have the permission policy deny > WIKI_EDIT/WIKI_DELETE on the global templates if the current > environment is not the master environment? >
That's exactly the point. I implement IPermissionPolicy on my plugin, and check if resource is a global template and permission is WIKI_EDIT / WIKI_DELET in check_permission, to deny it. The only problem is, I have to manually do: [trac] permission_policies = MyPluginPermissionPolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy in trac.ini. I would like to avoid this, and make my plugin automatically add itself to the permission policies list. Greets. -- Á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 -~----------~----~----~----~------~----~------~--~---
