Membership class

The active-organization membership carried by a verified token.

Constructors

Membership({String role = '', List<String>? roles, List<String> permissions = const [], List<String>? teams})
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
permissions → List<String>
Effective permission ids: org:sys_* system claims plus the operator's custom org:<feature>:<action> ids.
final
role → String
Primary role key (owner/admin/member, or a project role).
final
roles → List<String>?
Every role the member holds.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
teams → List<String>?
Team ids held inside the ACTIVE organization.
final

Methods

has({String? role, String? permission, String? teamId}) → bool
Whether the membership satisfies EVERY supplied criterion (AND).
hasPermission(String permission) → bool
Whether the permission claim includes permission. Exact match only.
hasRole(String role) → bool
Whether the member holds role as one of their roles.
hasTeam(String teamId) → bool
Whether the team claim includes teamId.
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

Static Methods

fromClaim(Object? raw) → Membership?
Decode the membership claim, or return null when the token carries none.