generateRbacRestrictedView for non-updateable tables

This commit is contained in:
Michael Hoennig 2022-10-18 17:29:10 +02:00
parent 61473abf68
commit bec559c9c3

View File

@ -135,7 +135,7 @@ end; $$;
--changeset rbac-generators-RESTRICTED-VIEW:1 endDelimiter:--//
-- ----------------------------------------------------------------------------
create or replace procedure generateRbacRestrictedView(targetTable text, orderBy text, columnUpdates text)
create or replace procedure generateRbacRestrictedView(targetTable text, orderBy text, columnUpdates text = null)
language plpgsql as $$
declare
sql text;
@ -221,6 +221,7 @@ begin
Instead of update trigger function for the restricted view
based on the 'edit' permission of the current subject.
*/
if columnUpdates is not null then
sql := format($sql$
create or replace function %1$sUpdate()
returns trigger
@ -248,5 +249,6 @@ begin
execute function %1$sUpdate();
$sql$, targetTable);
execute sql;
end if;
end; $$;
--//