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
=== modified file 'lib/canonical/launchpad/security.py'
--- lib/canonical/launchpad/security.py 2010-01-20 20:36:13 +0000
+++ lib/canonical/launchpad/security.py 2010-01-28 06:07:20 +0000
@@ -67,8 +67,7 @@
67 IOAuthAccessToken, IOAuthRequestToken)67 IOAuthAccessToken, IOAuthRequestToken)
68from lp.soyuz.interfaces.packageset import IPackageset, IPackagesetSet68from lp.soyuz.interfaces.packageset import IPackageset, IPackagesetSet
69from lp.translations.interfaces.pofile import IPOFile69from lp.translations.interfaces.pofile import IPOFile
70from lp.translations.interfaces.potemplate import (70from lp.translations.interfaces.potemplate import IPOTemplate
71 IPOTemplate, IPOTemplateSubset)
72from lp.soyuz.interfaces.publishing import (71from lp.soyuz.interfaces.publishing import (
73 IBinaryPackagePublishingHistory, IPublishingEdit,72 IBinaryPackagePublishingHistory, IPublishingEdit,
74 ISourcePackagePublishingHistory)73 ISourcePackagePublishingHistory)
@@ -386,7 +385,7 @@
386 return (user.in_admin or385 return (user.in_admin or
387 user.isOwner(self.obj.target) or386 user.isOwner(self.obj.target) or
388 user.isOneOf(387 user.isOneOf(
389 self.obj, ['owner','drafter', 'assignee', 'approver']))388 self.obj, ['owner', 'drafter', 'assignee', 'approver']))
390389
391390
392class AdminSpecification(AuthorizationBase):391class AdminSpecification(AuthorizationBase):
@@ -1117,8 +1116,6 @@
1117 self, user))1116 self, user))
11181117
11191118
1120# Please keep AdminPOTemplateSubset in sync with this, unless you
1121# know exactly what you are doing.
1122class AdminPOTemplateDetails(OnlyRosettaExpertsAndAdmins):1119class AdminPOTemplateDetails(OnlyRosettaExpertsAndAdmins):
1123 """Controls administration of an `IPOTemplate`.1120 """Controls administration of an `IPOTemplate`.
11241121
@@ -1127,6 +1124,7 @@
11271124
1128 Product owners does not have administrative privileges.1125 Product owners does not have administrative privileges.
1129 """1126 """
1127
1130 permission = 'launchpad.TranslationsAdmin'1128 permission = 'launchpad.TranslationsAdmin'
1131 usedfor = IPOTemplate1129 usedfor = IPOTemplate
11321130
@@ -1619,33 +1617,6 @@
1619 user.in_bazaar_experts)1617 user.in_bazaar_experts)
16201618
16211619
1622# Please keep this in sync with AdminPOTemplateDetails. Note that
1623# this permission controls access to browsing into individual
1624# potemplates, but it's on a different object (POTemplateSubset)
1625# from AdminPOTemplateDetails, even though it looks almost identical
1626class AdminPOTemplateSubset(OnlyRosettaExpertsAndAdmins):
1627 """Controls administration of an `IPOTemplateSubset`.
1628
1629 Allow all persons that can also administer the translations to
1630 which this template belongs to and also translation group owners.
1631
1632 Product owners does not have administrative privileges.
1633 """
1634 permission = 'launchpad.TranslationsAdmin'
1635 usedfor = IPOTemplateSubset
1636
1637 def checkAuthenticated(self, user):
1638 template_set = self.obj
1639 if template_set.distroseries is not None:
1640 distribution = template_set.distroseries.distribution
1641 return (
1642 AdminDistributionTranslations(
1643 distribution).checkAuthenticated(user))
1644 else:
1645 # Template is on a product.
1646 return OnlyRosettaExpertsAndAdmins.checkAuthenticated(self, user)
1647
1648
1649class AdminDistroSeriesTranslations(AuthorizationBase):1620class AdminDistroSeriesTranslations(AuthorizationBase):
1650 permission = 'launchpad.TranslationsAdmin'1621 permission = 'launchpad.TranslationsAdmin'
1651 usedfor = IDistroSeries1622 usedfor = IDistroSeries
@@ -1655,6 +1626,7 @@
16551626
1656 Distribution managers can also manage IDistroSeries1627 Distribution managers can also manage IDistroSeries
1657 """1628 """
1629
1658 return (AdminDistributionTranslations(1630 return (AdminDistributionTranslations(
1659 self.obj.distribution).checkAuthenticated(user))1631 self.obj.distribution).checkAuthenticated(user))
16601632