Repository navigation
Give the built-in Editor and Author the default grants of plugins - #3128
Open
pournasserian wants to merge 1 commit into
Open
pournasserian wants to merge 1 commit into
pournasserian wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A permission can now name the built-in roles that get it by default (
Permission.DefaultRoles, SDK). At each start the host applies the defaults the instance has not applied yet and records each one in a new system table,cms_default_grant, so a default is given once per instance. The media plugin givesmedia.readandmedia.uploadto Editor and Author andmedia.updateto Editor; AI assist givesai.useto both. Spec 4.8 lists the defaults.Closes #3103
Decisions
cms_default_grant (role_id, permission, plugin, applied_at), keyed on role and permission, rather than a settings area like seeding's. A settings area would add asettings.{area}.managepermission and a Management route that can rewrite the record, and a settings write cannot share the save of the grants (FCMS2807). The grants, their records and the role stamp go in one save throughRoleService. If two instances start at the same time, the one that saves second fails on the key, reads again and finds nothing left to do.media.readlimited to folders, ormedia.*), the default is recorded but nothing is added. A default never widens a limit an operator set.BuiltInRoleis onlyEditororAuthor. Super Admin already holds*, and Public and Member are left out so a plugin cannot open anonymous or member access by itself. Built-in roles have fixed ids and cannot be deleted or renamed, so a default names its role by id. A row for a role that is missing is skipped.plugin.role.updatedactivity row from the system (withadded) and log event 9238, the next free id in the plugin host block (9230 to 9239). No new error code. The grants go through the role version interceptor like any other role edit, so the start that applies them evicts every site's Delivery copies once. Tests that count evictions orrole.updatedrows on hosts with the media plugin (two media delivery tests, the site locale cache tests, one Super Admin test) now leave out what the start did.v1.0.0-preview.1does not exist, so the table is folded into theInitialsystem migration of SQLite, PostgreSQL and SQL Server (one migration per stream and provider, H5).BaselineTestsleaves tables added since the squash out of the comparison with the old chain, after checking that the baseline creates them. Local databases built from the earlier baseline have to be recreated.BuiltInRoleandPermission.DefaultRoles(an init property, empty by default) are inPublicAPI.Unshipped.txt. This is additive, so existing providers still compile.Tests
DefaultRolesis empty by default, keeps each role once, and rejects null or an unknown value.Full CI run: https://github.com/fluentcms/FluentCMS/actions/runs/43732415125 (success; data jobs on SQLite, PostgreSQL and SQL Server).