assignRole method
Assigns roleId to userId on the backend.
Implementation
@override
Future<void> assignRole({
required String userId,
required String roleId,
}) async {
try {
await _firestore.collection(_usersCollection).doc(userId).set({
_rolesField: FieldValue.arrayUnion([roleId]),
}, SetOptions(merge: true));
} catch (error) {
throw Exception(
'FirebaseRbacProvider.assignRole failed '
'(user: $userId, role: $roleId): $error',
);
}
}