Auth JWT array parameters

Currently I am running a development branch: 243a336d1.
There are a few things I am trying to solve with auth rules:

  1. Show active nodes unless a parameter is passed in then show active and inactive. I have read that boolean parameters are not supported yet, any word on when this will be updated? So for now I am using a string
  2. Filter users via the selectedRegions, need to pass in an array paramater.
  3. Filter users, pass in an array of ids to be used in a query. Or can I pass in an array of strings to and do a contains. e.g. a rule like: {$PERMISSIONS: {eq: “USERS”}} where $PERMISSIONS = [“USERS”, “REGIONS”]

Here is my attempts at solving point one and two, I am having issues with the REGIONS paramater as I dont think I can pass arrays.

type User @auth( query: { rule: "{ and: [{ or: [{$SHOWINACTIVE: { eq: \"true\" }}, {queryUser(filter: {active: true}) { id} }]}, {query($REGIONS: [ID!]) {queryUser { selectedRegions(filters: {id: $REGIONS}) { id}}}}]}" }     ) {
        username: String @search(by: [regexp])
        firstName: String @search(by: [regexp])
        lastName: String @search(by: [regexp])
        active: Boolean @search
        permissions: [Permission] @hasInverse(field: users)
        selectedRegions: [Region] @hasInverse(field: users)
}
type Permission {
        name: String @search(by: [regexp])
        active: Boolean @search
        users: [User] @hasInverse(field: permissions)
}

type Region  {
        name: String @search(by: [regexp])
        active: Boolean @search
        users: [User] @hasInverse(field: selectedRegions)
}
1 Like

I saw some work on something similar to this today on github:

https://github.com/dgraph-io/dgraph/pull/7039

That would help cover the third use case I believe. I can’t say for sure the direction here as I did not look into the code only the email alert with the titles. FYI, You can watch the repo for alerts of work in progress.

Do you have an example claims or JWT? I believe this should work. I haven’t had to utilize this part though yet.