generateRbacRestrictedView for non-updateable tables
This commit is contained in:
parent
61473abf68
commit
bec559c9c3
@ -135,7 +135,7 @@ end; $$;
|
|||||||
--changeset rbac-generators-RESTRICTED-VIEW:1 endDelimiter:--//
|
--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 $$
|
language plpgsql as $$
|
||||||
declare
|
declare
|
||||||
sql text;
|
sql text;
|
||||||
@ -221,6 +221,7 @@ begin
|
|||||||
Instead of update trigger function for the restricted view
|
Instead of update trigger function for the restricted view
|
||||||
based on the 'edit' permission of the current subject.
|
based on the 'edit' permission of the current subject.
|
||||||
*/
|
*/
|
||||||
|
if columnUpdates is not null then
|
||||||
sql := format($sql$
|
sql := format($sql$
|
||||||
create or replace function %1$sUpdate()
|
create or replace function %1$sUpdate()
|
||||||
returns trigger
|
returns trigger
|
||||||
@ -248,5 +249,6 @@ begin
|
|||||||
execute function %1$sUpdate();
|
execute function %1$sUpdate();
|
||||||
$sql$, targetTable);
|
$sql$, targetTable);
|
||||||
execute sql;
|
execute sql;
|
||||||
|
end if;
|
||||||
end; $$;
|
end; $$;
|
||||||
--//
|
--//
|
||||||
|
Loading…
Reference in New Issue
Block a user