Add schema and store for named access lists (#125) #136
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
qwc-open/asiakirjat!136
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/named-access-lists"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
First of three PRs for #125. This one is inert by design — it adds the storage layer without changing any behaviour.
The shape
Per your note that a list must be able to be an LDAP group, or an LDAP group plus extra users, membership deliberately mirrors
global_accessrules:A list is therefore any mix of
ldap_group,oauth2_groupandusersubjects, each with its own viewer/editor role. Same shape as a global access rule, so the resolution path #135 just introduced extends to lists rather than needing a second mechanism.The project points at a list by id rather than by name, so renaming a list can't orphan projects.
Two decisions worth your eye
ON DELETE RESTRICTonprojects.access_list_id. Deleting a list that projects still use would silently change who can reach them — the failure mode this whole issue family keeps producing. The database refuses it instead, andCountProjectsUsinglets the admin UI say "used by 3 projects" rather than surfacing a constraint error. FK enforcement is on in production (database.go:63), so this actually bites.The down migration resets affected projects to
custom, notprivate. Rolling back removes the pointer, and those projects have to land somewhere;customis the narrower choice, so a rollback can only ever reduce access.Tests
internal/store/sql/access_list_test.gocovers the mixed-membership case from the issue (LDAP group + two named users), re-adding a member updating its role in place, unique list names, and that deleting an in-use list is refused and then succeeds once nothing points at it.internal/database/access_lists_schema_test.goround-trips migration 012 down to 011 and back, asserting thelistproject falls back tocustomon the way down.I also had to add
access_list_idto the explicit column lists inproject.go—GetBySlugand friends select columns by name, so the round-trip test caught the pointer coming back nil until they were updated.What's next
CanView/CanUpload/FilterAccessibleresolvevisibility = 'list'through list membership, reusingglobalRole's grant-or-rule pattern from #135;projects.Serviceaccepts the new visibility and requires a list id with it.roles-permissions.md/manage-global-access.mddocument them.Nothing between here and step 2 can set
visibility = 'list'through the UI —admin.go:236still coerces unknown values tocustom— so merging this on its own is safe.Assisted by Claude Opus 5.