added guardian login with views for their assigned childs

This commit is contained in:
2026-09-20 11:11:58 +02:00
parent e4e2b1a4fb
commit 67c935c05b
117 changed files with 4784 additions and 1514 deletions
+21 -6
View File
@@ -1,4 +1,5 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:marianum_mobile/session/session.dart';
import 'package:marianum_mobile/state/app/modules/app_modules.dart';
import 'package:marianum_mobile/storage/modules_settings.dart';
@@ -11,9 +12,7 @@ void main() {
'default position', () {
// Regression: persisted settings from before the ticker module existed
// repeatedly made new modules vanish from bar, "Mehr" and settings list.
final stale = Modules.values
.where((m) => m != Modules.ticker)
.toList();
final stale = Modules.values.where((m) => m != Modules.ticker).toList();
final effective = AppModule.effectiveModuleOrder(settingsWith(stale));
@@ -72,9 +71,7 @@ void main() {
// visible modules must not move or drop it (previously the raw persisted
// indices were used, moving the wrong module).
final effective = AppModule.effectiveModuleOrder(settingsWith([]));
final displayed = effective
.where((m) => m != Modules.ticker)
.toList();
final displayed = effective.where((m) => m != Modules.ticker).toList();
final tickerSlot = effective.indexOf(Modules.ticker);
final result = AppModule.reorderModuleOrder(
@@ -92,4 +89,22 @@ void main() {
);
});
});
group('isAvailableFor', () {
final student = CredentialSession(username: 'max', password: 'pw');
const guardian = GuardianSession(email: 'e@x.de');
test('password accounts see every module', () {
for (final m in Modules.values) {
expect(AppModule.isAvailableFor(m, student), isTrue, reason: m.name);
}
});
test('guardians lose exactly the Nextcloud modules', () {
final hidden = Modules.values
.where((m) => !AppModule.isAvailableFor(m, guardian))
.toSet();
expect(hidden, {Modules.talk, Modules.files});
});
});
}