Skip to content

Cannot rule with properties not included in query #948

Closed Answered by serhiistotskyi
dennemark asked this question in Q&A
Discussion options

You must be logged in to vote

OK, let's step back to this particular example:

can('read', 'User', { id: 0 })
cannot('read', 'User', 'email', { id: 1 })

and say it in human language:

you can read user with id = 0 but cannot read user email with id =1

The issue with this statement is that you cannot read User with id = 1 at all :) What you should say instead is

can('read', 'User', { id: { IN: [0, 1] } })
cannot('read', 'User', 'email', { id: 1 })

In this case on conditions level you will get { id: { IN: [0, 1] } } which is correct and fields you will need to filter out on client side or create a complex switch/case statement (which is not possible in cross db env I guess)

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@serhiistotskyi
Comment options

@serhiistotskyi
Comment options

@dennemark
Comment options

@serhiistotskyi
Comment options

Answer selected by dennemark
@serhiistotskyi
Comment options

@dennemark
Comment options

@dennemark
Comment options

@dennemark
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants