-
Notifications
You must be signed in to change notification settings - Fork 11
/
mon_ets_user.dart
38 lines (30 loc) · 1.04 KB
/
mon_ets_user.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/// User received from MonETS after a authentication
class MonETSUser {
static const int studentRoleId = 1;
static const String mainDomain = "ENS";
final String domain;
final int typeUsagerId;
/// Username of the user
final String username;
/// Get the universal code extracted from the username
String get universalCode => username.replaceFirst("$domain\\", "");
MonETSUser(
{required this.domain,
required this.typeUsagerId,
required this.username});
MonETSUser.fromJson(Map<String, dynamic> json)
: domain = json['Domaine'] as String,
typeUsagerId = json['TypeUsagerId'] as int,
username = json['Username'] as String;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is MonETSUser &&
runtimeType == other.runtimeType &&
domain == other.domain &&
typeUsagerId == other.typeUsagerId &&
username == other.username;
@override
int get hashCode =>
domain.hashCode ^ typeUsagerId.hashCode ^ username.hashCode;
}