Merge lp://staging/~abentley/launchpad/translation-sharing-details-permissions into lp://staging/launchpad

Proposed by Aaron Bentley
Status: Merged
Approved by: Deryck Hodge
Approved revision: no longer in the source branch.
Merged at revision: 12908
Proposed branch: lp://staging/~abentley/launchpad/translation-sharing-details-permissions
Merge into: lp://staging/launchpad
Diff against target: 529 lines (+254/-48)
7 files modified
lib/lp/registry/interfaces/sourcepackage.py (+11/-5)
lib/lp/registry/model/sourcepackage.py (+28/-7)
lib/lp/registry/tests/test_sourcepackage.py (+105/-25)
lib/lp/translations/browser/sourcepackage.py (+1/-1)
lib/lp/translations/browser/tests/test_sharing_details.py (+4/-0)
lib/lp/translations/javascript/sourcepackage_sharing_details.js (+27/-3)
lib/lp/translations/javascript/tests/test_sourcepackage_sharing_details.js (+78/-7)
To merge this branch: bzr merge lp://staging/~abentley/launchpad/translation-sharing-details-permissions
Reviewer Review Type Date Requested Status
j.c.sackett (community) Approve
Review via email: mp+58746@code.staging.launchpad.net

Commit message

[r=jcsackett][bug=758920] Disable checklist items for users without permission.

Description of the change

= Summary =
Fix bug #758920 and other permission-related issues.

== Proposed fix ==
Disable checklist items if user does not have permission to change them.

== Pre-implementation notes ==
None

== Implementation details ==
Provide new user_authorized flag on CheckItem, and do not enable checkitems if user is not authorized.

To ensure consistent behaviour at initialization and update time, implement TranslationSharingController.set_permissions() that acts on a dict of values and sets user_authorized.

Call set_permissions from both configure() and select_productseries().

Extract getSharingDetailPermissions from setPackagingReturnSharingDetailPermissions(). Use getSharingDetailPermissions to configure the IJSONRequestCache. Add can_change_product_series to getSharingDetailPermissions Update tests.

Driveby: remove non-existent SourcePackageTranslationSharingStatus from __all__.

== Tests ==
firefox lib/lp/translations/javascript/tests/test_sourcepackage_sharing_details.html
bin/test -t SharingDetailPermissions -t test_cache_contents_no_productseries

== Demo and Q/A ==
For a sourcepackage that has no packaging link and you do not have permissions on, go to +sharing-details. Select a project series. The change/delete project series items should be shown. Log in as another user. The change/delete project series items should not be shown.

Similarly, if you have access to the product/productseries, you should be able to edit the remaining items. Otherwise, no.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/registry/interfaces/sourcepackage.py
  lib/lp/registry/tests/test_sourcepackage.py
  lib/lp/translations/javascript/tests/test_sourcepackage_sharing_details.js
  lib/lp/translations/browser/tests/test_sharing_details.py
  lib/lp/registry/model/sourcepackage.py
  lib/lp/translations/javascript/sourcepackage_sharing_details.js
  lib/lp/translations/browser/sourcepackage.py

To post a comment you must log in.
Revision history for this message
j.c.sackett (jcsackett) wrote :

This looks good. Very well tested, btw.

review: Approve

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.