/
UserPayloadsADM.scala
61 lines (57 loc) · 1.47 KB
/
UserPayloadsADM.scala
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package org.knora.webapi.messages.admin.responder.usersmessages
import org.knora.webapi.IRI
import org.knora.webapi.messages.admin.responder.valueObjects.{
Username,
Email,
GivenName,
FamilyName,
Password,
Status,
LanguageCode,
SystemAdmin
}
/**
* User entity representing the payload for the create user request
*/
sealed abstract case class UserCreatePayloadADM private (
id: Option[IRI],
username: Option[Username],
email: Option[Email],
givenName: Option[GivenName],
familyName: Option[FamilyName],
password: Option[Password],
status: Option[Status],
lang: Option[LanguageCode],
projects: Option[Seq[IRI]],
projectsAdmin: Option[Seq[IRI]],
groups: Option[Seq[IRI]],
systemAdmin: Option[SystemAdmin]
)
object UserCreatePayloadADM {
/** The create constructor needs all attributes but id which is optional */
def create(
id: Option[IRI] = None,
username: Username,
email: Email,
givenName: GivenName,
familyName: FamilyName,
password: Password,
status: Status,
lang: LanguageCode,
systemAdmin: SystemAdmin
): UserCreatePayloadADM =
new UserCreatePayloadADM(
id = id,
username = Some(username),
email = Some(email),
givenName = Some(givenName),
familyName = Some(familyName),
password = Some(password),
status = Some(status),
lang = Some(lang),
projects = None,
projectsAdmin = None,
groups = None,
systemAdmin = Some(systemAdmin)
) {}
}