Skip to content

Whit 2073 access limit documents to named editors#11448

Draft
jamiestamp wants to merge 3 commits into
mainfrom
WHIT-2073-access-limit-documents-to-named-editors
Draft

Whit 2073 access limit documents to named editors#11448
jamiestamp wants to merge 3 commits into
mainfrom
WHIT-2073-access-limit-documents-to-named-editors

Conversation

@jamiestamp
Copy link
Copy Markdown
Contributor

Adds the "Limit access to named publishers" option to the access limiting form. Publishers can now restrict access to a draft to a list of email addresses, with the creating publisher always preserved on the list.

Edition::LimitedAccess manages the list via the named_accesses association with autosave: assigning access_limited_named_users= and marks-for-destruction records eagerly so the persisted list always matches the input. EditionRules#access_limit_enforced? and Admin::EditionFilter are extended to enforce membership for the named_users mode, and DraftEditionUpdater skips its organisation-membership check for it.

As a boolean in MySQL is set up as a tinyint(1), we can set up the new options to extend what was already there.

-------------------------------------
| DB    | Before    | After         |
| Value | migration | migration     |
|-----------------------------------|
| 0     | False     | disabled      |
| 1     | True      | organisations |
| 2     |           | named_users   |
-------------------------------------

Taking this approach means we maintain the correct options when converting the column.

Updates any references to the old values to `disabled` and `organisations` as needed.

# Conflicts:
#	db/schema.rb
jamiestamp and others added 2 commits May 14, 2026 15:17
Introduces the `NamedAccess` model and corresponding migration to manage user access per edition. Ensures email presence, uniqueness within an edition, and valid email format.
Adds the "Limit access to named publishers" option to the access
limiting form. Publishers can now restrict access to a draft to a list
of email addresses, with the creating publisher always preserved on
the list.

`Edition::LimitedAccess` manages the list via the `named_accesses`
association with autosave: assigning `access_limited_named_users=`
builds and marks-for-destruction records eagerly so the persisted list
always matches the input. `EditionRules#access_limit_enforced?` and
`Admin::EditionFilter` are extended to enforce membership for the
`named_users` mode, and `DraftEditionUpdater` skips its
organisation-membership check for it.

Co-authored-by: Alex Newton <alex.newton@digital.cabinet-office.gov.uk>
@jamiestamp jamiestamp force-pushed the WHIT-2073-access-limit-documents-to-named-editors branch from e41d3c6 to 2c38d60 Compare May 14, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant