Merge lp://staging/~sinzui/launchpad/person-owned-teams into lp://staging/launchpad

Proposed by Curtis Hovey
Status: Merged
Approved by: Curtis Hovey
Approved revision: no longer in the source branch.
Merged at revision: 16363
Proposed branch: lp://staging/~sinzui/launchpad/person-owned-teams
Merge into: lp://staging/launchpad
Diff against target: 394 lines (+216/-5)
10 files modified
lib/lp/registry/browser/configure.zcml (+6/-0)
lib/lp/registry/browser/person.py (+20/-1)
lib/lp/registry/browser/tests/test_person.py (+43/-0)
lib/lp/registry/interfaces/person.py (+13/-1)
lib/lp/registry/model/person.py (+12/-0)
lib/lp/registry/templates/person-owned-teams.pt (+70/-0)
lib/lp/registry/templates/person-related-software-navlinks.pt (+4/-0)
lib/lp/registry/templates/product-portlet-requires-subscription.pt (+3/-3)
lib/lp/registry/tests/test_person.py (+44/-0)
lib/lp/soyuz/stories/soyuz/xx-person-packages.txt (+1/-0)
To merge this branch: bzr merge lp://staging/~sinzui/launchpad/person-owned-teams
Reviewer Review Type Date Requested Status
Benji York (community) code Approve
Review via email: mp+139091@code.staging.launchpad.net

Commit message

List teams a person owns.

Description of the change

Team owners are not necessarily team members. All code that lists teams
for people are based on membership. There is no way to discover which
teams a person owns. This is a problem for cases where a person leaves
an organisation -- the team owner does not show up when auditing,
and owners can add themselves back to the team to gain team privileges.

RULES

    Pre-implementation: no one
    * Add a method to IPerson to get the teams a person owns. The
      method must take a user argument to filter out private teams the
      observing user cannot see.
    * Add a related teams page to the related packages/projects group
      of pages. The page must batch the teams.

QA

    * Visit https://qastaging.launchpad.net/~
    * Verify there is a link to owned teams.
    * View the link's page.
    * Verify the page lists the teams.

    * Run this script:
    {{{
    from launchpadlib.launchpad import Launchpad
    lp = Launchpad.login_with(
        'testing', service_root='https://api.qastaging.launchpad.net',
        version='devel')
    person = lp.people['sinzui']
    teams = person.getOwnedTeams()
    for team in teams:
        print team.name

    lp = Launchpad.login_anonymously(
        'testing', service_root='https://api.qastaging.launchpad.net',
        version='devel')
    person = lp.people['sinzui']
    teams = person.getOwnedTeams()
    for team in teams:
        print team.name
    }}}

LINT

    lib/lp/registry/browser/configure.zcml
    lib/lp/registry/browser/person.py
    lib/lp/registry/browser/tests/test_person.py
    lib/lp/registry/interfaces/person.py
    lib/lp/registry/model/person.py
    lib/lp/registry/templates/person-owned-teams.pt
    lib/lp/registry/templates/person-related-software-navlinks.pt
    lib/lp/registry/tests/test_person.py

LoC

    I have more than 10,000 lines of credit this week.

TEST

    ./bin/test -vc -t OwnedTeams lp.registry

IMPLEMENTATION

I added getOwnedTeams to IPerson that return the teams for a Person that
a user is permitted to see. I exported it to use the requesting user as
the user passed to the method.
    lib/lp/registry/interfaces/person.py
    lib/lp/registry/model/person.py
    lib/lp/registry/tests/test_person.py

I added PersonOwnedTeamsView to the related-software group of pages. I
then added a link to the IPersonRelatedSoftwareMenu to complete the
integration.
    lib/lp/registry/browser/configure.zcml
    lib/lp/registry/browser/person.py
    lib/lp/registry/browser/tests/test_person.py
    lib/lp/registry/templates/person-owned-teams.pt
    lib/lp/registry/templates/person-related-software-navlinks.pt

To post a comment you must log in.
Revision history for this message
Benji York (benji) wrote :

This branch looks good. I had two small observations:

A tad more commentary in PersonOwnedTeamsViewTestCase would be good.

It looks like line 267 of the diff should be dedented two spaces.

review: Approve (code)

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.