launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27287
[Merge] ~twom/launchpad:gdpr-add-blueprint-information into launchpad:master
Tom Wardill has proposed merging ~twom/launchpad:gdpr-add-blueprint-information into launchpad:master.
Commit message:
Add blueprints info to GDPR endpoint
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~twom/launchpad/+git/launchpad/+merge/405948
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~twom/launchpad:gdpr-add-blueprint-information into launchpad:master.
diff --git a/lib/lp/registry/model/person.py b/lib/lp/registry/model/person.py
index 52aede6..cb978a1 100644
--- a/lib/lp/registry/model/person.py
+++ b/lib/lp/registry/model/person.py
@@ -4108,6 +4108,10 @@ class PersonSet:
bug_url = self._checkForBugs(account)
if bug_url:
return_data["bugs"] = bug_url
+ # blueprints
+ blueprints_url = self._checkForBlueprints(account)
+ if blueprints_url:
+ return_data["blueprints"] = blueprints_url
# This is only an 'account' in terms of the end user view,
# it does not refer to an `IAccount`.
if len(return_data.keys()) > 1:
@@ -4171,6 +4175,13 @@ class PersonSet:
req.prepare_url(bugs_url, query_arguments)
return req.url
+ def _checkForBlueprints(self, account):
+ """check if related blueprints exist for a given person"""
+ specifications = account.specifications(account)
+ if specifications.is_empty():
+ return None
+ return canonical_url(account, rootsite="blueprints")
+
def getUserOverview(self, person):
"""See `IPersonSet`."""
overview = {}
diff --git a/lib/lp/registry/tests/test_personset.py b/lib/lp/registry/tests/test_personset.py
index e6afa71..343dc82 100644
--- a/lib/lp/registry/tests/test_personset.py
+++ b/lib/lp/registry/tests/test_personset.py
@@ -1290,6 +1290,17 @@ class TestGDPRUserRetrieval(TestCaseWithFactory):
person, rootsite="bugs"))}))
self.assertIn("field.searchtext", result["bugs"])
+ def test_account_data_blueprints(self):
+ person = self.factory.makePerson(email="test@xxxxxxxxxxx")
+ self.factory.makeBlueprint(owner=person)
+ with admin_logged_in():
+ result = self.person_set.getUserData(u"test@xxxxxxxxxxx")
+ self.assertDictEqual({
+ "status": "account with data",
+ "person": canonical_url(person),
+ "blueprints": canonical_url(person, rootsite="blueprints")
+ }, result)
+
def test_getUserOverview(self):
ppa = self.factory.makeArchive(owner=self.user)