What I want to do
I wanna make a list to control the auth in my system, but it can’t work.
Dgraph metadata
type UserAuth @auth(
add: { rule: """
query ($guid: String!) {
queryUserAuth(filter: { mid: { eq: $guid },and:{ role:{eq:admin} } }) {
id
}
}"""
}
update: { rule: """
query ($guid: String!) {
queryUserAuth(filter: { mid: { eq: $guid },and:{ role:{eq:admin} } }) {
mid
}
}"""
}
delete: { rule: """
query ($guid: String!) {
queryUserAuth(filter: { mid: { eq: $guid },and:{ role:{eq:admin} } }) {
mid
}
}"""
}
) {
mid : String! @id
schools:[UserAuthSchoolClasses]
role: UserAuthRole! @search
}
# Dgraph.Authorization {"VerificationKey":"xtjpk","Header":"x-d-token","Namespace":"xtjpk","Algo":"HS256","Audience":["user"]}
next is my token claims
{
"aud": "user",
"exp": 1661365141,
"guid": "1",
"iat": 1660285141,
"sub": "user"
}
{
"data": {
"addUserAuth": null
},
"extensions": {
"touched_uids": 4,
"tracing": {
"version": 1,
"startTime": "2022-08-12T14:31:46.072776+08:00",
"endTime": "2022-08-12T14:31:46.078711+08:00",
"duration": 5935303,
"execution": {
"resolvers": [
{
"path": [
"addUserAuth"
],
"parentType": "Mutation",
"fieldName": "addUserAuth",
"returnType": "AddUserAuthPayload",
"startOffset": 194572,
"duration": 5729831,
"dgraph": [
{
"label": "preMutationQuery",
"startOffset": 230193,
"duration": 1616877
},
{
"label": "mutation",
"startOffset": 1924047,
"duration": 1739284
},
{
"label": "query",
"startOffset": 0,
"duration": 0
}
]
}
]
}
}
}
}