Thiago F. Pappacena has proposed merging
~pappacena/launchpad:ocirecipe-private-reconcile-pillar into launchpad:master
with ~pappacena/launchpad:ocirecipe-private-accesspolicy as a prerequisite.
Commit message:
Running reconcile for OCI recipes when an OCI project changes pillar
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~pappacena/launchpad/+git/launchpad/+merge/399469
When we change an OCI project's pillar, we should reconcile access artifacts
for every OCI recipe associated with that.
This MP got kind of big mostly because of a refactoring on
reconcile_access_for_artifact signature, to allow bulk operations.
--
Your team Launchpad code reviewers is requested to review the proposed merge of
~pappacena/launchpad:ocirecipe-private-reconcile-pillar into launchpad:master.
diff --git a/lib/lp/blueprints/model/specification.py b/lib/lp/blueprints/model/specification.py
index e0d4001..abd2786 100644
--- a/lib/lp/blueprints/model/specification.py
+++ b/lib/lp/blueprints/model/specification.py
@@ -1,4 +1,4 @@
-# Copyright 2009-2020 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2021 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
@@ -922,14 +922,14 @@ class Specification(SQLBase, BugLinkTargetMixin, InformationTypeMixin):
"""See ISpecification."""
# avoid circular imports.
from lp.registry.model.accesspolicy import (
-reconcile_access_for_artifact,
+reconcile_access_for_artifacts,
)
if self.information_type == information_type:
return False
if information_type not in self.getAllowedInformationTypes(who):
raise CannotChangeInformationType("Forbidden by project policy.")
self.information_type = information_type
-reconcile_access_for_artifact(self, information_type, [self.target])
+reconcile_access_for_artifacts([self], information_type, [self.target])
if (information_type in PRIVATE_INFORMATION_TYPES and
not self.subscribers.is_empty()):
# Grant the subscribers access if they do not have a
diff --git a/lib/lp/bugs/model/bug.py b/lib/lp/bugs/model/bug.py
index a9b177c..7c9326c 100644
--- a/lib/lp/bugs/model/bug.py
+++ b/lib/lp/bugs/model/bug.py
@@ -1,4 +1,4 @@
-# Copyright 2009-2020 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2021 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Launchpad bug-related database table classes."""
@@ -189,7 +189,7 @@ from lp.registry.interfaces.sharingjob import (
IRemoveArtifactSubscriptionsJobSource,
)
from lp.registry.interfaces.sourcepackage import ISourcePackage
-from lp.registry.model.accesspolicy import reconcile_access_for_artifact
+from lp.registry.model.accesspolicy import reconcile_access_for_artifacts
from lp.registry.model.person import (
Person,
person_sort_key,
@@ -2122,7 +2122,7 @@ class Bug(SQLBase, InformationTypeMixin):
BugSubscription.person == person).is_empty()
def _reconcileAccess(self):
-# reconcile_access_for_artifact will only use the pillar list if
+# reconcile_access_for_artifacts will only use the pillar list if
# the information type is private. But affected_pillars iterates
# over the tasks immediately, which is needless expense for
# public bugs.
@@ -2130,8 +2130,8 @@ class Bug(SQLBase, InformationTypeMixin):
pillars = self.affected_pillars
else:
pillars = []
-reconcile_access_for_artifact(
-self, self.information_type, pillars)
+reconcile_access_for_artifacts(
+[self], self.information_type, pillars)
def _attachments_query(self):
"""Helper for the attachments* properties."""
diff --git a/lib/lp/code/model/branch.py b/lib/lp/code/model/branch.py
index 947aaf1..291045d 100644
--- a/lib/lp/code/model/branch.py
+++ b/lib/lp/code/model/branch.py
@@ -1,4 +1,4 @@
-# Copyright 2009-2020 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2021 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
@@ -160,7 +160,7 @@ from lp.registry.interfaces.sharingjob import (
)
from lp.registry.model.accesspolicy import (
AccessPolicyGrant,
-reconcile_access_for_artifact,
+reconcile_access_for_artifacts,
)
from lp.registry.model.teammembership import TeamParticipation
from lp.services.config import config
@@ -259,8 +259,8 @@ class Branch(SQLBase, WebhookTargetMixin, BzrIdentityMixin):
# works, so only work for products for now.
if self.product is not None: