Merge lp://qastaging/~deryck/launchpad/less-restrictive-assign-someone-else-603281 into lp://qastaging/launchpad

Proposed by Deryck Hodge
Status: Merged
Approved by: Brad Crittenden
Approved revision: no longer in the source branch.
Merged at revision: 11479
Proposed branch: lp://qastaging/~deryck/launchpad/less-restrictive-assign-someone-else-603281
Merge into: lp://qastaging/launchpad
Diff against target: 621 lines (+185/-144)
6 files modified
lib/lp/bugs/browser/tests/test_bugtask.py (+20/-3)
lib/lp/bugs/doc/bugtask.txt (+0/-74)
lib/lp/bugs/interfaces/bugtask.py (+4/-3)
lib/lp/bugs/model/bugtask.py (+46/-30)
lib/lp/bugs/stories/bugtask-management/xx-change-assignee.txt (+13/-1)
lib/lp/bugs/tests/test_bugtask.py (+102/-33)
To merge this branch: bzr merge lp://qastaging/~deryck/launchpad/less-restrictive-assign-someone-else-603281
Reviewer Review Type Date Requested Status
Brad Crittenden (community) Approve
Review via email: mp+33824@code.qastaging.launchpad.net

Commit message

Allow anyone to set bugtask assignee if there is not a defined bug supervisor.

Description of the change

This branch fixes bug 603281, which notes that when we changed
permissions for who can assign a bug to someone else that we made that a
bit too strict for projects without a bug supervisor.

This branch fixes that by lifting the restrictions if a bug supervisor
is not set for a project/distro. This means that projects that haven't
yet set a bug supervisor will be able to assign bugs without having to
set a bug supervisor. The functionality returns to what it once was.

But for projects that have a bug supervisor, the new requirements will
remain, i.e. that you cannot assign a bug to someone else.

This includes a test update and then the couple line change to
BugTask.userCanSetAnyAssignee to get this working. Since the web UI uses
this method, nothing had to be changed with the JS widget.

To post a comment you must log in.
Revision history for this message
Brad Crittenden (bac) wrote :

Hi Deryck,

Thanks for making this fix rolling back some restrictions.

In userCanSetAnyAssignee,I think the test would read better if you factored out the test for 'user is None' and return False immediately. So I'm suggesting (I hope formatting is preserved)

    def userCanSetAnyAssignee(self, user):
        """See `IBugTask`."""
        celebrities = getUtility(ILaunchpadCelebrities)
        if user is None:
            return False
        elif self.pillar.bug_supervisor is None:
            return True
        else:
            return (
                user.inTeam(self.pillar.bug_supervisor) or
                user.inTeam(self.pillar.owner) or
                user.inTeam(self.pillar.driver) or
                (self.distroseries is not None and
                 user.inTeam(self.distroseries.driver)) or
                (self.productseries is not None and
                 user.inTeam(self.productseries.driver)) or
                user.inTeam(celebrities.admin)
                or user == celebrities.bug_importer)

The technique you provided in setBugSupervisor of having the base class provide two alternatives for the subclasses to choose is very interesting. I've never seen that before.

review: Approve
Revision history for this message
Deryck Hodge (deryck) wrote :

Hi, bac.

Thanks for the review! I like your suggestion and will do that.

Cheers,
deryck

Revision history for this message
Robert Collins (lifeless) wrote :

BTW:

               user.inTeam(self.pillar.bug_supervisor) or
               user.inTeam(self.pillar.owner) or
               user.inTeam(self.pillar.driver) or
               (self.distroseries is not None and
                user.inTeam(self.distroseries.driver)) or
               (self.productseries is not None and
                user.inTeam(self.productseries.driver)) or
               user.inTeam(celebrities.admin)
               or user == celebrities.bug_importer)

Is slow code - it will do, on a bad day, 5 or 6 queries all on its
own. Thats not a huge issue, unless it ends up in a loop - but as it
happens we have loops that do this - the bug importer loops.

Please consider making a tech debt bug or something.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.