Would you be so kind to give me step-by-step explanation to
implementing plugin? I mean infrastructure issues, not code itself
(that i get).


On Jul 24, 8:19 pm, "Erik Bray" <[EMAIL PROTECTED]> wrote:
> On Thu, Jul 24, 2008 at 9:52 AM, Sergey Petrov
>
> <[EMAIL PROTECTED]> wrote:
>
> > I need to be able to specify list of users for every ticket which
> > lists users that can view and edit this ticket.
>
> > I mean that when I create new ticket I want to enter some usernames,
> > so only those people will get access to ticket.
>
> > I cannot find way to do that with existing plugins. So my question is
> > — how do I write some patch or plugin that fulfill my needs?
>
> > I'm using Trac 0.11.
>
> You would need to write a plugin Component that implements
> IPermissionPolicy.  It might look like something along these lines:
>
> def check_permission(self, action, username, resource, perm):
>     if resource.realm == 'ticket':
>         ticket = Ticket(self.env, resource.id, version=resource.version)
>         allowed_users = [u.strip() for u in (ticket['allowed_users']
> or '').split(',')]
>         if allowed_users:
>             return username in allowed_users
>
> That's the basic idea.  allowed_users is a custom ticket field.  If
> it's left blank then it will fall through to the next
> PermissionPolicy.  You'd likely want to further modify it to be more
> explicit about exactly what permissions a user gets, etc.
--~--~---------~--~----~------------~-------~--~----~
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