8000 Args in list access functions · Issue #419 · keystonejs/keystone-5 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Args in list access functions #419
Open
@SavelevMatthew

Description

@SavelevMatthew

Good afternoon. I'm using keystone in a work project and I've come across the following need: I want to prevent a part of users from filtering a particular field. For example, I want to prohibit a query of the form:

{
    _allUsersMeta(where: { phone_in: ["xxx", "yyy", "zzz"] })
}

The most logical way, in my opinion, is to modify the access function like this:

{
    fields: {}
    access: {
        read: async ({ authentication: { item: user } } }) {
            if (!user) return false
            if (user.isAdmin) return true
            // Else parse args here
        }
    }
}

The problem is that now ListCRUDProvider Keystone does not pass query arguments to access functions, unlike CustomProvider:

const access = await this.checkListAccess(context, undefined, 'read', { gqlName });

My question is why are the arguments not passed to the access function? Is this a conscious decision or an oversight? And if there is no contradiction, can I help with the implementation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0