PermissionProvider class

Provider for managing user permissions from JWT token Single source of truth for permissions - reads from AccessTokenProvider

Works offline-first: permissions are cached in the token and don't require connectivity checks. The server validates on sync if needed.

Provides default permissions when no token exists (offline + no previous login)

Inheritance

Constructors

PermissionProvider(AccessTokenProvider _accessTokenProvider, {UserPermissions? defaultPermissions})

Properties

canCreateArticle bool
no setter
canCreateBilling bool
no setter
canCreateBoutique bool
no setter
canCreateChain bool
no setter
canCreateContact bool
no setter
canCreateFirm bool
no setter
canCreateTicket bool
no setter
canCreateUserManagement bool
no setter
canDeleteArticle bool
no setter
canDeleteBilling bool
no setter
canDeleteBoutique bool
no setter
canDeleteChain bool
no setter
canDeleteContact bool
no setter
canDeleteFirm bool
no setter
canDeleteTicket bool
no setter
canDeleteUserManagement bool
no setter
canExportData bool
no setter
canGiveDiscount bool
no setter
canImportTickets bool
no setter
canPurchase bool
no setter
canReadArticle bool
no setter
canReadBilling bool
no setter
canReadBoutique bool
no setter
canReadChain bool
no setter
canReadContact bool
no setter
canReadFirm bool
no setter
canReadTicket bool
no setter
canReadUserManagement bool
no setter
canSeeStats bool
no setter
canSellOutOfCatalog bool
no setter
canSetPromo bool
no setter
canSpendOutOfCatalog bool
no setter
canStockInventory bool
no setter
canStockMovement bool
no setter
canUpdateArticle bool
no setter
canUpdateBilling bool
no setter
canUpdateBoutique bool
no setter
canUpdateChain bool
no setter
canUpdateContact bool
no setter
canUpdateContactBalanceOffline bool
no setter
canUpdateFirm bool
no setter
canUpdateTicket bool
no setter
canUpdateUserManagement bool
no setter
canUpdateUserPassword bool
no setter
firmId String
Context properties from token
no setter
hasAdminRights bool
Check if user has any admin rights
no setter
hasCreateRights bool
Check if user has any create rights
no setter
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
hasToken bool
Check if user has any token at all
no setter
isAuthenticated bool
Check if user is considered authenticated (either via JWT token or BFF session)
no setter
isServiceAccount bool
Whether this user is a service account
no setter
permissionSummary Map<String, bool>
Get a summary of user's main permissions (for debugging)
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
userId String
no setter
userPermissions → UserPermissions
Get user permissions from token or BFF override Falls back to default permissions when no token exists
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
dispose() → void
Discards any resources used by the object.
override
hasPermission(String permission) bool
Check if user has a specific permission Example: hasPermission('article_create')
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
toString() String
A string representation of this object.
inherited
updateBffPermissions(UserPermissions permissions) → void
Update permissions for BFF mode (where permissions come from server session)

Operators

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