Added two jinja2 template macro for support for priviliges and default

privileges.

Also, made a change in the privilege.js to scroll the div to make the
opening div visible properly.
This commit is contained in:
Harshal Dhumal
2016-01-22 18:06:54 +05:30
committed by Ashesh Vashi
parent 7f3c972d06
commit d0f7e69ad7
3 changed files with 29 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
{% macro APPLY(conn, type, role, priv, with_grant) -%}
{% if priv %}
ALTER DEFAULT PRIVILEGES
GRANT {{ priv }} ON {{ type }} TO {{ conn|qtIdent(role) }};
{% endif %}
{% if with_grant %}
ALTER DEFAULT PRIVILEGES
GRANT {{ with_grant }} ON {{ type }} TO {{ conn|qtIdent(role) }} WITH GRANT OPTION;
{% endif %}
{%- endmacro %}
{% macro RESETALL(conn, type, role) -%}
ALTER DEFAULT PRIVILEGES
REVOKE ALL ON {{ type }} FROM {{ conn|qtIdent(role) }};
{%- endmacro %}

View File

@@ -0,0 +1,11 @@
{% macro APPLY(conn, type, role, param, priv, with_grant) -%}
{% if priv %}
GRANT {{ priv }} ON {{ type }} {{ conn|qtIdent(param) }} TO {{ conn|qtIdent(role) }};
{% endif %}
{% if with_grant %}
GRANT {{ with_grant }} ON {{ type }} {{ conn|qtIdent(param) }} TO {{ conn|qtIdent(role) }} WITH GRANT OPTION;
{% endif %}
{%- endmacro %}
{% macro RESETALL(conn, type, role, param) -%}
REVOKE ALL ON {{ type }} {{ conn|qtIdent(param) }} FROM {{ conn|qtIdent(role) }};
{%- endmacro %}