Hello, is it possible to set RLS on a view ? So y...
# help
a
Hello, is it possible to set RLS on a view ? So you can have a view to select, a view to update, and a view to insert
n
Hello @abc222! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
a
And if it's not possible, how can I control access on specific field, so it's possible to update the description of a product but not its title based on some user's role or some user's team ?
Another example : How can I let a moderator view the ip_address of an action but not a simple member ?
g
No RLS on view. You can use a trigger before update to set new.col to old.col for your special case. Or an RPC function to do the update as a “security definer” function.
n
abc222 (2022-05-10)
a
Is there examples somewhere about how a trigger would do that ? I don't consider it to be a special case, i have a lot of case where i need to protect columns of being updated Or where i want to create views that react differently considering who is seeing them I also checked security definer but it seems quite boilerplatey, thanks for your information tho