Hi, PFA of macros (privilege, security) for sequence node.
Also fixed minor issue in security macro (removed unwanted qtIdent for provider) -- *Harshal Dhumal* *Software Engineer * EenterpriseDB <http://www.enterprisedb.com>
diff --git a/web/pgadmin/browser/server_groups/servers/templates/macros/privilege.macros b/web/pgadmin/browser/server_groups/servers/templates/macros/privilege.macros index 1d6660c..44932c7 100644 --- a/web/pgadmin/browser/server_groups/servers/templates/macros/privilege.macros +++ b/web/pgadmin/browser/server_groups/servers/templates/macros/privilege.macros @@ -1,3 +1,6 @@ +{################################################} +{# This is generic macro for other objects #} +{################################################} {% macro APPLY(conn, type, role, param, priv, with_grant) -%} {% if priv %} GRANT {{ priv }} ON {{ type }} {{ conn|qtIdent(param) }} TO {{ conn|qtIdent(role) }}; @@ -8,4 +11,18 @@ GRANT {{ with_grant }} ON {{ type }} {{ conn|qtIdent(param) }} TO {{ conn|qtIden {%- endmacro %} {% macro RESETALL(conn, type, role, param) -%} REVOKE ALL ON {{ type }} {{ conn|qtIdent(param) }} FROM {{ conn|qtIdent(role) }}; +{%- endmacro %} +{####################################################} +{# This macro is specific to sequence object #} +{####################################################} +{% macro SET(conn, type, role, param, priv, with_grant) -%} +{% if priv %} +GRANT {{ priv }} ON {{ type }} {{ param }} TO {{ conn|qtIdent(role) }}; +{% endif %} +{% if with_grant %} +GRANT {{ with_grant }} ON {{ type }} {{ param }} TO {{ conn|qtIdent(role) }} WITH GRANT OPTION; +{% endif %} +{%- endmacro %} +{% macro UNSETALL(conn, type, role, param) -%} +REVOKE ALL ON {{ type }} {{ param }} FROM {{ conn|qtIdent(role) }}; {%- endmacro %} \ No newline at end of file diff --git a/web/pgadmin/browser/server_groups/servers/templates/macros/security.macros b/web/pgadmin/browser/server_groups/servers/templates/macros/security.macros index 83fb9d2..3709a3e 100644 --- a/web/pgadmin/browser/server_groups/servers/templates/macros/security.macros +++ b/web/pgadmin/browser/server_groups/servers/templates/macros/security.macros @@ -1,6 +1,18 @@ +{################################################} +{# This is generic macro for other objects #} +{################################################} {% macro APPLY(conn, type, name, provider, label) -%} -SECURITY LABEL FOR {{ conn|qtIdent(provider) }} ON {{ type }} {{ conn|qtIdent(name) }} IS {{ label|qtLiteral }}; +SECURITY LABEL FOR {{ provider }} ON {{ type }} {{ conn|qtIdent(name) }} IS {{ label|qtLiteral }}; {%- endmacro %} {% macro DROP(conn, type, name, provider) -%} -SECURITY LABEL FOR {{ conn|qtIdent(provider) }} ON {{ type }} {{ conn|qtIdent(name) }} IS NULL; +SECURITY LABEL FOR {{ provider }} ON {{ type }} {{ conn|qtIdent(name) }} IS NULL; {%- endmacro %} +{####################################################} +{# This macro is specific to sequence object #} +{####################################################} +{% macro SET(conn, type, name, provider, label) -%} +SECURITY LABEL FOR {{ provider }} ON {{ type }} {{ name }} IS {{ label|qtLiteral }}; +{%- endmacro %} +{% macro UNSET(conn, type, name, provider) -%} +SECURITY LABEL FOR {{ provider }} ON {{ type }} {{ name }} IS NULL; +{%- endmacro %} \ No newline at end of file
-- Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers