in kinto-remote-settings/src/kinto_remote_settings/signer/updater.py [0:0]
def create_destination(self, request):
"""Create the destination bucket/collection if they don't already exist."""
# With the current implementation, the destination is not writable by
# anyone and readable by everyone.
# https://github.com/Kinto/kinto-signer/issues/55
bucket_name = self.destination["bucket"]
collection_name = self.destination["collection"]
# Destination bucket will be writable by current user.
perms = {"write": [request.prefixed_userid]}
ensure_resource_exists(
request=request,
resource_name="bucket",
parent_id="",
obj={FIELD_ID: bucket_name},
permissions=perms,
matchdict={"id": bucket_name},
)
# Destination collection will be publicly readable.
readonly_perms = {"read": (Everyone,)}
ensure_resource_exists(
request=request,
resource_name="collection",
parent_id=self.destination_bucket_uri,
obj={FIELD_ID: collection_name},
permissions=readonly_perms,
matchdict={"bucket_id": bucket_name, "id": collection_name},
)