feat: grant a new plugin or connector to everyone by default — the admin's job is now removal, not distribution
Nightly Build / build (push) Successful in 7m23s
Nightly Build / build (push) Successful in 7m23s
The grant junctions (plugin_access, mcp_global_access, mcp_catalog_access)
stay deny-by-default internally, but the rows are written for you at two
moments and never again:
— an object is CREATED: PluginManager::update_config (first toggle —
the plugins row's birth), mcp::catalog_upsert, marketplace install,
mcp::global_enable
— a user is CREATED: UserManager::register_user
Who is included is the role attrs.auto_grant flag (default true, so every
role predating the attribute behaves like an adult member). The seeded
Children preset sets it to false, which is the whole reason the attribute
exists. Admins are skipped because they hold everything implicitly. The
role editor now exposes the switch as a checkbox.
New crate module: db::access_defaults (seed_new_object, seed_new_user,
set_grant_by_default). Additive columns: grant_by_default on plugins,
mcp_catalog, mcp_global_servers (INTEGER NOT NULL DEFAULT 1).
On the frontend the Roles page gets a "New extensions" column and
checklist; the user's plugin/connector rosters are unchanged. i18n:
en, fr, it.
Docs: new docs/access.md for the assistant, plus index.md cross-link.
CLAUDE.md updated with a full default-access section.
This commit is contained in:
@@ -340,6 +340,19 @@ impl UserManager {
|
||||
return Err(e);
|
||||
}
|
||||
|
||||
// A new member should arrive holding what the household already uses,
|
||||
// rather than an empty account the admin has to walk the plugin and
|
||||
// connector lists to furnish. Whether that happens at all is the role's
|
||||
// call (`attrs.auto_grant`) — see `db::access_defaults`.
|
||||
//
|
||||
// Here rather than in the endpoint so no future user-creation path can
|
||||
// forget it; non-fatal for the mirror-image reason that the memory
|
||||
// scaffold above is: a missing convenience grant is fixable from the
|
||||
// user's page, a half-registered account is not.
|
||||
if let Err(e) = db::access_defaults::seed_new_user(&self.system, &id, role_id).await {
|
||||
warn!(user = %id, error = %e, "default access grants failed (non-fatal)");
|
||||
}
|
||||
|
||||
info!(user = %id, %username, encrypted, "user registered");
|
||||
Ok(id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user