mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Security Label and ACL template macros:
Way to use in template: 1) Security labels: SECLABLE.SET(conn, object_type, object_name, provider, security_label, object.schema) SECLABLE.UNSET(conn, object_type, object_name, provider, object.schema) 2) Privileges: PRIVILEGE.SET(conn, object_type, grantee, object_name, privileges_without_grant, privileges_with_grant, object.schema) PRIVILEGE.UNSETALL(conn, object_type, grantee, object_name, schema) privileges_without_grant = comma separated string of privileges. privileges_with_grant = comma separated string of privileges.
This commit is contained in:
parent
3ff06da772
commit
d2e372114b
@ -0,0 +1,14 @@
|
||||
{##########################################}
|
||||
{# Macros for schema and its child nodes #}
|
||||
{##########################################}
|
||||
{% macro SET(conn, type, role, param, priv, with_grant, schema) -%}
|
||||
{% if priv %}
|
||||
GRANT {{ priv }} ON {{ type }} {{ conn|qtIdent(schema, param) }} TO {{ conn|qtIdent(role) }};
|
||||
{% endif %}
|
||||
{% if with_grant %}
|
||||
GRANT {{ with_grant }} ON {{ type }} {{ conn|qtIdent(schema, param) }} TO {{ conn|qtIdent(role) }} WITH GRANT OPTION;
|
||||
{% endif %}
|
||||
{%- endmacro %}
|
||||
{% macro UNSETALL(conn, type, role, param, schema) -%}
|
||||
REVOKE ALL ON {{ type }} {{ conn|qtIdent(schema, param) }} FROM {{ conn|qtIdent(role) }};
|
||||
{%- endmacro %}
|
@ -0,0 +1,9 @@
|
||||
{##########################################}
|
||||
{# Macros for schema and its child nodes #}
|
||||
{##########################################}
|
||||
{% macro SET(conn, type, name, provider, label, schema) -%}
|
||||
SECURITY LABEL FOR {{ provider }} ON {{ type }} {{ conn|qtIdent(schema, name) }} IS {{ label|qtLiteral }};
|
||||
{%- endmacro %}
|
||||
{% macro UNSET(conn, type, name, provider, schema) -%}
|
||||
SECURITY LABEL FOR {{ provider }} ON {{ type }} {{ conn|qtIdent(schema, name) }} IS NULL;
|
||||
{%- endmacro %}
|
Loading…
Reference in New Issue
Block a user