RoleBasedAuthorizer class

A simple role-based Authorizer: a principal may perform an action if it holds one of the roles mapped to that action's required role set, or holds the wildcard adminRole.

Actions not explicitly mapped require adminRole by default (fail-closed). This is the designed extension point for richer RBAC / multi-tenant rules.

Implemented types

Constructors

RoleBasedAuthorizer({String adminRole = 'admin', Map<String, Set<String>> actionRoles = defaultActionRoles})
Creates a role-based authorizer.
const

Properties

actionRoles Map<String, Set<String>>
Maps an action prefix (e.g. node., preset.) to the roles allowed.
final
adminRole String
The role that is permitted to do everything.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

authorize(Principal principal, String action, {String? target}) bool
Returns true if principal may perform action on target.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

defaultActionRoles → const Map<String, Set<String>>
The default policy: a principal holding the node role may register a node; everything else requires adminRole.