Modify

Opened 4 years ago

Last modified 4 years ago

#8911 new enhancement

[PATCH] suppress some users from assign-to box, especially current track user and ticket owner

Reported by: bof Owned by: gt4329b
Priority: normal Component: FlexibleAssignToPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

(also sent to trac-dev@…, but I don't know whether that goes through)

for a plugin I'm working on, which is designed to provide the IValidOwnerProvider interface, I need access to req.authname, and ideally also to ticket.owner for the ticket under consideration.

I need this for an optional feature of removing / forbidding the current user (or ticket owner) as a next-step assignee in a workflow.

I managed to get at req.authname, but only by modifying FlexibleAssignTo itself to pass down the req parameter to the getUsers method.

And I did not "immediately" find a way to get at the ticket information itself, so I'm still missing the desired forbid-current-ticket-owner functionality.

Is there some generic way I missed, to get at both pieces of information from that place? Some self.env magic?

best regards

Patrick

Attachments (2)

flexible-req.patch (980 bytes) - added by bof 4 years ago.
what I patched to get at req
flexible-suppress.patch (5.8 KB) - added by bof 4 years ago.
Solving the problem properly - a contribution to FlexibleAssignTo

Download all attachments as: .zip

Change History (5)

Changed 4 years ago by bof

what I patched to get at req

Changed 4 years ago by bof

Solving the problem properly - a contribution to FlexibleAssignTo

comment:1 Changed 4 years ago by bof

After sleeping over it for a night, I realized that the proper solution to my problem would be a different modification to FlexibleAssignTo.

My second patch, flexible-suppress.patch, could IMHO be applied. It provides a generic way to suppress a list of users from the assign-to box, after and independant of the IValidOwnerProviders.

  • in section [flexibleassignto] a new variable suppress can be set to a list of usernames that should ALWAYS be suppressed:
    [flexibleassignto]
    suppress = admin, anonymous
    
  • in each workflow step, a new variable .flexibleassignto_suppress can be set in a similar fashion, giving additional users to suppress for that step only:
    [ticket-workflow]
    ...
    mystep.flexibleassignto_suppress = somefreak, $OWNER
    
  • in these suppression lists, $USER can be used to refer to the currently authenticated user (req.authname)
  • also, $OWNER can be used to refer to the current ticket owner, if any.

I have tested the patch on trac 0.11, but it applies also to the 0.13 subdirectory. Lacking a 0.13 install, I _hope_ I have the different DB syntax right, but did not test that.

comment:2 Changed 4 years ago by bof

FYI: I have just put up my IValidOwnerProvider on trac-hacks:

GroupingAssignToPlugin

Maybe you want to provide a cross-link from the FlexibleAssignTo page.

comment:3 Changed 4 years ago by bof

  • Summary changed from access to ticket / request data to [PATCH] suppress some users from assign-to box, especially current track user and ticket owner

Add Comment

Modify Ticket

Action
as new The owner will remain gt4329b.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.