Class SystemScopeRegistry
Stores system-level scope definitions. A flat set (no access level) — system keys carry an explicit list, and privileged roles map to a subset.
public class SystemScopeRegistry : ISystemScopeRegistry
- Inheritance
-
SystemScopeRegistry
- Implements
- Inherited Members
Properties
All
public IReadOnlyList<SystemScopeDefinition> All { get; }
Property Value
Methods
Register(string, string)
Declares a system scope. Registering a name that is already present is a no-op — the first registration's description is kept.
public void Register(string scopeName, string description = null)
Parameters
scopeNamestringThe scope's name, which is its identity.
descriptionstringCatalogue text shown beside the scope. Ignored if the name is already registered.
Remarks
A duplicate name is deliberately not an error. The library registers its own built-in scopes,
and a host may register the same name — either because it did so before the library started to
(simulation:demo arrived library-side in 3.14.0, after hosts had been registering it
themselves), or simply because both want the scope to exist. The library cannot guard a call in host
code, so tolerating the duplicate here is the only place the problem can be solved.
This is not a lost typo check. A misspelled scope produces a new name rather than a duplicate,
so throwing here never caught one; UnregisteredRoleScopeCheck is what reports a role
referencing a scope nobody registered. Nor is there a conflict left to detect: the name is the
capability's identity and the description is catalogue text, so two registrations of one name cannot
disagree about what is being granted. Team scopes differ — ScopeDefinition also carries
DefaultMinimumLevel and GrantOnly, which genuinely can conflict — and
ScopeRegistry is unchanged.
First registration wins, rather than last. Registration order is not something a host controls today, so "last wins" would make the rendered catalogue description non-deterministic instead of controllable. A host that wants to own the wording needs a replace mechanism, which this is not.
Throwing on a duplicate is what broke #237.