chore: protect reserved builtin rolenames (#13571)

Conflicting built-in and database role names makes it hard to
disambiguate
This commit is contained in:
Steven Masley
2024-06-13 10:12:37 -10:00
committed by GitHub
parent 7d51515f9d
commit 3d30c8dc68
3 changed files with 46 additions and 0 deletions

View File

@ -195,6 +195,13 @@ type RoleOptions struct {
NoOwnerWorkspaceExec bool
}
// ReservedRoleName exists because the database should only allow unique role
// names, but some roles are built in. So these names are reserved
func ReservedRoleName(name string) bool {
_, ok := builtInRoles[name]
return ok
}
// ReloadBuiltinRoles loads the static roles into the builtInRoles map.
// This can be called again with a different config to change the behavior.
//