← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~abentley/launchpad/limit-blueprint-info-types into lp:launchpad

 

Aaron Bentley has proposed merging lp:~abentley/launchpad/limit-blueprint-info-types into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1046995 in Launchpad itself: "blueprint.information_type can be Private/Userdata or security"
  https://bugs.launchpad.net/launchpad/+bug/1046995

For more details, see:
https://code.launchpad.net/~abentley/launchpad/limit-blueprint-info-types/+merge/123150

= Summary =
Fix bug #1046995: blueprint.information_type can be Private/Userdata or security

== Proposed fix ==
Limit bugs to PUBLIC, PROPRIETARY and EMBARGOED information types.

== Pre-implementation notes ==
Discussed with deryck

== LOC Rationale ==
Part of private projects

== Implementation details ==
A new tuple, PUBLIC_PROPIETARY_INFORMATION_TYPES is provided.  We anticipate that this will also be used for Project information types.

== Tests ==
bin/test -t test_getAllowedInformationTypesJustProprietary test_spec

== Demo and Q/A ==
Set the feature flag "blueprints.information_type.enabled" to "on".

Go to a blueprint and click "edit" for its information type.  Only public, proprietary and embargoed shoould be shown.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/registry/enums.py
  lib/lp/blueprints/model/tests/test_specification.py
  lib/lp/blueprints/model/specification.py
-- 
https://code.launchpad.net/~abentley/launchpad/limit-blueprint-info-types/+merge/123150
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~abentley/launchpad/limit-blueprint-info-types into lp:launchpad.
=== modified file 'lib/lp/blueprints/model/specification.py'
--- lib/lp/blueprints/model/specification.py	2012-08-31 18:54:29 +0000
+++ lib/lp/blueprints/model/specification.py	2012-09-06 19:13:28 +0000
@@ -70,6 +70,7 @@
     InformationType,
     PRIVATE_INFORMATION_TYPES,
     PUBLIC_INFORMATION_TYPES,
+    PUBLIC_PROPRIETARY_INFORMATION_TYPES,
     )
 from lp.registry.errors import CannotChangeInformationType
 from lp.registry.interfaces.distribution import IDistribution
@@ -817,7 +818,7 @@
             self.id, self.name, self.target.name)
 
     def getAllowedInformationTypes(self, who):
-        return set(InformationType.items)
+        return set(PUBLIC_PROPRIETARY_INFORMATION_TYPES)
 
     def transitionToInformationType(self, information_type, who):
         """See `IBug`."""

=== modified file 'lib/lp/blueprints/model/tests/test_specification.py'
--- lib/lp/blueprints/model/tests/test_specification.py	2012-09-04 20:24:29 +0000
+++ lib/lp/blueprints/model/tests/test_specification.py	2012-09-06 19:13:28 +0000
@@ -23,7 +23,11 @@
     SpecificationWorkItemStatus,
     )
 from lp.blueprints.model.specificationworkitem import SpecificationWorkItem
-from lp.registry.enums import InformationType
+from lp.registry.enums import (
+    InformationType,
+    PROPRIETARY_INFORMATION_TYPES,
+    SECURITY_INFORMATION_TYPES,
+    )
 from lp.registry.errors import CannotChangeInformationType
 from lp.registry.model.milestone import Milestone
 from lp.services.mail import stub
@@ -635,3 +639,18 @@
         with person_logged_in(spec.owner):
             with ExpectedException(CannotChangeInformationType, '.*'):
                 spec.transitionToInformationType(None, spec.owner)
+
+    def test_getAllowedInformationTypesJustProprietary(self):
+        """Allowed types should include proprietary types and PUBLIC.
+
+        We do not want to introduce support for Private/Userdata or Security
+        blueprints.
+        """
+        spec = self.factory.makeSpecification()
+        allowed = spec.getAllowedInformationTypes(spec.owner)
+        self.assertIn(InformationType.PUBLIC, allowed)
+        for info_type in PROPRIETARY_INFORMATION_TYPES:
+            self.assertIn(info_type, allowed)
+        self.assertNotIn(InformationType.USERDATA, allowed)
+        for info_type in SECURITY_INFORMATION_TYPES:
+            self.assertNotIn(info_type, allowed)

=== modified file 'lib/lp/registry/enums.py'
--- lib/lp/registry/enums.py	2012-08-29 09:19:50 +0000
+++ lib/lp/registry/enums.py	2012-09-06 19:13:28 +0000
@@ -20,6 +20,7 @@
     'PRIVATE_INFORMATION_TYPES',
     'PROPRIETARY_INFORMATION_TYPES',
     'PUBLIC_INFORMATION_TYPES',
+    'PUBLIC_PROPRIETARY_INFORMATION_TYPES',
     'ProductJobType',
     'SECURITY_INFORMATION_TYPES',
     'SharingPermission',
@@ -101,6 +102,11 @@
 PROPRIETARY_INFORMATION_TYPES = (
     InformationType.PROPRIETARY, InformationType.EMBARGOED)
 
+# The information types unrelated to user data or security
+PUBLIC_PROPRIETARY_INFORMATION_TYPES = (
+    (InformationType.PUBLIC,) + PROPRIETARY_INFORMATION_TYPES
+)
+
 
 class SharingPermission(DBEnumeratedType):
     """Sharing permission.


Follow ups