Implementert admin-funksjoner: Dashboard, Ansattliste, Avvikshåndtering og Profil-oppdatering
This commit is contained in:
@@ -140,6 +140,20 @@ class AuthService {
|
||||
return 'default_aml';
|
||||
}
|
||||
|
||||
// Hent alle brukere i en organisasjon
|
||||
Future<List<UserModel>> getUsersInOrganization(String organizationId) async {
|
||||
try {
|
||||
final snapshot = await _firestore
|
||||
.collection('users')
|
||||
.where('organizationId', isEqualTo: organizationId)
|
||||
.get();
|
||||
|
||||
return snapshot.docs.map((doc) => UserModel.fromFirestore(doc)).toList();
|
||||
} catch (e) {
|
||||
throw Exception('Kunne ikke hente brukere: $e');
|
||||
}
|
||||
}
|
||||
|
||||
// Håndter Firebase Auth exceptions
|
||||
String _handleAuthException(FirebaseAuthException e) {
|
||||
switch (e.code) {
|
||||
|
||||
Reference in New Issue
Block a user