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

Proposed by Aaron Bentley
Status: Merged
Approved by: j.c.sackett
Approved revision: no longer in the source branch.
Merged at revision: 15916
Proposed branch: lp:~abentley/launchpad/limit-blueprint-info-types
Merge into: lp:launchpad
Diff against target: 80 lines (+28/-2)
3 files modified
lib/lp/blueprints/model/specification.py (+2/-1)
lib/lp/blueprints/model/tests/test_specification.py (+20/-1)
lib/lp/registry/enums.py (+6/-0)
To merge this branch: bzr merge lp:~abentley/launchpad/limit-blueprint-info-types
Reviewer Review Type Date Requested Status
j.c.sackett (community) Approve
Review via email: mp+123150@code.launchpad.net

Commit message

Support only PUBLIC and proprietary types for Blueprints

Description of the change

= 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

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

Looks good.

review: Approve
Revision history for this message
William Grant (wgrant) wrote :

This is normally done by using the pillar's allowed information types, which are dictated by the sharing policy. See eg. Product.getAllowedBugInformationTypes.

Revision history for this message
Aaron Bentley (abentley) wrote :

> This is normally done by using the pillar's allowed information types, which
> are dictated by the sharing policy. See eg.
> Product.getAllowedBugInformationTypes.

Right, but Product does not yet define allowed information types for Specifications. The proposal to add it is here: https://code.launchpad.net/~deryck/launchpad/product-db-changes-for-privacy/+merge/122941

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/blueprints/model/specification.py'
2--- lib/lp/blueprints/model/specification.py 2012-08-31 18:54:29 +0000
3+++ lib/lp/blueprints/model/specification.py 2012-09-06 19:13:28 +0000
4@@ -70,6 +70,7 @@
5 InformationType,
6 PRIVATE_INFORMATION_TYPES,
7 PUBLIC_INFORMATION_TYPES,
8+ PUBLIC_PROPRIETARY_INFORMATION_TYPES,
9 )
10 from lp.registry.errors import CannotChangeInformationType
11 from lp.registry.interfaces.distribution import IDistribution
12@@ -817,7 +818,7 @@
13 self.id, self.name, self.target.name)
14
15 def getAllowedInformationTypes(self, who):
16- return set(InformationType.items)
17+ return set(PUBLIC_PROPRIETARY_INFORMATION_TYPES)
18
19 def transitionToInformationType(self, information_type, who):
20 """See `IBug`."""
21
22=== modified file 'lib/lp/blueprints/model/tests/test_specification.py'
23--- lib/lp/blueprints/model/tests/test_specification.py 2012-09-04 20:24:29 +0000
24+++ lib/lp/blueprints/model/tests/test_specification.py 2012-09-06 19:13:28 +0000
25@@ -23,7 +23,11 @@
26 SpecificationWorkItemStatus,
27 )
28 from lp.blueprints.model.specificationworkitem import SpecificationWorkItem
29-from lp.registry.enums import InformationType
30+from lp.registry.enums import (
31+ InformationType,
32+ PROPRIETARY_INFORMATION_TYPES,
33+ SECURITY_INFORMATION_TYPES,
34+ )
35 from lp.registry.errors import CannotChangeInformationType
36 from lp.registry.model.milestone import Milestone
37 from lp.services.mail import stub
38@@ -635,3 +639,18 @@
39 with person_logged_in(spec.owner):
40 with ExpectedException(CannotChangeInformationType, '.*'):
41 spec.transitionToInformationType(None, spec.owner)
42+
43+ def test_getAllowedInformationTypesJustProprietary(self):
44+ """Allowed types should include proprietary types and PUBLIC.
45+
46+ We do not want to introduce support for Private/Userdata or Security
47+ blueprints.
48+ """
49+ spec = self.factory.makeSpecification()
50+ allowed = spec.getAllowedInformationTypes(spec.owner)
51+ self.assertIn(InformationType.PUBLIC, allowed)
52+ for info_type in PROPRIETARY_INFORMATION_TYPES:
53+ self.assertIn(info_type, allowed)
54+ self.assertNotIn(InformationType.USERDATA, allowed)
55+ for info_type in SECURITY_INFORMATION_TYPES:
56+ self.assertNotIn(info_type, allowed)
57
58=== modified file 'lib/lp/registry/enums.py'
59--- lib/lp/registry/enums.py 2012-08-29 09:19:50 +0000
60+++ lib/lp/registry/enums.py 2012-09-06 19:13:28 +0000
61@@ -20,6 +20,7 @@
62 'PRIVATE_INFORMATION_TYPES',
63 'PROPRIETARY_INFORMATION_TYPES',
64 'PUBLIC_INFORMATION_TYPES',
65+ 'PUBLIC_PROPRIETARY_INFORMATION_TYPES',
66 'ProductJobType',
67 'SECURITY_INFORMATION_TYPES',
68 'SharingPermission',
69@@ -101,6 +102,11 @@
70 PROPRIETARY_INFORMATION_TYPES = (
71 InformationType.PROPRIETARY, InformationType.EMBARGOED)
72
73+# The information types unrelated to user data or security
74+PUBLIC_PROPRIETARY_INFORMATION_TYPES = (
75+ (InformationType.PUBLIC,) + PROPRIETARY_INFORMATION_TYPES
76+)
77+
78
79 class SharingPermission(DBEnumeratedType):
80 """Sharing permission.