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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# ===============================================
# USERS
# ===============================================
extend type Query {
users: UserQuery
}
extend type Mutation {
users: UserMutation
}
# -----------------------------------------------
# QUERIES
# -----------------------------------------------
type UserQuery {
list(
filter: String
orderBy: String
): [UserMinimal] @auth(requires: ["write:users", "manage:users", "manage:system"])
search(
query: String!
): [UserMinimal] @auth(requires: ["write:groups", "manage:groups", "write:users", "manage:users", "manage:system"])
single(
id: Int!
): User @auth(requires: ["manage:users", "manage:system"])
profile: UserProfile
lastLogins: [UserLastLogin] @auth(requires: ["write:groups", "manage:groups", "write:users", "manage:users", "manage:system"])
}
# -----------------------------------------------
# MUTATIONS
# -----------------------------------------------
type UserMutation {
create(
email: String!
name: String!
passwordRaw: String
providerKey: String!
groups: [Int]!
mustChangePassword: Boolean
sendWelcomeEmail: Boolean
): UserResponse @auth(requires: ["write:users", "manage:users", "manage:system"])
update(
id: Int!
email: String
name: String
newPassword: String
groups: [Int]
location: String
jobTitle: String
timezone: String
dateFormat: String
appearance: String
): DefaultResponse @auth(requires: ["manage:users", "manage:system"])
delete(
id: Int!
replaceId: Int!
): DefaultResponse @auth(requires: ["manage:users", "manage:system"])
verify(
id: Int!
): DefaultResponse @auth(requires: ["manage:users", "manage:system"])
activate(
id: Int!
): DefaultResponse @auth(requires: ["manage:users", "manage:system"])
deactivate(
id: Int!
): DefaultResponse @auth(requires: ["manage:users", "manage:system"])
enableTFA(
id: Int!
): DefaultResponse @auth(requires: ["manage:users", "manage:system"])
disableTFA(
id: Int!
): DefaultResponse @auth(requires: ["manage:users", "manage:system"])
resetPassword(
id: Int!
): DefaultResponse
updateProfile(
name: String!
location: String!
jobTitle: String!
timezone: String!
dateFormat: String!
appearance: String!
): UserTokenResponse
changePassword(
current: String!
new: String!
): UserTokenResponse
}
# -----------------------------------------------
# TYPES
# -----------------------------------------------
type UserResponse {
responseResult: ResponseStatus!
user: User
}
type UserLastLogin {
id: Int!
name: String!
lastLoginAt: Date!
}
type UserMinimal {
id: Int!
name: String!
email: String!
providerKey: String!
isSystem: Boolean!
isActive: Boolean!
createdAt: Date!
lastLoginAt: Date
}
type User {
id: Int!
name: String!
email: String!
providerKey: String!
providerName: String
providerId: String
providerIs2FACapable: Boolean
isSystem: Boolean!
isActive: Boolean!
isVerified: Boolean!
location: String!
jobTitle: String!
timezone: String!
dateFormat: String!
appearance: String!
createdAt: Date!
updatedAt: Date!
lastLoginAt: Date
tfaIsActive: Boolean!
groups: [Group]!
}
type UserProfile {
id: Int!
name: String!
email: String!
providerKey: String
providerName: String
isSystem: Boolean!
isVerified: Boolean!
location: String!
jobTitle: String!
timezone: String!
dateFormat: String!
appearance: String!
createdAt: Date!
updatedAt: Date!
lastLoginAt: Date
groups: [String]!
pagesTotal: Int!
}
type UserTokenResponse {
responseResult: ResponseStatus!
jwt: String
}