Permissions: change from list to key/value pairs in manifest #168

Merged
Oleg-Komarov merged 6 commits from permissions-dict into main 2024-06-04 17:34:33 +02:00
Owner

See #166

This PR changes validation rules for permissions field of the manifest.
When present, the field is expected to represent a dictionary of {slug: reason}
key-value pairs. Previous format was a list of [slug].

Validation for these reason strings ensures that a reason is a non-empty string,
no longer than 64 characters, and doesn't end in punctuation.

No visible changes on the website are done in this PR.
/api/v1/extensions/ endpoint now returns permissions field as a dict
{slug: reason}, where reason is taken from VersionPermission.help field
managed via admin.

The new values are stored in metadata, but the Version.permissions model
is not changing yet, and thus it doesn't store the reason values.
We can decide to keep the model as is and lookup the reasons from
Version.file.metadata, but this needs more thought.

See #166 This PR changes validation rules for `permissions` field of the manifest. When present, the field is expected to represent a dictionary of {slug: reason} key-value pairs. Previous format was a list of [slug]. Validation for these reason strings ensures that a reason is a non-empty string, no longer than 64 characters, and doesn't end in punctuation. No visible changes on the website are done in this PR. `/api/v1/extensions/` endpoint now returns `permissions` field as a dict {slug: reason}, where reason is taken from `VersionPermission.help` field managed via admin. The new values are stored in metadata, but the `Version.permissions` model is not changing yet, and thus it doesn't store the reason values. We can decide to keep the model as is and lookup the reasons from `Version.file.metadata`, but this needs more thought.
Oleg-Komarov added 5 commits 2024-06-04 16:37:01 +02:00
Oleg-Komarov added 1 commit 2024-06-04 17:17:30 +02:00
Anna Sirota approved these changes 2024-06-04 17:34:04 +02:00
Anna Sirota left a comment
Owner

LGTM

LGTM
Oleg-Komarov merged commit e3ca4daed7 into main 2024-06-04 17:34:33 +02:00
Oleg-Komarov deleted branch permissions-dict 2024-06-04 17:34:33 +02:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: infrastructure/extensions-website#168
No description provided.