-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRUD example policy #33
Comments
Read policy works correctly:
|
provide the group ID |
Hmm okay. I was hoping for a better automated solution. If you forget to pass the group_id for example in code. Just like the user_id is autopopulated with auth.uid() |
You could add a before trigger that could maybe do something like this but the only way for it to know which group_id to use in the absence of one would be in the case of an update rather than an insert. Are you trying to update or upsert/insert? If it's an update, set a trigger to carry the group_id value of the old record over to the new one. Other than that, you logically must include the group_id in the submitted data so that the db knows what group the incoming data belongs to. |
Can you provide CRUD example policies for a custom table?
I saw the examples for group tables and tried to apply them but am running into the following problem:
I have a cities table:
Foreign key group_id to groups.id
And policy:
I also tried this policy:
Error:
JS code:
The text was updated successfully, but these errors were encountered: