-
Notifications
You must be signed in to change notification settings - Fork 0
/
User.graphql
50 lines (48 loc) · 957 Bytes
/
User.graphql
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
# To update fields on
# a node of type `User`, a `User` must be either the "owner"
# of the `User` _OR_ an `ADMIN`
# this current user check is currently broken
query UpdateUserData ($user_id: ID!, $node_id: ID!) {
SomeUserExists(filter: {
OR: [{
AND: [{
id: $user_id,
},
{
id: $node_id,
}
]
},
{
id: $user_id,
role: ADMIN
}]
})
}
# To update the field `role` on
# a node of type `User`, a `User` must be an `ADMIN`
query UpdateUserRole ($user_id: ID!) {
SomeUserExists(filter: {
id: $user_id,
role: ADMIN
})
}
# To delete a node of type `User`, a `User` must be
# either the "owner" of the `User` _OR_ an `ADMIN`
query DeleteUser ($user_id: ID!) {
SomeUserExists(filter: {
OR: [{
AND: [{
id: $user_id,
},
{
id: $node_id,
}
]
},
{
id: $user_id,
role: ADMIN
}]
})
}