Merge lp:~adiroiban/launchpad/bug-509252 into lp:launchpad

Proposed by Adi Roiban
Status: Merged
Approved by: Muharem Hrnjadovic
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~adiroiban/launchpad/bug-509252
Merge into: lp:launchpad
Diff against target: 80 lines (+4/-32)
1 file modified
lib/canonical/launchpad/security.py (+4/-32)
To merge this branch: bzr merge lp:~adiroiban/launchpad/bug-509252
Reviewer Review Type Date Requested Status
Muharem Hrnjadovic (community) Approve
Review via email: mp+18184@code.launchpad.net

Commit message

Remove AdminPOTemplateSubset from security.py since it is no longer used.

To post a comment you must log in.
Revision history for this message
Adi Roiban (adiroiban) wrote :

= Bug 509252=
After landing this branch https://code.edge.launchpad.net/~adiroiban/launchpad/bug-340662-take-2/+merge/17598
the POTemplateSubsetNavigation will render the AdminPOTemplateSubset useless.

We should clean the security.py.

AdminPOTemplateSubset was added to fix bug 406477

== Proposed fix ==
Remove AdminPOTemplateSubset from security.py since it is no longer used.

== Pre-implementation notes ==

The changes in POTemplateSubsetNavigation were done before the release for another branch/bug that was important to land.

This should be a simple task, but since we did not want to risk and did not have enough time, Danilo and I, agreed to look into removing this class after the release.

== Implementation details ==
== Tests ==
These are the tests for bug 406477 (where the class was added)

lp-test -t distroseries-templates -t rosetta-potemplate-index

== Demo and Q/A ==
This is the demo from bug 406477

Make sure you are a member of Ubuntu Translation Coordinators team (ubuntu-l10n-coordinator).
https://launchpad.dev/~ubuntu-l10n-coordinator

Go to the Distro +template page
https://translations.launchpad.dev/ubuntu/hoary/+templates

You should see the Administer page for Evolution, disabled-template .

As a member of Ubuntu Translation Coordinators team you should be able to administer it, just like any other template from that table, even if the template is now disabled.

Login as a normal user, you should not see the administration links (only Download), and when trying to manually enter the admin url (https://translations.launchpad.dev/ubuntu/hoary/+source/evolution/+pots/disabled-template/+admin) you should see an access denied page.

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/canonical/launchpad/security.py

Revision history for this message
Muharem Hrnjadovic (al-maisan) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/security.py'
2--- lib/canonical/launchpad/security.py 2010-01-20 20:36:13 +0000
3+++ lib/canonical/launchpad/security.py 2010-01-28 06:07:20 +0000
4@@ -67,8 +67,7 @@
5 IOAuthAccessToken, IOAuthRequestToken)
6 from lp.soyuz.interfaces.packageset import IPackageset, IPackagesetSet
7 from lp.translations.interfaces.pofile import IPOFile
8-from lp.translations.interfaces.potemplate import (
9- IPOTemplate, IPOTemplateSubset)
10+from lp.translations.interfaces.potemplate import IPOTemplate
11 from lp.soyuz.interfaces.publishing import (
12 IBinaryPackagePublishingHistory, IPublishingEdit,
13 ISourcePackagePublishingHistory)
14@@ -386,7 +385,7 @@
15 return (user.in_admin or
16 user.isOwner(self.obj.target) or
17 user.isOneOf(
18- self.obj, ['owner','drafter', 'assignee', 'approver']))
19+ self.obj, ['owner', 'drafter', 'assignee', 'approver']))
20
21
22 class AdminSpecification(AuthorizationBase):
23@@ -1117,8 +1116,6 @@
24 self, user))
25
26
27-# Please keep AdminPOTemplateSubset in sync with this, unless you
28-# know exactly what you are doing.
29 class AdminPOTemplateDetails(OnlyRosettaExpertsAndAdmins):
30 """Controls administration of an `IPOTemplate`.
31
32@@ -1127,6 +1124,7 @@
33
34 Product owners does not have administrative privileges.
35 """
36+
37 permission = 'launchpad.TranslationsAdmin'
38 usedfor = IPOTemplate
39
40@@ -1619,33 +1617,6 @@
41 user.in_bazaar_experts)
42
43
44-# Please keep this in sync with AdminPOTemplateDetails. Note that
45-# this permission controls access to browsing into individual
46-# potemplates, but it's on a different object (POTemplateSubset)
47-# from AdminPOTemplateDetails, even though it looks almost identical
48-class AdminPOTemplateSubset(OnlyRosettaExpertsAndAdmins):
49- """Controls administration of an `IPOTemplateSubset`.
50-
51- Allow all persons that can also administer the translations to
52- which this template belongs to and also translation group owners.
53-
54- Product owners does not have administrative privileges.
55- """
56- permission = 'launchpad.TranslationsAdmin'
57- usedfor = IPOTemplateSubset
58-
59- def checkAuthenticated(self, user):
60- template_set = self.obj
61- if template_set.distroseries is not None:
62- distribution = template_set.distroseries.distribution
63- return (
64- AdminDistributionTranslations(
65- distribution).checkAuthenticated(user))
66- else:
67- # Template is on a product.
68- return OnlyRosettaExpertsAndAdmins.checkAuthenticated(self, user)
69-
70-
71 class AdminDistroSeriesTranslations(AuthorizationBase):
72 permission = 'launchpad.TranslationsAdmin'
73 usedfor = IDistroSeries
74@@ -1655,6 +1626,7 @@
75
76 Distribution managers can also manage IDistroSeries
77 """
78+
79 return (AdminDistributionTranslations(
80 self.obj.distribution).checkAuthenticated(user))
81