FirebaseRbacProvider class final
RbacProvider implementation backed by Cloud Firestore and Firebase Auth.
Role assignments are stored in a Firestore user document under
rolesField.
Firebase Auth custom claims are also checked when available, with Firestore
taking precedence.
final provider = FirebaseRbacProvider(policy: myPolicy);
final context = await provider.loadContext(userId: 'user_123');
- Implemented types
Constructors
- FirebaseRbacProvider({required RbacPolicy policy, FirebaseFirestore? firestore, FirebaseAuth? auth, String usersCollection = 'users', String rolesField = 'roles'})
- Creates a FirebaseRbacProvider.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
assignRole(
{required String userId, required String roleId}) → Future< void> -
Assigns
roleIdtouserIdon the backend.override -
loadContext(
{required String userId}) → Future< RbacContext> -
Loads the RbacContext for
userId.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeRole(
{required String userId, required String roleId}) → Future< void> -
Removes
roleIdfromuserIdon the backend.override -
toString(
) → String -
A string representation of this object.
inherited
-
usersWithRole(
String roleId) → Future< List< String> > -
Returns the IDs of all users that have
roleIdassigned.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited