PermissionRule class

A single permission rule that matches requests by scope, action, and resource pattern.

Constructors

PermissionRule({required String id, required String name, PermissionScope? scope, String? actionPattern, String? resourcePattern, String? toolPattern, required PermissionLevel level, int priority = 100, bool enabled = true, DateTime? expiresAt, String? source})

Properties

actionPattern String?
Action pattern (exact match or glob). Null matches all actions.
final
enabled bool
Whether this rule is currently active.
getter/setter pair
expiresAt DateTime?
Optional expiry time after which the rule is ignored.
final
hashCode int
The hash code for this object.
no setterinherited
id String
Unique identifier for this rule.
final
isActive bool
Whether this rule is active (enabled and not expired).
no setter
isExpired bool
Whether this rule has expired.
no setter
level PermissionLevel
The permission level to grant when this rule matches.
final
name String
Human-readable name.
final
priority int
Priority for rule ordering. Lower values take precedence.
final
resourcePattern String?
Resource pattern (exact, prefix, glob, or regex). Null matches all.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scope PermissionScope?
Scope this rule applies to, or null for all scopes.
final
source String?
Source of this rule (e.g., "user", "config", "session").
final
toolPattern String?
Tool name pattern. Null matches all tools.
final

Methods

matches(PermissionRequest request) bool
Check if this rule matches the given request.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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