Fix support for security labels. Fixes #1457

This commit is contained in:
Murtuza Zabuawala
2016-07-21 16:35:35 +01:00
committed by Dave Page
parent a7d7577c7c
commit 3d7b40e111
106 changed files with 473 additions and 364 deletions

View File

@@ -269,6 +269,22 @@ class EventTriggerView(PGChildNodeView):
status=200 status=200
) )
def _formatter(self, result):
"""
This function is ued to parse security lables
"""
seclabels = []
if 'seclabels' in result and result['seclabels'] is not None:
for sec in result['seclabels']:
sec = re.search(r'([^=]+)=(.*$)', sec)
seclabels.append({
'provider': sec.group(1),
'label': sec.group(2)
})
result['seclabels'] = seclabels
return result
@check_precondition @check_precondition
def properties(self, gid, sid, did, etid): def properties(self, gid, sid, did, etid):
""" """
@@ -290,16 +306,8 @@ class EventTriggerView(PGChildNodeView):
return internal_server_error(errormsg=res) return internal_server_error(errormsg=res)
result = res['rows'][0] result = res['rows'][0]
sec_labels = [] result = self._formatter(result)
if 'seclabels' in result and result['seclabels'] is not None:
for sec in result['seclabels']:
sec = re.search(r'([^=]+)=(.*$)', sec)
sec_labels.append({
'provider': sec.group(1),
'securitylabel': sec.group(2)
})
result.update({"seclabels": sec_labels})
return ajax_response( return ajax_response(
response=result, response=result,
status=200 status=200
@@ -517,6 +525,8 @@ class EventTriggerView(PGChildNodeView):
if not status: if not status:
return internal_server_error(errormsg=res) return internal_server_error(errormsg=res)
old_data = res['rows'][0] old_data = res['rows'][0]
old_data = self._formatter(old_data)
for arg in required_args: for arg in required_args:
if arg not in data: if arg not in data:
data[arg] = old_data[arg] data[arg] = old_data[arg]
@@ -568,6 +578,7 @@ class EventTriggerView(PGChildNodeView):
return internal_server_error(errormsg=res) return internal_server_error(errormsg=res)
result = res['rows'][0] result = res['rows'][0]
result = self._formatter(result)
sql = render_template("/".join([self.template_path, 'create.sql']), data=result, conn=self.conn) sql = render_template("/".join([self.template_path, 'create.sql']), data=result, conn=self.conn)
sql += "\n\n" sql += "\n\n"

View File

@@ -2,35 +2,6 @@ define(
['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'], ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'],
function($, _, S, pgAdmin, pgBrowser, alertify) { function($, _, S, pgAdmin, pgBrowser, alertify) {
// Extend the browser's node model class to create a security model
var SecurityLabelModel = pgAdmin.Browser.Node.Model.extend({
defaults: {
provider: undefined,
securitylabel: undefined
},
// Define the schema for the Security Label
schema: [
{id: 'provider', label:'Provider', type:'text', group: null, editable: true},
{id: 'securitylabel', label:'Security Label', type: 'text', group:null, extraHeaderClasses: 'cellwidth-40', editable: true},
],
validate: function() {
// Clear any existing errors.
this.errorModel.clear()
if (_.isUndefined(this.get('provider')) || String(this.get('provider')).replace(/^\s+|\s+$/g, '') == '') {
var msg = '{{ _('Provider cannot be empty.') }}';
this.errorModel.set('provider',msg);
return msg;
}
if (_.isUndefined(this.get('securitylabel')) || String(this.get('securitylabel')).replace(/^\s+|\s+$/g, '') == '') {
var msg = '{{ _('Security Label cannot be empty.') }}';
this.errorModel.set('securitylabel',msg);
return msg;
}
return null;
}
});
// Extend the browser's collection class for event trigger collection // Extend the browser's collection class for event trigger collection
if (!pgBrowser.Nodes['coll-event_trigger']) { if (!pgBrowser.Nodes['coll-event_trigger']) {
var databases = pgAdmin.Browser.Nodes['coll-event_trigger'] = var databases = pgAdmin.Browser.Nodes['coll-event_trigger'] =
@@ -145,10 +116,11 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
},{ },{
id: 'when', label:'{{ _('When') }}', type: 'multiline', group: "Definition", id: 'when', label:'{{ _('When') }}', type: 'multiline', group: "Definition",
},{ },{
id: 'providers', label: 'Security Labels', type: 'collection', group: "Security Labels", id: 'seclabels', label: '{{ _('Security Labels') }}',
model: SecurityLabelModel, control: 'unique-col-collection', mode: ['edit', 'create'], model: pgBrowser.SecLabelModel, editable: false, type: 'collection',
canAdd: true, canDelete: true, uniqueCol : ['provider'], group: '{{ _('Security') }}', mode: ['edit', 'create'],
columns: ['provider','securitylabel'] min_version: 90200, canAdd: true,
canEdit: false, canDelete: true, control: 'unique-col-collection'
} }
], ],
// event trigger model data validation. // event trigger model data validation.

View File

@@ -1,4 +1,4 @@
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/security.macros' as SECLABEL %}
{% if data %} {% if data %}
{% if data.enabled and data.enabled != "O" %} {% if data.enabled and data.enabled != "O" %}
ALTER EVENT TRIGGER {{ conn|qtIdent(data.name) }} ALTER EVENT TRIGGER {{ conn|qtIdent(data.name) }}
@@ -15,10 +15,10 @@ ALTER EVENT TRIGGER {{ conn|qtIdent(data.name) }}
COMMENT ON EVENT TRIGGER {{ conn|qtIdent(data.name) }} COMMENT ON EVENT TRIGGER {{ conn|qtIdent(data.name) }}
IS {{ data.comment|qtLiteral }}; IS {{ data.comment|qtLiteral }};
{% endif %} {% endif %}
{% if data.providers and data.providers|length > 0 %} {% if data.seclabels and data.seclabels|length > 0 %}
{% for r in data.providers %} {% for r in data.seclabels %}
{{ SECLABLE.APPLY(conn, 'EVENT TRIGGER', data.name, r.provider, r.securitylabel) }} {{ SECLABEL.APPLY(conn, 'EVENT TRIGGER', data.name, r.provider, r.label) }}
{% endfor %}{% endif %} {% endfor %}{% endif %}
ALTER EVENT TRIGGER {{ conn|qtIdent(data.name) }} ALTER EVENT TRIGGER {{ conn|qtIdent(data.name) }}

View File

@@ -4,7 +4,7 @@ e.evtenabled AS enabled,
e.evtfoid AS eventfuncoid, quote_ident(n.nspname) || '.' || e.evtfoid::regproc AS eventfunname, e.evtfoid AS eventfuncoid, quote_ident(n.nspname) || '.' || e.evtfoid::regproc AS eventfunname,
array_to_string(array(select quote_literal(x) from unnest(evttags) as t(x)), ', ') AS when, array_to_string(array(select quote_literal(x) from unnest(evttags) as t(x)), ', ') AS when,
pg_catalog.obj_description(e.oid, 'pg_event_trigger') AS comment, pg_catalog.obj_description(e.oid, 'pg_event_trigger') AS comment,
(SELECT array_agg(provider || '=' || label) FROM pg_shseclabel sl1 WHERE sl1.objoid=e.oid) AS seclabels, (SELECT array_agg(provider || '=' || label) FROM pg_seclabel sl1 WHERE sl1.objoid=e.oid) AS seclabels,
p.prosrc AS source, p.pronamespace AS schemaoid, l.lanname AS language p.prosrc AS source, p.pronamespace AS schemaoid, l.lanname AS language
FROM pg_event_trigger e FROM pg_event_trigger e
LEFT OUTER JOIN pg_proc p ON p.oid=e.evtfoid LEFT OUTER JOIN pg_proc p ON p.oid=e.evtfoid

View File

@@ -1,4 +1,4 @@
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/security.macros' as SECLABEL %}
{% if data %} {% if data %}
{% if (data.eventfunname and data.eventfunname != o_data.eventfunname) or {% if (data.eventfunname and data.eventfunname != o_data.eventfunname) or
(data.eventname and data.eventname != o_data.eventname) or (data.eventname and data.eventname != o_data.eventname) or
@@ -37,25 +37,25 @@ ALTER EVENT TRIGGER {{ conn|qtIdent(data.name) }}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if data.providers and {% if data.seclabels and
data.providers|length > 0 data.seclabels|length > 0
%}{% set seclabels = data.providers %} %}{% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.DROP(conn, 'EVENT TRIGGER', data.name, r.provider) }} {{ SECLABEL.DROP(conn, 'EVENT TRIGGER', data.name, r.provider) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.APPLY(conn, 'EVENT TRIGGER', data.name, r.provider, r.securitylabel) }} {{ SECLABEL.APPLY(conn, 'EVENT TRIGGER', data.name, r.provider, r.label) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.APPLY(conn, 'EVENT TRIGGER', data.name, r.provider, r.securitylabel) }} {{ SECLABEL.APPLY(conn, 'EVENT TRIGGER', data.name, r.provider, r.label) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %} {% endif %}

View File

@@ -325,6 +325,19 @@ class LanguageView(PGChildNodeView):
else: else:
res['rows'][0][row['deftype']] = [priv] res['rows'][0][row['deftype']] = [priv]
seclabels = []
if 'seclabels' in res['rows'][0] and res['rows'][0]['seclabels'] is not None:
import re
for sec in res['rows'][0]['seclabels']:
sec = re.search(r'([^=]+)=(.*$)', sec)
seclabels.append({
'provider': sec.group(1),
'label': sec.group(2)
})
res['rows'][0]['seclabels'] = seclabels
return ajax_response( return ajax_response(
response=res['rows'][0], response=res['rows'][0],
status=200 status=200
@@ -439,7 +452,7 @@ class LanguageView(PGChildNodeView):
data[arg] = old_data[arg] data[arg] = old_data[arg]
sql = render_template("/".join([self.template_path, 'update.sql']), data=data, sql = render_template("/".join([self.template_path, 'update.sql']), data=data,
o_data=old_data, conn=self.conn) o_data=old_data, conn=self.conn)
return sql return sql.strip('\n')
except Exception as e: except Exception as e:
return internal_server_error(errormsg=str(e)) return internal_server_error(errormsg=str(e))
@@ -480,9 +493,33 @@ class LanguageView(PGChildNodeView):
# Making copy of output for future use # Making copy of output for future use
old_data = dict(res['rows'][0]) old_data = dict(res['rows'][0])
sql = render_template("/".join([self.template_path, 'acl.sql']), lid=lid)
status, result = self.conn.execute_dict(sql)
if not status:
return internal_server_error(errormsg=result)
for row in result['rows']:
priv = parse_priv_from_db(row)
if row['deftype'] in old_data:
old_data[row['deftype']].append(priv)
else:
old_data[row['deftype']] = [priv]
seclabels = []
if 'seclabels' in old_data and old_data['seclabels'] is not None:
import re
for sec in old_data['seclabels']:
sec = re.search(r'([^=]+)=(.*$)', sec)
seclabels.append({
'provider': sec.group(1),
'label': sec.group(2)
})
old_data['seclabels'] = seclabels
sql = render_template("/".join([self.template_path, 'sqlpane.sql']), data=old_data, conn=self.conn) sql = render_template("/".join([self.template_path, 'sqlpane.sql']), data=old_data, conn=self.conn)
return ajax_response(response=sql) return ajax_response(response=sql.strip('\n'))
@check_precondition @check_precondition
def dependents(self, gid, sid, did, lid): def dependents(self, gid, sid, did, lid):

View File

@@ -3,8 +3,7 @@ SELECT
array_to_string(lanacl::text[], ', ') as acl, hp.proname as lanproc, array_to_string(lanacl::text[], ', ') as acl, hp.proname as lanproc,
vp.proname as lanval, description, vp.proname as lanval, description,
pg_get_userbyid(lan.lanowner) as lanowner, ip.proname as laninl, pg_get_userbyid(lan.lanowner) as lanowner, ip.proname as laninl,
(SELECT array_agg(label) FROM pg_seclabels sl1 WHERE sl1.objoid=lan.oid) AS labels, (SELECT array_agg(provider || '=' || label) FROM pg_seclabel sl1 WHERE sl1.objoid=lan.oid) AS seclabels
(SELECT array_agg(provider) FROM pg_seclabels sl2 WHERE sl2.objoid=lan.oid) AS providers
FROM FROM
pg_language lan JOIN pg_proc hp ON hp.oid=lanplcallfoid pg_language lan JOIN pg_proc hp ON hp.oid=lanplcallfoid
LEFT OUTER JOIN pg_proc ip ON ip.oid=laninline LEFT OUTER JOIN pg_proc ip ON ip.oid=laninline

View File

@@ -1,3 +1,5 @@
{% import 'macros/privilege.macros' as PRIVILEGE %}
{% import 'macros/security.macros' as SECLABEL %}
-- Language: {{data.name}} -- Language: {{data.name}}
-- DROP LANGUAGE {{ conn|qtIdent(data.name) }} -- DROP LANGUAGE {{ conn|qtIdent(data.name) }}
@@ -12,15 +14,29 @@ CREATE {% if data.trusted %}TRUSTED{% endif %} PROCEDURAL LANGUAGE {{ conn|qtIde
{% endif %} {% endif %}
{% if data.lanval %} {% if data.lanval %}
VALIDATOR {{ conn|qtIdent(data.lanval) }}{% endif %}; VALIDATOR {{ conn|qtIdent(data.lanval) }}{% endif %};
{# ============= ALTER LANGUAGE Query ============= #}
{# ============= ALTER LANGUAGE Query ============= #}
{% if data.lanowner %} {% if data.lanowner %}
ALTER LANGUAGE {{ conn|qtIdent(data.name) }} ALTER LANGUAGE {{ conn|qtIdent(data.name) }}
OWNER TO {{ conn|qtIdent(data.lanowner) }}; OWNER TO {{ conn|qtIdent(data.lanowner) }};
{% endif %} {% endif %}
{# ============= Comment on LANGUAGE Query ============= #} {# ============= Comment on LANGUAGE Query ============= #}
{% if data.description %} {% if data.description %}
COMMENT ON LANGUAGE {{ conn|qtIdent(data.name) }} COMMENT ON LANGUAGE {{ conn|qtIdent(data.name) }}
IS {{ data.description|qtLiteral }}; IS {{ data.description|qtLiteral }};
{% endif %}
{# ============= PRIVILEGES on LANGUAGE ============= #}
{% if data.lanacl and data.lanacl|length > 0 %}
{% for priv in data.lanacl %}
{{ PRIVILEGE.RESETALL(conn, 'LANGUAGE', priv.grantee, data.name) }}
{% endfor %}
{% endif %}
{# ============= PRIVILEGES on LANGUAGE ============= #}
{% if data.seclabels and data.seclabels|length > 0 %}
{% for r in data.seclabels %}
{{ SECLABEL.APPLY(conn, 'PROCEDURAL LANGUAGE', data.name, r.provider, r.label) }}
{% endfor %}
{% endif %} {% endif %}

View File

@@ -1,4 +1,5 @@
{% import 'macros/privilege.macros' as PRIVILEGE %} {% import 'macros/privilege.macros' as PRIVILEGE %}
{% import 'macros/security.macros' as SECLABEL %}
{% if data %} {% if data %}
{# ============= Update language name ============= #} {# ============= Update language name ============= #}
{% if data.name != o_data.name %} {% if data.name != o_data.name %}
@@ -35,4 +36,27 @@ COMMENT ON LANGUAGE {{ conn|qtIdent(data.name) }}
{{ PRIVILEGE.APPLY(conn, 'LANGUAGE', priv.grantee, data.name, priv.without_grant, priv.with_grant) }} {{ PRIVILEGE.APPLY(conn, 'LANGUAGE', priv.grantee, data.name, priv.without_grant, priv.with_grant) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %}
{% if data.seclabels and
data.seclabels|length > 0
%}{% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %}
{{ SECLABEL.DROP(conn, 'PROCEDURAL LANGUAGE', data.name, r.provider) }}
{% endfor %}
{% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %}
{{ SECLABEL.APPLY(conn, 'PROCEDURAL LANGUAGE', data.name, r.provider, r.label) }}
{% endfor %}
{% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %}
{{ SECLABEL.APPLY(conn, 'PROCEDURAL LANGUAGE', data.name, r.provider, r.label) }}
{% endfor %}
{% endif %}
{% endif %} {% endif %}

View File

@@ -3,8 +3,7 @@ SELECT
array_to_string(lanacl::text[], ', ') as acl, hp.proname as lanproc, array_to_string(lanacl::text[], ', ') as acl, hp.proname as lanproc,
vp.proname as lanval, description, vp.proname as lanval, description,
pg_get_userbyid(lan.lanowner) as lanowner, ip.proname as laninl, pg_get_userbyid(lan.lanowner) as lanowner, ip.proname as laninl,
(SELECT array_agg(label) FROM pg_seclabels sl1 WHERE sl1.objoid=lan.oid) AS labels, (SELECT array_agg(provider || '=' || label) FROM pg_seclabel sl1 WHERE sl1.objoid=lan.oid) AS seclabels
(SELECT array_agg(provider) FROM pg_seclabels sl2 WHERE sl2.objoid=lan.oid) AS providers
FROM FROM
pg_language lan JOIN pg_proc hp ON hp.oid=lanplcallfoid pg_language lan JOIN pg_proc hp ON hp.oid=lanplcallfoid
LEFT OUTER JOIN pg_proc ip ON ip.oid=laninline LEFT OUTER JOIN pg_proc ip ON ip.oid=laninline

View File

@@ -1,3 +1,5 @@
{% import 'macros/privilege.macros' as PRIVILEGE %}
{% import 'macros/security.macros' as SECLABEL %}
-- Language: {{data.name}} -- Language: {{data.name}}
-- DROP LANGUAGE {{ conn|qtIdent(data.name) }} -- DROP LANGUAGE {{ conn|qtIdent(data.name) }}
@@ -12,15 +14,29 @@ CREATE {% if data.trusted %}TRUSTED{% endif %} PROCEDURAL LANGUAGE {{ conn|qtIde
{% endif %} {% endif %}
{% if data.lanval %} {% if data.lanval %}
VALIDATOR {{ conn|qtIdent(data.lanval) }}{% endif %}; VALIDATOR {{ conn|qtIdent(data.lanval) }}{% endif %};
{# ============= ALTER LANGUAGE Query ============= #}
{# ============= ALTER LANGUAGE Query ============= #}
{% if data.lanowner %} {% if data.lanowner %}
ALTER LANGUAGE {{ conn|qtIdent(data.name) }} ALTER LANGUAGE {{ conn|qtIdent(data.name) }}
OWNER TO {{ conn|qtIdent(data.lanowner) }}; OWNER TO {{ conn|qtIdent(data.lanowner) }};
{% endif %} {% endif %}
{# ============= Comment on LANGUAGE Query ============= #} {# ============= Comment on LANGUAGE Query ============= #}
{% if data.description %} {% if data.description %}
COMMENT ON LANGUAGE {{ conn|qtIdent(data.name) }} COMMENT ON LANGUAGE {{ conn|qtIdent(data.name) }}
IS {{ data.description|qtLiteral }}; IS {{ data.description|qtLiteral }};
{% endif %}
{# ============= PRIVILEGES on LANGUAGE ============= #}
{% if data.lanacl and data.lanacl|length > 0 %}
{% for priv in data.lanacl %}
{{ PRIVILEGE.RESETALL(conn, 'LANGUAGE', priv.grantee, data.name) }}
{% endfor %}
{% endif %}
{# ============= PRIVILEGES on LANGUAGE ============= #}
{% if data.seclabels and data.seclabels|length > 0 %}
{% for r in data.seclabels %}
{{ SECLABEL.APPLY(conn, 'PROCEDURAL LANGUAGE', data.name, r.provider, r.label) }}
{% endfor %}
{% endif %} {% endif %}

View File

@@ -1,4 +1,5 @@
{% import 'macros/privilege.macros' as PRIVILEGE %} {% import 'macros/privilege.macros' as PRIVILEGE %}
{% import 'macros/security.macros' as SECLABEL %}
{% if data %} {% if data %}
{# ============= Update language name ============= #} {# ============= Update language name ============= #}
{% if data.name != o_data.name %} {% if data.name != o_data.name %}
@@ -35,4 +36,27 @@ COMMENT ON LANGUAGE {{ conn|qtIdent(data.name) }}
{{ PRIVILEGE.APPLY(conn, 'LANGUAGE', priv.grantee, data.name, priv.without_grant, priv.with_grant) }} {{ PRIVILEGE.APPLY(conn, 'LANGUAGE', priv.grantee, data.name, priv.without_grant, priv.with_grant) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %}
{% if data.seclabels and
data.seclabels|length > 0
%}{% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %}
{{ SECLABEL.DROP(conn, 'PROCEDURAL LANGUAGE', data.name, r.provider) }}
{% endfor %}
{% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %}
{{ SECLABEL.APPLY(conn, 'PROCEDURAL LANGUAGE', data.name, r.provider, r.label) }}
{% endfor %}
{% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %}
{{ SECLABEL.APPLY(conn, 'PROCEDURAL LANGUAGE', data.name, r.provider, r.label) }}
{% endfor %}
{% endif %}
{% endif %} {% endif %}

View File

@@ -1,4 +1,4 @@
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% if data %} {% if data %}
CREATE DOMAIN {{ conn|qtIdent(data.basensp, data.name) }} CREATE DOMAIN {{ conn|qtIdent(data.basensp, data.name) }}
AS {{ conn|qtTypeIdent(data.basetype) }}{% if data.typlen %}({{data.typlen}}{% if data.precision %},{{data.precision}}{% endif %}){% endif %}{% if data.collname %} AS {{ conn|qtTypeIdent(data.basetype) }}{% if data.typlen %}({{data.typlen}}{% if data.precision %},{{data.precision}}{% endif %}){% endif %}{% if data.collname %}
@@ -23,7 +23,7 @@ COMMENT ON DOMAIN {{ conn|qtIdent(data.basensp, data.name) }}
{% if r.label and r.provider %} {% if r.label and r.provider %}
{{ SECLABLE.SET(conn, 'DOMAIN', data.name, r.provider, r.label, data.basensp) }}{% endif -%} {{ SECLABEL.SET(conn, 'DOMAIN', data.name, r.provider, r.label, data.basensp) }}{% endif -%}
{% endfor -%} {% endfor -%}
{% endif -%} {% endif -%}

View File

@@ -1,4 +1,4 @@
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% if data %} {% if data %}
{% set name = o_data.name %} {% set name = o_data.name %}
{% if data.name %} {% if data.name %}
@@ -43,19 +43,19 @@ ALTER DOMAIN {{ conn|qtIdent(o_data.basensp, name) }}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.UNSET(conn, 'DOMAIN', name, r.provider, o_data.basensp) }} {{ SECLABEL.UNSET(conn, 'DOMAIN', name, r.provider, o_data.basensp) }}
{% endfor -%} {% endfor -%}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.SET(conn, 'DOMAIN', name, r.provider, r.label, o_data.basensp) }} {{ SECLABEL.SET(conn, 'DOMAIN', name, r.provider, r.label, o_data.basensp) }}
{% endfor -%} {% endfor -%}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.SET(conn, 'DOMAIN', name, r.provider, r.label, o_data.basensp) }} {{ SECLABEL.SET(conn, 'DOMAIN', name, r.provider, r.label, o_data.basensp) }}
{% endfor -%} {% endfor -%}
{% endif -%}{% if data.description is defined and data.description != o_data.description %} {% endif -%}{% if data.description is defined and data.description != o_data.description %}

View File

@@ -1,4 +1,4 @@
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% if data %} {% if data %}
CREATE DOMAIN {{ conn|qtIdent(data.basensp, data.name) }} CREATE DOMAIN {{ conn|qtIdent(data.basensp, data.name) }}
AS {{ conn|qtTypeIdent(data.basetype) }}{% if data.typlen %}({{data.typlen}}{% if data.precision %},{{data.precision}}{% endif %}){% endif %}{% if data.collname and data.collname != "pg_catalog.\"default\"" %} AS {{ conn|qtTypeIdent(data.basetype) }}{% if data.typlen %}({{data.typlen}}{% if data.precision %},{{data.precision}}{% endif %}){% endif %}{% if data.collname and data.collname != "pg_catalog.\"default\"" %}
@@ -29,7 +29,7 @@ COMMENT ON DOMAIN {{ conn|qtIdent(data.basensp, data.name) }}
{% if r.label and r.provider %} {% if r.label and r.provider %}
{{ SECLABLE.SET(conn, 'DOMAIN', data.name, r.provider, r.label, data.basensp) }}{% endif -%} {{ SECLABEL.SET(conn, 'DOMAIN', data.name, r.provider, r.label, data.basensp) }}{% endif -%}
{% endfor -%} {% endfor -%}
{% endif -%} {% endif -%}

View File

@@ -10,7 +10,7 @@ SELECT
(SELECT (SELECT
array_agg(provider || '=' || label) array_agg(provider || '=' || label)
FROM FROM
pg_shseclabel sl1 pg_seclabel sl1
WHERE WHERE
sl1.objoid=d.oid) AS seclabels sl1.objoid=d.oid) AS seclabels
FROM FROM

View File

@@ -1,4 +1,4 @@
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% if data %} {% if data %}
{% set name = o_data.name %} {% set name = o_data.name %}
{% if data.name %} {% if data.name %}
@@ -55,19 +55,19 @@ ALTER DOMAIN {{ conn|qtIdent(o_data.basensp, name) }}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.UNSET(conn, 'DOMAIN', name, r.provider, o_data.basensp) }} {{ SECLABEL.UNSET(conn, 'DOMAIN', name, r.provider, o_data.basensp) }}
{% endfor %} {% endfor %}
{% endif -%} {% endif -%}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.SET(conn, 'DOMAIN', name, r.provider, r.label, o_data.basensp) }} {{ SECLABEL.SET(conn, 'DOMAIN', name, r.provider, r.label, o_data.basensp) }}
{% endfor %} {% endfor %}
{% endif -%}{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% endif -%}{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.SET(conn, 'DOMAIN', name, r.provider, r.label, o_data.basensp) }} {{ SECLABEL.SET(conn, 'DOMAIN', name, r.provider, r.label, o_data.basensp) }}
{% endfor %} {% endfor %}
{% endif -%}{% if data.description is defined and data.description != o_data.description %} {% endif -%}{% if data.description is defined and data.description != o_data.description %}

View File

@@ -1,4 +1,4 @@
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% if data %} {% if data %}
CREATE FOREIGN TABLE {{ conn|qtIdent(data.basensp, data.name) }}( CREATE FOREIGN TABLE {{ conn|qtIdent(data.basensp, data.name) }}(
{% if data.columns %} {% if data.columns %}
@@ -29,7 +29,7 @@ COMMENT ON FOREIGN TABLE {{ conn|qtIdent(data.basensp, data.name) }}
{% for r in data.seclabels %} {% for r in data.seclabels %}
{% if r.label and r.provider %} {% if r.label and r.provider %}
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', data.name, r.provider, r.label, data.basensp) }} {{ SECLABEL.SET(conn, 'FOREIGN TABLE', data.name, r.provider, r.label, data.basensp) }}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@@ -1,4 +1,4 @@
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% if data %} {% if data %}
{% set name = o_data.name %} {% set name = o_data.name %}
{% if data.name %} {% if data.name %}
@@ -81,19 +81,19 @@ ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.UNSET(conn, 'FOREIGN TABLE', name, r.provider, o_data.basensp) }} {{ SECLABEL.UNSET(conn, 'FOREIGN TABLE', name, r.provider, o_data.basensp) }}
{% endfor %} {% endfor %}
{% endif -%} {% endif -%}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }} {{ SECLABEL.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }}
{% endfor %} {% endfor %}
{% endif -%} {% endif -%}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }} {{ SECLABEL.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }}
{% endfor %} {% endfor %}
{% endif -%} {% endif -%}
{% if data.description is defined and data.description != o_data.description%} {% if data.description is defined and data.description != o_data.description%}

View File

@@ -1,4 +1,4 @@
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{% if data %} {% if data %}
CREATE FOREIGN TABLE {{ conn|qtIdent(data.basensp, data.name) }}( CREATE FOREIGN TABLE {{ conn|qtIdent(data.basensp, data.name) }}(
@@ -40,7 +40,7 @@ COMMENT ON FOREIGN TABLE {{ conn|qtIdent(data.basensp, data.name) }}
{% if data.seclabels %} {% if data.seclabels %}
{% for r in data.seclabels %}{% if r.label and r.provider %} {% for r in data.seclabels %}{% if r.label and r.provider %}
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', data.name, r.provider, r.label, data.basensp) }} {{ SECLABEL.SET(conn, 'FOREIGN TABLE', data.name, r.provider, r.label, data.basensp) }}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@@ -4,7 +4,7 @@ SELECT
(SELECT (SELECT
array_agg(provider || '=' || label) array_agg(provider || '=' || label)
FROM FROM
pg_shseclabel sl1 pg_seclabel sl1
WHERE WHERE
sl1.objoid=c.oid) AS seclabels sl1.objoid=c.oid) AS seclabels
FROM FROM

View File

@@ -1,4 +1,4 @@
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{% if data %} {% if data %}
{% set name = o_data.name %} {% set name = o_data.name %}
@@ -145,19 +145,19 @@ ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.UNSET(conn, 'FOREIGN TABLE', name, r.provider, o_data.basensp) }} {{ SECLABEL.UNSET(conn, 'FOREIGN TABLE', name, r.provider, o_data.basensp) }}
{% endfor %} {% endfor %}
{% endif -%} {% endif -%}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }} {{ SECLABEL.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }}
{% endfor %} {% endfor %}
{% endif -%} {% endif -%}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }} {{ SECLABEL.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }}
{% endfor %} {% endfor %}
{% endif -%} {% endif -%}
{% if data.description is defined and data.description != o_data.description%} {% if data.description is defined and data.description != o_data.description%}

View File

@@ -1,4 +1,4 @@
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{% set is_columns = [] %} {% set is_columns = [] %}
{% if data %} {% if data %}
@@ -57,7 +57,7 @@ COMMENT ON FOREIGN TABLE {{ conn|qtIdent(data.basensp, data.name) }}
{% for r in data.seclabels %} {% for r in data.seclabels %}
{% if r.label and r.provider %} {% if r.label and r.provider %}
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', data.name, r.provider, r.label, data.basensp) }} {{ SECLABEL.SET(conn, 'FOREIGN TABLE', data.name, r.provider, r.label, data.basensp) }}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@@ -4,7 +4,7 @@ SELECT
(SELECT (SELECT
array_agg(provider || '=' || label) array_agg(provider || '=' || label)
FROM FROM
pg_shseclabel sl1 pg_seclabel sl1
WHERE WHERE
sl1.objoid=c.oid) AS seclabels sl1.objoid=c.oid) AS seclabels
{% if foid %}, {% if foid %},

View File

@@ -1,4 +1,4 @@
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{% if data %} {% if data %}
{% set name = o_data.name %} {% set name = o_data.name %}
@@ -157,19 +157,19 @@ ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.UNSET(conn, 'FOREIGN TABLE', name, r.provider, o_data.basensp) }} {{ SECLABEL.UNSET(conn, 'FOREIGN TABLE', name, r.provider, o_data.basensp) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }} {{ SECLABEL.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }} {{ SECLABEL.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }}
{% endfor %} {% endfor %}
{% endif -%} {% endif -%}
{% if data.description is defined and data.description != o_data.description%} {% if data.description is defined and data.description != o_data.description%}

View File

@@ -307,8 +307,11 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
id: 'seclabels', label: '{{ _('Security Labels') }}', canAdd: true, id: 'seclabels', label: '{{ _('Security Labels') }}', canAdd: true,
model: pgBrowser.SecLabelModel, type: 'collection', model: pgBrowser.SecLabelModel, type: 'collection',
min_version: 90100, group: 'security', mode: ['edit', 'create'], min_version: 90100, group: 'security', mode: ['edit', 'create'],
canEdit: true, canDelete: true, uniqueCol : ['provider'], canEdit: false, canDelete: true, uniqueCol : ['provider'],
disabled: 'isDisabled', control: 'unique-col-collection' disabled: 'isDisabled', control: 'unique-col-collection',
visible: function() {
return this.node_data && this.node_data._type != 'procedure';
}
} }
], ],
validate: function() validate: function()

View File

@@ -1,4 +1,4 @@
{% import 'macros/functions/security.macros' as SECLABLE %} {% import 'macros/functions/security.macros' as SECLABEL %}
{% import 'macros/functions/privilege.macros' as PRIVILEGE %} {% import 'macros/functions/privilege.macros' as PRIVILEGE %}
{% import 'macros/functions/variable.macros' as VARIABLE %} {% import 'macros/functions/variable.macros' as VARIABLE %}
{% set is_columns = [] %} {% set is_columns = [] %}
@@ -49,7 +49,7 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
{% for r in data.seclabels %} {% for r in data.seclabels %}
{% if r.label and r.provider %} {% if r.label and r.provider %}
{{ SECLABLE.SET(conn, 'FUNCTION', data.name, r.provider, r.label, data.pronamespace, data.func_args) }} {{ SECLABEL.SET(conn, 'FUNCTION', data.name, r.provider, r.label, data.pronamespace, data.func_args) }}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif -%} {% endif -%}

View File

@@ -7,7 +7,7 @@ SELECT
(SELECT (SELECT
array_agg(provider || '=' || label) array_agg(provider || '=' || label)
FROM FROM
pg_shseclabel sl1 pg_seclabel sl1
WHERE WHERE
sl1.objoid=pr.oid) AS seclabels sl1.objoid=pr.oid) AS seclabels
FROM FROM

View File

@@ -7,7 +7,7 @@ SELECT
(SELECT (SELECT
array_agg(provider || '=' || label) array_agg(provider || '=' || label)
FROM FROM
pg_shseclabel sl1 pg_seclabel sl1
WHERE WHERE
sl1.objoid=pr.oid) AS seclabels sl1.objoid=pr.oid) AS seclabels
FROM FROM

View File

@@ -7,7 +7,7 @@ SELECT
(SELECT (SELECT
array_agg(provider || '=' || label) array_agg(provider || '=' || label)
FROM FROM
pg_shseclabel sl1 pg_seclabel sl1
WHERE WHERE
sl1.objoid=pr.oid) AS seclabels sl1.objoid=pr.oid) AS seclabels
FROM FROM

View File

@@ -7,7 +7,7 @@ SELECT
(SELECT (SELECT
array_agg(provider || '=' || label) array_agg(provider || '=' || label)
FROM FROM
pg_shseclabel sl1 pg_seclabel sl1
WHERE WHERE
sl1.objoid=pr.oid) AS seclabels sl1.objoid=pr.oid) AS seclabels
FROM FROM

View File

@@ -14,7 +14,7 @@ SELECT
(SELECT (SELECT
array_agg(provider || '=' || label) array_agg(provider || '=' || label)
FROM FROM
pg_shseclabel sl1 pg_seclabel sl1
WHERE WHERE
sl1.objoid=pr.oid) AS seclabels sl1.objoid=pr.oid) AS seclabels
FROM FROM

View File

@@ -14,7 +14,7 @@ SELECT
(SELECT (SELECT
array_agg(provider || '=' || label) array_agg(provider || '=' || label)
FROM FROM
pg_shseclabel sl1 pg_seclabel sl1
WHERE WHERE
sl1.objoid=pr.oid) AS seclabels sl1.objoid=pr.oid) AS seclabels
FROM FROM

View File

@@ -1,4 +1,4 @@
{% import 'macros/functions/security.macros' as SECLABLE %} {% import 'macros/functions/security.macros' as SECLABEL %}
{% import 'macros/functions/privilege.macros' as PRIVILEGE %} {% import 'macros/functions/privilege.macros' as PRIVILEGE %}
{% import 'macros/functions/variable.macros' as VARIABLE %} {% import 'macros/functions/variable.macros' as VARIABLE %}
{% set is_columns = [] %} {% set is_columns = [] %}
@@ -44,7 +44,7 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
{% for r in data.seclabels %} {% for r in data.seclabels %}
{% if r.label and r.provider %} {% if r.label and r.provider %}
{{ SECLABLE.SET(conn, 'FUNCTION', data.name, r.provider, r.label, data.pronamespace, data.func_args) }} {{ SECLABEL.SET(conn, 'FUNCTION', data.name, r.provider, r.label, data.pronamespace, data.func_args) }}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif -%} {% endif -%}

View File

@@ -7,7 +7,7 @@ SELECT
(SELECT (SELECT
array_agg(provider || '=' || label) array_agg(provider || '=' || label)
FROM FROM
pg_shseclabel sl1 pg_seclabel sl1
WHERE WHERE
sl1.objoid=pr.oid) AS seclabels sl1.objoid=pr.oid) AS seclabels
FROM FROM

View File

@@ -7,7 +7,7 @@ SELECT
(SELECT (SELECT
array_agg(provider || '=' || label) array_agg(provider || '=' || label)
FROM FROM
pg_shseclabel sl1 pg_seclabel sl1
WHERE WHERE
sl1.objoid=pr.oid) AS seclabels sl1.objoid=pr.oid) AS seclabels
FROM FROM

View File

@@ -7,7 +7,7 @@ SELECT
(SELECT (SELECT
array_agg(provider || '=' || label) array_agg(provider || '=' || label)
FROM FROM
pg_shseclabel sl1 pg_seclabel sl1
WHERE WHERE
sl1.objoid=pr.oid) AS seclabels sl1.objoid=pr.oid) AS seclabels
FROM FROM

View File

@@ -7,7 +7,7 @@ SELECT
(SELECT (SELECT
array_agg(provider || '=' || label) array_agg(provider || '=' || label)
FROM FROM
pg_shseclabel sl1 pg_seclabel sl1
WHERE WHERE
sl1.objoid=pr.oid) AS seclabels sl1.objoid=pr.oid) AS seclabels
FROM FROM

View File

@@ -241,16 +241,6 @@ class SequenceView(PGChildNodeView):
if not status: if not status:
return internal_server_error(errormsg=res) return internal_server_error(errormsg=res)
sec_lbls = []
if 'securities' in res and res['securities'] is not None:
for sec in res['seclabels']:
sec = re.search(r'([^=]+)=(.*$)', sec)
sec_lbls.append({
'provider': sec.group(1),
'label': sec.group(2)
})
res['securities'] = sec_lbls
for row in res['rows']: for row in res['rows']:
SQL = render_template("/".join([self.template_path, 'get_def.sql']), data=row) SQL = render_template("/".join([self.template_path, 'get_def.sql']), data=row)
status, rset1 = self.conn.execute_dict(SQL) status, rset1 = self.conn.execute_dict(SQL)
@@ -264,6 +254,17 @@ class SequenceView(PGChildNodeView):
row['cache'] = rset1['rows'][0]['cache_value'] row['cache'] = rset1['rows'][0]['cache_value']
row['cycled'] = rset1['rows'][0]['is_cycled'] row['cycled'] = rset1['rows'][0]['is_cycled']
sec_lbls = []
if 'securities' in row and row['securities'] is not None:
for sec in row['securities']:
import re
sec = re.search(r'([^=]+)=(.*$)', sec)
sec_lbls.append({
'provider': sec.group(1),
'label': sec.group(2)
})
row['securities'] = sec_lbls
SQL = render_template("/".join([self.template_path, 'acl.sql']), scid=scid, seid=seid) SQL = render_template("/".join([self.template_path, 'acl.sql']), scid=scid, seid=seid)
status, dataclres = self.conn.execute_dict(SQL) status, dataclres = self.conn.execute_dict(SQL)
if not status: if not status:

View File

@@ -1,4 +1,4 @@
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{# Construct sequence name from name and schema #} {# Construct sequence name from name and schema #}
{% set seqname=conn|qtIdent(data.schema, data.name) %} {% set seqname=conn|qtIdent(data.schema, data.name) %}
@@ -15,7 +15,7 @@ COMMENT ON SEQUENCE {{ seqname }}
{% if data.securities %} {% if data.securities %}
{% for r in data.securities %} {% for r in data.securities %}
{{ SECLABLE.SET(conn, 'SEQUENCE', data.name, r.provider, r.label, data.schema) }} {{ SECLABEL.SET(conn, 'SEQUENCE', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if data.relacl %} {% if data.relacl %}

View File

@@ -1,4 +1,4 @@
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{% if data %} {% if data %}
{% if data.name != o_data.name %} {% if data.name != o_data.name %}
@@ -58,17 +58,17 @@ COMMENT ON SEQUENCE {{ seqname }}
{% set seclabels = data.securities %} {% set seclabels = data.securities %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.UNSET(conn, 'SEQUENCE', data.name, r.provider, schema) }} {{ SECLABEL.UNSET(conn, 'SEQUENCE', data.name, r.provider, schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.SET(conn, 'SEQUENCE', data.name, r.provider, r.label, schema) }} {{ SECLABEL.SET(conn, 'SEQUENCE', data.name, r.provider, r.label, schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.SET(conn, 'SEQUENCE', data.name, r.provider, r.label, schema) }} {{ SECLABEL.SET(conn, 'SEQUENCE', data.name, r.provider, r.label, schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %} {% endif %}

View File

@@ -1,4 +1,4 @@
{% import 'column/macros/security.macros' as SECLABLE %} {% import 'column/macros/security.macros' as SECLABEL %}
{% import 'column/macros/privilege.macros' as PRIVILEGE %} {% import 'column/macros/privilege.macros' as PRIVILEGE %}
{% import 'macros/variable.macros' as VARIABLE %} {% import 'macros/variable.macros' as VARIABLE %}
{### Add column ###} {### Add column ###}
@@ -33,6 +33,6 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
{### Security Lables ###} {### Security Lables ###}
{% if data.seclabels %} {% if data.seclabels %}
{% for r in data.seclabels %} {% for r in data.seclabels %}
{{ SECLABLE.APPLY(conn, 'COLUMN',data.schema, data.table, data.name, r.provider, r.label) }} {{ SECLABEL.APPLY(conn, 'COLUMN',data.schema, data.table, data.name, r.provider, r.label) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@@ -18,7 +18,7 @@ SELECT att.attname as name, att.*, def.*, pg_catalog.pg_get_expr(def.adbin, def.
ELSE format_type(ty.oid,att.atttypmod) END AS cltype, ELSE format_type(ty.oid,att.atttypmod) END AS cltype,
-- End pgAdmin4 -- End pgAdmin4
EXISTS(SELECT 1 FROM pg_constraint WHERE conrelid=att.attrelid AND contype='f' AND att.attnum=ANY(conkey)) As is_fk, EXISTS(SELECT 1 FROM pg_constraint WHERE conrelid=att.attrelid AND contype='f' AND att.attnum=ANY(conkey)) As is_fk,
(SELECT array_agg(provider || '=' || label) FROM pg_seclabels sl1 WHERE sl1.objoid=att.atttypid AND sl1.objsubid=0) AS seclabels, (SELECT array_agg(provider || '=' || label) FROM pg_seclabels sl1 WHERE WHERE sl1.objoid=att.attrelid AND sl1.objsubid=att.attnum) AS seclabels,
(CASE WHEN (att.attnum < 1) THEN true ElSE false END) AS is_sys_column (CASE WHEN (att.attnum < 1) THEN true ElSE false END) AS is_sys_column
FROM pg_attribute att FROM pg_attribute att
JOIN pg_type ty ON ty.oid=atttypid JOIN pg_type ty ON ty.oid=atttypid

View File

@@ -1,4 +1,4 @@
{% import 'column/macros/security.macros' as SECLABLE %} {% import 'column/macros/security.macros' as SECLABEL %}
{% import 'column/macros/privilege.macros' as PRIVILEGE %} {% import 'column/macros/privilege.macros' as PRIVILEGE %}
{% import 'macros/variable.macros' as VARIABLE %} {% import 'macros/variable.macros' as VARIABLE %}
{### Rename column name ###} {### Rename column name ###}
@@ -90,17 +90,17 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.DROP(conn, 'COLUMN', data.schema, data.table, data.name, r.provider) }} {{ SECLABEL.DROP(conn, 'COLUMN', data.schema, data.table, data.name, r.provider) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.APPLY(conn, 'COLUMN',data.schema, data.table, data.name, r.provider, r.label) }} {{ SECLABEL.APPLY(conn, 'COLUMN',data.schema, data.table, data.name, r.provider, r.label) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.APPLY(conn, 'COLUMN',data.schema, data.table, data.name, r.provider, r.label) }} {{ SECLABEL.APPLY(conn, 'COLUMN',data.schema, data.table, data.name, r.provider, r.label) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@@ -1,4 +1,4 @@
{% import 'column/macros/security.macros' as SECLABLE %} {% import 'column/macros/security.macros' as SECLABEL %}
{% import 'column/macros/privilege.macros' as PRIVILEGE %} {% import 'column/macros/privilege.macros' as PRIVILEGE %}
{% import 'macros/variable.macros' as VARIABLE %} {% import 'macros/variable.macros' as VARIABLE %}
{### Add column ###} {### Add column ###}
@@ -33,6 +33,6 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
{### Security Lables ###} {### Security Lables ###}
{% if data.seclabels %} {% if data.seclabels %}
{% for r in data.seclabels %} {% for r in data.seclabels %}
{{ SECLABLE.APPLY(conn, 'COLUMN',data.schema, data.table, data.name, r.provider, r.label) }} {{ SECLABEL.APPLY(conn, 'COLUMN',data.schema, data.table, data.name, r.provider, r.label) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@@ -18,7 +18,7 @@ SELECT att.attname as name, att.*, def.*, pg_catalog.pg_get_expr(def.adbin, def.
ELSE format_type(ty.oid,att.atttypmod) END AS cltype, ELSE format_type(ty.oid,att.atttypmod) END AS cltype,
-- End pgAdmin4 -- End pgAdmin4
EXISTS(SELECT 1 FROM pg_constraint WHERE conrelid=att.attrelid AND contype='f' AND att.attnum=ANY(conkey)) As is_fk, EXISTS(SELECT 1 FROM pg_constraint WHERE conrelid=att.attrelid AND contype='f' AND att.attnum=ANY(conkey)) As is_fk,
(SELECT array_agg(provider || '=' || label) FROM pg_seclabels sl1 WHERE sl1.objoid=att.atttypid AND sl1.objsubid=0) AS seclabels, (SELECT array_agg(provider || '=' || label) FROM pg_seclabels sl1 WHERE sl1.objoid=att.attrelid AND sl1.objsubid=att.attnum) AS seclabels,
(CASE WHEN (att.attnum < 1) THEN true ElSE false END) AS is_sys_column (CASE WHEN (att.attnum < 1) THEN true ElSE false END) AS is_sys_column
FROM pg_attribute att FROM pg_attribute att
JOIN pg_type ty ON ty.oid=atttypid JOIN pg_type ty ON ty.oid=atttypid

View File

@@ -1,4 +1,4 @@
{% import 'column/macros/security.macros' as SECLABLE %} {% import 'column/macros/security.macros' as SECLABEL %}
{% import 'column/macros/privilege.macros' as PRIVILEGE %} {% import 'column/macros/privilege.macros' as PRIVILEGE %}
{% import 'macros/variable.macros' as VARIABLE %} {% import 'macros/variable.macros' as VARIABLE %}
{### Rename column name ###} {### Rename column name ###}
@@ -89,17 +89,17 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.DROP(conn, 'COLUMN', data.schema, data.table, data.name, r.provider) }} {{ SECLABEL.DROP(conn, 'COLUMN', data.schema, data.table, data.name, r.provider) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.APPLY(conn, 'COLUMN',data.schema, data.table, data.name, r.provider, r.label) }} {{ SECLABEL.APPLY(conn, 'COLUMN',data.schema, data.table, data.name, r.provider, r.label) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.APPLY(conn, 'COLUMN',data.schema, data.table, data.name, r.provider, r.label) }} {{ SECLABEL.APPLY(conn, 'COLUMN',data.schema, data.table, data.name, r.provider, r.label) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %} {% endif %}

View File

@@ -1,7 +1,7 @@
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{% import 'macros/variable.macros' as VARIABLE %} {% import 'macros/variable.macros' as VARIABLE %}
{% import 'column/macros/security.macros' as COLUMN_SECLABLE %} {% import 'column/macros/security.macros' as COLUMN_SECLABEL %}
{% import 'column/macros/privilege.macros' as COLUMN_PRIVILEGE %} {% import 'column/macros/privilege.macros' as COLUMN_PRIVILEGE %}
{% import 'table/sql/macros/constraints.macro' as CONSTRAINTS %} {% import 'table/sql/macros/constraints.macro' as CONSTRAINTS %}
{#===========================================#} {#===========================================#}
@@ -94,7 +94,7 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
{% if data.seclabels and data.seclabels|length > 0 %} {% if data.seclabels and data.seclabels|length > 0 %}
{% for r in data.seclabels %} {% for r in data.seclabels %}
{{ SECLABLE.SET(conn, 'TABLE', data.name, r.provider, r.label, data.schema) }} {{ SECLABEL.SET(conn, 'TABLE', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{### ACL on Table ###} {### ACL on Table ###}
@@ -139,7 +139,7 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
{% if c.seclabels and c.seclabels|length > 0 %} {% if c.seclabels and c.seclabels|length > 0 %}
{% for r in c.seclabels %} {% for r in c.seclabels %}
{{ COLUMN_SECLABLE.APPLY(conn, 'COLUMN',data.schema, data.name, c.name, r.provider, r.label) }} {{ COLUMN_SECLABEL.APPLY(conn, 'COLUMN',data.schema, data.name, c.name, r.provider, r.label) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}

View File

@@ -1,4 +1,4 @@
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{% import 'macros/variable.macros' as VARIABLE %} {% import 'macros/variable.macros' as VARIABLE %}
{#####################################################} {#####################################################}
@@ -189,12 +189,12 @@ COMMENT ON TABLE {{conn|qtIdent(data.schema, data.name)}}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.SET(conn, 'TABLE', data.name, r.provider, r.label, data.schema) }} {{ SECLABEL.SET(conn, 'TABLE', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.SET(conn, 'TABLE', data.name, r.provider, r.label, data.schema) }} {{ SECLABEL.SET(conn, 'TABLE', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@@ -1,7 +1,7 @@
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{% import 'macros/variable.macros' as VARIABLE %} {% import 'macros/variable.macros' as VARIABLE %}
{% import 'column/macros/security.macros' as COLUMN_SECLABLE %} {% import 'column/macros/security.macros' as COLUMN_SECLABEL %}
{% import 'column/macros/privilege.macros' as COLUMN_PRIVILEGE %} {% import 'column/macros/privilege.macros' as COLUMN_PRIVILEGE %}
{% import 'table/sql/macros/constraints.macro' as CONSTRAINTS %} {% import 'table/sql/macros/constraints.macro' as CONSTRAINTS %}
{#===========================================#} {#===========================================#}
@@ -94,7 +94,7 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
{% if data.seclabels and data.seclabels|length > 0 %} {% if data.seclabels and data.seclabels|length > 0 %}
{% for r in data.seclabels %} {% for r in data.seclabels %}
{{ SECLABLE.SET(conn, 'TABLE', data.name, r.provider, r.label, data.schema) }} {{ SECLABEL.SET(conn, 'TABLE', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{### ACL on Table ###} {### ACL on Table ###}
@@ -139,7 +139,7 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
{% if c.seclabels and c.seclabels|length > 0 %} {% if c.seclabels and c.seclabels|length > 0 %}
{% for r in c.seclabels %} {% for r in c.seclabels %}
{{ COLUMN_SECLABLE.APPLY(conn, 'COLUMN',data.schema, data.name, c.name, r.provider, r.label) }} {{ COLUMN_SECLABEL.APPLY(conn, 'COLUMN',data.schema, data.name, c.name, r.provider, r.label) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}

View File

@@ -1,4 +1,4 @@
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{% import 'macros/variable.macros' as VARIABLE %} {% import 'macros/variable.macros' as VARIABLE %}
{#####################################################} {#####################################################}
@@ -189,12 +189,12 @@ COMMENT ON TABLE {{conn|qtIdent(data.schema, data.name)}}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.SET(conn, 'TABLE', data.name, r.provider, r.label, data.schema) }} {{ SECLABEL.SET(conn, 'TABLE', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.SET(conn, 'TABLE', data.name, r.provider, r.label, data.schema) }} {{ SECLABEL.SET(conn, 'TABLE', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@@ -1,4 +1,4 @@
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/security.macros' as SECLABEL %}
{% if data %} {% if data %}
{# ==== To update catalog comments ==== #} {# ==== To update catalog comments ==== #}
{% if data.description and data.description != o_data.description %} {% if data.description and data.description != o_data.description %}
@@ -12,17 +12,17 @@ COMMENT ON SCHEMA {{ conn|qtIdent(o_data.name) }}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.DROP(conn, 'SCHEMA', o_data.name, r.provider) }} {{ SECLABEL.DROP(conn, 'SCHEMA', o_data.name, r.provider) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }} {{ SECLABEL.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }} {{ SECLABEL.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@@ -1,4 +1,4 @@
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/security.macros' as SECLABEL %}
{% if data %} {% if data %}
{# ==== To update catalog comments ==== #} {# ==== To update catalog comments ==== #}
{% if data.description and data.description != o_data.description %} {% if data.description and data.description != o_data.description %}
@@ -12,17 +12,17 @@ COMMENT ON SCHEMA {{ conn|qtIdent(o_data.name) }}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.DROP(conn, 'SCHEMA', o_data.name, r.provider) }} {{ SECLABEL.DROP(conn, 'SCHEMA', o_data.name, r.provider) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }} {{ SECLABEL.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }} {{ SECLABEL.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@@ -11,7 +11,8 @@ SELECT
ELSE false END AS is_sys_object, ELSE false END AS is_sys_object,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'r' AND defaclnamespace = nsp.oid) AS tblacl, (SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'r' AND defaclnamespace = nsp.oid) AS tblacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'S' AND defaclnamespace = nsp.oid) AS seqacl, (SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'S' AND defaclnamespace = nsp.oid) AS seqacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'f' AND defaclnamespace = nsp.oid) AS funcacl (SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'f' AND defaclnamespace = nsp.oid) AS funcacl,
(SELECT array_agg(provider || '=' || label) FROM pg_seclabels sl1 WHERE sl1.objoid=nsp.oid) AS seclabels
FROM FROM
pg_namespace nsp pg_namespace nsp
LEFT OUTER JOIN pg_description des ON LEFT OUTER JOIN pg_description des ON

View File

@@ -1,4 +1,4 @@
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/security.macros' as SECLABEL %}
{% if data %} {% if data %}
{# ==== To update catalog comments ==== #} {# ==== To update catalog comments ==== #}
{% if data.description and data.description != o_data.description %} {% if data.description and data.description != o_data.description %}
@@ -12,17 +12,17 @@ COMMENT ON SCHEMA {{ conn|qtIdent(o_data.name) }}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.DROP(conn, 'SCHEMA', o_data.name, r.provider) }} {{ SECLABEL.DROP(conn, 'SCHEMA', o_data.name, r.provider) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }} {{ SECLABEL.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }} {{ SECLABEL.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@@ -12,7 +12,8 @@ SELECT
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'r' AND defaclnamespace = nsp.oid) AS tblacl, (SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'r' AND defaclnamespace = nsp.oid) AS tblacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'S' AND defaclnamespace = nsp.oid) AS seqacl, (SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'S' AND defaclnamespace = nsp.oid) AS seqacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'f' AND defaclnamespace = nsp.oid) AS funcacl, (SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'f' AND defaclnamespace = nsp.oid) AS funcacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'T' AND defaclnamespace = nsp.oid) AS typeacl (SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'T' AND defaclnamespace = nsp.oid) AS typeacl,
(SELECT array_agg(provider || '=' || label) FROM pg_seclabels sl1 WHERE sl1.objoid=nsp.oid) AS seclabels
FROM FROM
pg_namespace nsp pg_namespace nsp
LEFT OUTER JOIN pg_description des ON LEFT OUTER JOIN pg_description des ON

View File

@@ -1,4 +1,4 @@
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/security.macros' as SECLABEL %}
{% if data %} {% if data %}
{# ==== To update catalog comments ==== #} {# ==== To update catalog comments ==== #}
{% if data.description and data.description != o_data.description %} {% if data.description and data.description != o_data.description %}
@@ -12,17 +12,17 @@ COMMENT ON SCHEMA {{ conn|qtIdent(o_data.name) }}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.DROP(conn, 'SCHEMA', o_data.name, r.provider) }} {{ SECLABEL.DROP(conn, 'SCHEMA', o_data.name, r.provider) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }} {{ SECLABEL.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }} {{ SECLABEL.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@@ -1,4 +1,4 @@
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/security.macros' as SECLABEL %}
{% import 'macros/privilege.macros' as PRIVILEGE %} {% import 'macros/privilege.macros' as PRIVILEGE %}
{% import 'macros/default_privilege.macros' as DEFAULT_PRIVILEGE %} {% import 'macros/default_privilege.macros' as DEFAULT_PRIVILEGE %}
{% if data.name %} {% if data.name %}

View File

@@ -14,7 +14,8 @@ SELECT
ELSE false END AS is_sys_object, ELSE false END AS is_sys_object,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'r' AND defaclnamespace = nsp.oid) AS tblacl, (SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'r' AND defaclnamespace = nsp.oid) AS tblacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'S' AND defaclnamespace = nsp.oid) AS seqacl, (SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'S' AND defaclnamespace = nsp.oid) AS seqacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'f' AND defaclnamespace = nsp.oid) AS funcacl (SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'f' AND defaclnamespace = nsp.oid) AS funcacl,
(SELECT array_agg(provider || '=' || label) FROM pg_seclabels sl1 WHERE sl1.objoid=nsp.oid) AS seclabels
FROM FROM
pg_namespace nsp pg_namespace nsp
LEFT OUTER JOIN pg_description des ON LEFT OUTER JOIN pg_description des ON

View File

@@ -15,7 +15,8 @@ SELECT
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'r' AND defaclnamespace = nsp.oid) AS tblacl, (SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'r' AND defaclnamespace = nsp.oid) AS tblacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'S' AND defaclnamespace = nsp.oid) AS seqacl, (SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'S' AND defaclnamespace = nsp.oid) AS seqacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'f' AND defaclnamespace = nsp.oid) AS funcacl, (SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'f' AND defaclnamespace = nsp.oid) AS funcacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'T' AND defaclnamespace = nsp.oid) AS typeacl (SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'T' AND defaclnamespace = nsp.oid) AS typeacl,
(SELECT array_agg(provider || '=' || label) FROM pg_seclabels sl1 WHERE sl1.objoid=nsp.oid) AS seclabels
FROM FROM
pg_namespace nsp pg_namespace nsp
LEFT OUTER JOIN pg_description des ON LEFT OUTER JOIN pg_description des ON

View File

@@ -1,4 +1,4 @@
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/security.macros' as SECLABEL %}
{% import 'macros/privilege.macros' as PRIVILEGE %} {% import 'macros/privilege.macros' as PRIVILEGE %}
{% import 'macros/default_privilege.macros' as DEFAULT_PRIVILEGE %} {% import 'macros/default_privilege.macros' as DEFAULT_PRIVILEGE %}
{% if data %} {% if data %}
@@ -26,17 +26,17 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.DROP(conn, 'SCHEMA', data.name, r.provider) }} {{ SECLABEL.DROP(conn, 'SCHEMA', data.name, r.provider) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }} {{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }} {{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@@ -1,4 +1,4 @@
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/security.macros' as SECLABEL %}
{% import 'macros/privilege.macros' as PRIVILEGE %} {% import 'macros/privilege.macros' as PRIVILEGE %}
{% import 'macros/default_privilege.macros' as DEFAULT_PRIVILEGE %} {% import 'macros/default_privilege.macros' as DEFAULT_PRIVILEGE %}
{% if data %} {% if data %}
@@ -26,17 +26,17 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.DROP(conn, 'SCHEMA', data.name, r.provider) }} {{ SECLABEL.DROP(conn, 'SCHEMA', data.name, r.provider) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }} {{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }} {{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@@ -418,6 +418,16 @@ class TypeView(PGChildNodeView, DataTypeReader):
range_dict = dict(res['rows'][0]) range_dict = dict(res['rows'][0])
res.update(range_dict) res.update(range_dict)
if 'seclabels' in copy_dict and copy_dict['seclabels'] is not None:
sec_labels = []
for sec in copy_dict['seclabels']:
sec = re.search(r'([^=]+)=(.*$)', sec)
sec_labels.append({
'provider': sec.group(1),
'label': sec.group(2)
})
res['seclabels'] = sec_labels
# Returning only additional properties only # Returning only additional properties only
return res return res

View File

@@ -1,4 +1,4 @@
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{## If user selected shell type then just create type template ##} {## If user selected shell type then just create type template ##}
{% if data and data.typtype == 'p' %} {% if data and data.typtype == 'p' %}
@@ -77,7 +77,7 @@ COMMENT ON TYPE {% if data.schema %}{{ conn|qtIdent(data.schema, data.name) }}{%
{% for r in data.seclabels %} {% for r in data.seclabels %}
{% if r.provider and r.label %} {% if r.provider and r.label %}
{{ SECLABLE.SET(conn, 'TYPE', data.name, r.provider, r.label, data.schema) }} {{ SECLABEL.SET(conn, 'TYPE', data.name, r.provider, r.label, data.schema) }}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@@ -6,7 +6,7 @@ SELECT t.oid, t.typname AS name,
description, ct.oid AS taboid, description, ct.oid AS taboid,
nsp.nspname AS schema, nsp.nspname AS schema,
--MinimumVersion 9.1 START --MinimumVersion 9.1 START
(SELECT array_agg(provider || '=' || label) FROM pg_shseclabel sl1 WHERE sl1.objoid=t.oid) AS seclabels, (SELECT array_agg(provider || '=' || label) FROM pg_seclabel sl1 WHERE sl1.objoid=t.oid) AS seclabels,
-- END -- END
(CASE WHEN (t.oid <= {{ datlastsysoid}}::oid OR ct.oid != 0) THEN true ElSE false END) AS is_sys_type (CASE WHEN (t.oid <= {{ datlastsysoid}}::oid OR ct.oid != 0) THEN true ElSE false END) AS is_sys_type
FROM pg_type t FROM pg_type t

View File

@@ -1,4 +1,4 @@
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{% if data %} {% if data %}
{#======================================#} {#======================================#}
@@ -85,17 +85,17 @@ ALTER TYPE {{ conn|qtIdent(o_data.schema, o_data.name) }}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.UNSET(conn, 'TYPE', o_data.name, r.provider, o_data.schema) }} {{ SECLABEL.UNSET(conn, 'TYPE', o_data.name, r.provider, o_data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.SET(conn, 'TYPE', o_data.name, r.provider, r.label, o_data.schema) }} {{ SECLABEL.SET(conn, 'TYPE', o_data.name, r.provider, r.label, o_data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.SET(conn, 'TYPE', o_data.name, r.provider, r.label, o_data.schema) }} {{ SECLABEL.SET(conn, 'TYPE', o_data.name, r.provider, r.label, o_data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@@ -974,6 +974,11 @@ class ViewNode(PGChildNodeView, VacuumSettings):
return internal_server_error(errormsg=res) return internal_server_error(errormsg=res)
result = res['rows'][0] result = res['rows'][0]
# sending result to formtter
frmtd_reslt = self.formatter(result)
# merging formated result with main result again
result.update(frmtd_reslt)
# Fetch all privileges for view # Fetch all privileges for view
SQL = render_template("/".join( SQL = render_template("/".join(

View File

@@ -1,6 +1,6 @@
{# ===== Grant Permissions to User Role on Views/Tables ==== #} {# ===== Grant Permissions to User Role on Views/Tables ==== #}
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{# We will generate Security Label SQL using macro #} {# We will generate Security Label SQL using macro #}
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.SET(conn, 'MATERIALIZED VIEW', data.name, r.provider, r.label, data.schema) }}{% endfor %}{% endif %} {% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABEL.SET(conn, 'MATERIALIZED VIEW', data.name, r.provider, r.label, data.schema) }}{% endfor %}{% endif %}
{% if data.datacl %}{% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %} {% if data.datacl %}{% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %}

View File

@@ -1,5 +1,5 @@
{# ===================== Update View ===================#} {# ===================== Update View ===================#}
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{%- if data -%} {%- if data -%}
{% set view_name = data.name if data.name else o_data.name %} {% set view_name = data.name if data.name else o_data.name %}
@@ -197,17 +197,17 @@ COMMENT ON MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.UNSET(conn, 'MATERIALIZED VIEW', data.name, r.provider, data.schema) }} {{ SECLABEL.UNSET(conn, 'MATERIALIZED VIEW', data.name, r.provider, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.SET(conn, 'MATERIALIZED VIEW', data.name, r.provider, r.label, data.schema) }} {{ SECLABEL.SET(conn, 'MATERIALIZED VIEW', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.SET(conn, 'MATERIALIZED VIEW', data.name, r.provider, r.label, data.schema) }} {{ SECLABEL.SET(conn, 'MATERIALIZED VIEW', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %} {% endif %}

View File

@@ -1,6 +1,6 @@
{# ===== Grant Permissions to User Role on Views/Tables ==== #} {# ===== Grant Permissions to User Role on Views/Tables ==== #}
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{# We will generate Security Label SQL using macro #} {# We will generate Security Label SQL using macro #}
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.SET(conn, 'MATERIALIZED VIEW', data.name, r.provider, r.label, data.schema) }}{% endfor %}{% endif %} {% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABEL.SET(conn, 'MATERIALIZED VIEW', data.name, r.provider, r.label, data.schema) }}{% endfor %}{% endif %}
{% if data.datacl %}{% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %} {% if data.datacl %}{% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %}

View File

@@ -1,5 +1,5 @@
{# ===================== Update View ===================#} {# ===================== Update View ===================#}
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{%- if data -%} {%- if data -%}
{% set view_name = data.name if data.name else o_data.name %} {% set view_name = data.name if data.name else o_data.name %}
@@ -197,17 +197,17 @@ COMMENT ON MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.UNSET(conn, 'MATERIALIZED VIEW', data.name, r.provider, data.schema) }} {{ SECLABEL.UNSET(conn, 'MATERIALIZED VIEW', data.name, r.provider, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.SET(conn, 'MATERIALIZED VIEW', data.name, r.provider, r.label, data.schema) }} {{ SECLABEL.SET(conn, 'MATERIALIZED VIEW', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.SET(conn, 'MATERIALIZED VIEW', data.name, r.provider, r.label, data.schema) }} {{ SECLABEL.SET(conn, 'MATERIALIZED VIEW', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %} {% endif %}

View File

@@ -1,6 +1,6 @@
{# ===== Grant Permissions to User Role on Views/Tables ==== #} {# ===== Grant Permissions to User Role on Views/Tables ==== #}
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{# We will generate Security Label SQL using macro #} {# We will generate Security Label SQL using macro #}
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.SET(conn, 'MATERIALIZED VIEW', data.name, r.provider, r.label, data.schema) }}{% endfor %}{% endif %} {% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABEL.SET(conn, 'MATERIALIZED VIEW', data.name, r.provider, r.label, data.schema) }}{% endfor %}{% endif %}
{% if data.datacl %}{% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %} {% if data.datacl %}{% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %}

View File

@@ -1,5 +1,5 @@
{# ===================== Update View ===================#} {# ===================== Update View ===================#}
{% import 'macros/schemas/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{%- if data -%} {%- if data -%}
{% set view_name = data.name if data.name else o_data.name %} {% set view_name = data.name if data.name else o_data.name %}
@@ -197,17 +197,17 @@ COMMENT ON MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.UNSET(conn, 'MATERIALIZED VIEW', data.name, r.provider, data.schema) }} {{ SECLABEL.UNSET(conn, 'MATERIALIZED VIEW', data.name, r.provider, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.SET(conn, 'MATERIALIZED VIEW', data.name, r.provider, r.label, data.schema) }} {{ SECLABEL.SET(conn, 'MATERIALIZED VIEW', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.SET(conn, 'MATERIALIZED VIEW', data.name, r.provider, r.label, data.schema) }} {{ SECLABEL.SET(conn, 'MATERIALIZED VIEW', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %} {% endif %}

View File

@@ -1,6 +1,6 @@
{# ===== Grant Permissions to User Role on Views/Tables ===== #} {# ===== Grant Permissions to User Role on Views/Tables ===== #}
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{# ===== We will generate Security Label SQL using macro ===== #} {# ===== We will generate Security Label SQL using macro ===== #}
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %} {% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %}
{% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %} {% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %}

View File

@@ -15,18 +15,12 @@ SELECT
CASE WHEN {{vid}} <= {{datlastsysoid}} THEN True ELSE False END AS system_view, CASE WHEN {{vid}} <= {{datlastsysoid}} THEN True ELSE False END AS system_view,
{% endif %} {% endif %}
(SELECT (SELECT
array_agg(label) array_agg(provider || '=' || label)
FROM FROM
pg_seclabels sl1 pg_seclabels sl1
WHERE WHERE
sl1.objoid=c.oid AND sl1.objsubid=0 sl1.objoid=c.oid AND sl1.objsubid=0
) AS labels, ) AS seclabels,
(SELECT
array_agg(provider)
FROM
pg_seclabels sl2
WHERE sl2.objoid=c.oid AND sl2.objsubid=0
) AS providers
FROM pg_class c FROM pg_class c
LEFT OUTER JOIN pg_namespace nsp on nsp.oid = c.relnamespace LEFT OUTER JOIN pg_namespace nsp on nsp.oid = c.relnamespace
LEFT OUTER JOIN pg_tablespace spc on spc.oid=c.reltablespace LEFT OUTER JOIN pg_tablespace spc on spc.oid=c.reltablespace

View File

@@ -1,5 +1,5 @@
{# ============================ Update View ========================= #} {# ============================ Update View ========================= #}
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{% if data %} {% if data %}
{% set view_name = data.name if data.name else o_data.name %} {% set view_name = data.name if data.name else o_data.name %}
@@ -50,17 +50,17 @@ COMMENT ON VIEW {{ conn|qtIdent(view_schema, view_name) }}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.DROP(conn, 'VIEW', data.name, r.provider) }} {{ SECLABEL.UNSET(conn, 'VIEW', data.name, r.provider, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }} {{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }} {{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %} {% endif %}

View File

@@ -1,6 +1,6 @@
{# ===== Grant Permissions to User Role on Views/Tables ===== #} {# ===== Grant Permissions to User Role on Views/Tables ===== #}
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{# ===== We will generate Security Label SQL using macro ===== #} {# ===== We will generate Security Label SQL using macro ===== #}
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %} {% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %}
{% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %} {% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %}

View File

@@ -15,18 +15,13 @@ SELECT
{% if vid and datlastsysoid %} {% if vid and datlastsysoid %}
CASE WHEN {{vid}} <= {{datlastsysoid}} THEN True ELSE False END AS system_view, CASE WHEN {{vid}} <= {{datlastsysoid}} THEN True ELSE False END AS system_view,
{% endif %} {% endif %}
(SELECT (SELECT
array_agg(label) array_agg(provider || '=' || label)
FROM FROM
pg_seclabels sl1 pg_seclabels sl1
WHERE WHERE
sl1.objoid=c.oid AND sl1.objsubid=0) AS labels, sl1.objoid=c.oid AND sl1.objsubid=0
(SELECT ) AS seclabels,
array_agg(provider)
FROM
pg_seclabels sl2
WHERE
sl2.objoid=c.oid AND sl2.objsubid=0) AS providers,
(substring(array_to_string(c.reloptions, ',') (substring(array_to_string(c.reloptions, ',')
FROM 'security_barrier=([a-z|0-9]*)'))::boolean AS security_barrier FROM 'security_barrier=([a-z|0-9]*)'))::boolean AS security_barrier
FROM pg_class c FROM pg_class c

View File

@@ -1,5 +1,5 @@
{# ============================ Update View ========================= #} {# ============================ Update View ========================= #}
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{% if data %} {% if data %}
{% set view_name = data.name if data.name else o_data.name %} {% set view_name = data.name if data.name else o_data.name %}
@@ -58,17 +58,17 @@ COMMENT ON VIEW {{ conn|qtIdent(view_schema, view_name) }}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.DROP(conn, 'VIEW', data.name, r.provider) }} {{ SECLABEL.UNSET(conn, 'VIEW', data.name, r.provider, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }} {{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }} {{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %} {% endif %}

View File

@@ -1,6 +1,6 @@
{# ===== Grant Permissions to User Role on Views/Tables ===== #} {# ===== Grant Permissions to User Role on Views/Tables ===== #}
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{# ===== We will generate Security Label SQL using macro ===== #} {# ===== We will generate Security Label SQL using macro ===== #}
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %} {% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %}
{% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %} {% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %}

View File

@@ -16,18 +16,13 @@ SELECT
{% if vid and datlastsysoid %} {% if vid and datlastsysoid %}
CASE WHEN {{vid}} <= {{datlastsysoid}} THEN True ELSE False END AS system_view, CASE WHEN {{vid}} <= {{datlastsysoid}} THEN True ELSE False END AS system_view,
{% endif %} {% endif %}
(SELECT (SELECT
array_agg(label) array_agg(provider || '=' || label)
FROM FROM
pg_seclabels sl1 pg_seclabels sl1
WHERE WHERE
sl1.objoid=c.oid AND sl1.objsubid=0) AS labels, sl1.objoid=c.oid AND sl1.objsubid=0
(SELECT ) AS seclabels,
array_agg(provider)
FROM
pg_seclabels sl2
WHERE
sl2.objoid=c.oid AND sl2.objsubid=0) AS providers,
(substring(array_to_string(c.reloptions, ',') (substring(array_to_string(c.reloptions, ',')
FROM 'security_barrier=([a-z|0-9]*)'))::boolean AS security_barrier FROM 'security_barrier=([a-z|0-9]*)'))::boolean AS security_barrier
FROM pg_class c FROM pg_class c

View File

@@ -1,5 +1,5 @@
{# ============================ Update View ========================= #} {# ============================ Update View ========================= #}
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{% if data %} {% if data %}
{% set view_name = data.name if data.name else o_data.name %} {% set view_name = data.name if data.name else o_data.name %}
@@ -58,17 +58,17 @@ COMMENT ON VIEW {{ conn|qtIdent(view_schema, view_name) }}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.DROP(conn, 'VIEW', data.name, r.provider) }} {{ SECLABEL.UNSET(conn, 'VIEW', data.name, r.provider, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }} {{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }} {{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %} {% endif %}

View File

@@ -1,6 +1,6 @@
{# ===== Grant Permissions to User Role on Views/Tables ===== #} {# ===== Grant Permissions to User Role on Views/Tables ===== #}
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{# ===== We will generate Security Label SQL using macro ===== #} {# ===== We will generate Security Label SQL using macro ===== #}
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %} {% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %}
{% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %} {% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %}

View File

@@ -17,18 +17,13 @@ SELECT
{% if vid and datlastsysoid %} {% if vid and datlastsysoid %}
CASE WHEN {{vid}} <= {{datlastsysoid}} THEN True ELSE False END AS system_view, CASE WHEN {{vid}} <= {{datlastsysoid}} THEN True ELSE False END AS system_view,
{% endif %} {% endif %}
(SELECT (SELECT
array_agg(label) array_agg(provider || '=' || label)
FROM FROM
pg_seclabels sl1 pg_seclabels sl1
WHERE WHERE
sl1.objoid=c.oid AND sl1.objsubid=0) AS labels, sl1.objoid=c.oid AND sl1.objsubid=0
(SELECT ) AS seclabels,
array_agg(provider)
FROM
pg_seclabels sl2
WHERE
sl2.objoid=c.oid AND sl2.objsubid=0) AS providers,
substring(array_to_string(c.reloptions, ',') substring(array_to_string(c.reloptions, ',')
FROM 'check_option=([a-z]*)') AS check_option, FROM 'check_option=([a-z]*)') AS check_option,
(substring(array_to_string(c.reloptions, ',') (substring(array_to_string(c.reloptions, ',')

View File

@@ -1,5 +1,5 @@
{# ============================ Update View ========================= #} {# ============================ Update View ========================= #}
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{% if data %} {% if data %}
{% set view_name = data.name if data.name else o_data.name %} {% set view_name = data.name if data.name else o_data.name %}
@@ -64,17 +64,17 @@ COMMENT ON VIEW {{ conn|qtIdent(view_schema, view_name) }}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.DROP(conn, 'VIEW', data.name, r.provider) }} {{ SECLABEL.UNSET(conn, 'VIEW', data.name, r.provider, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }} {{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }} {{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %} {% endif %}

View File

@@ -1,6 +1,6 @@
{# ===== Grant Permissions to User Role on Views/Tables ===== #} {# ===== Grant Permissions to User Role on Views/Tables ===== #}
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{# ===== We will generate Security Label SQL using macro ===== #} {# ===== We will generate Security Label SQL using macro ===== #}
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %} {% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %}
{% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %} {% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %}

View File

@@ -16,18 +16,13 @@ SELECT
{% if vid and datlastsysoid %} {% if vid and datlastsysoid %}
CASE WHEN {{vid}} <= {{datlastsysoid}} THEN True ELSE False END AS system_view, CASE WHEN {{vid}} <= {{datlastsysoid}} THEN True ELSE False END AS system_view,
{% endif %} {% endif %}
(SELECT (SELECT
array_agg(label) array_agg(provider || '=' || label)
FROM FROM
pg_seclabels sl1 pg_seclabels sl1
WHERE WHERE
sl1.objoid=c.oid AND sl1.objsubid=0) AS labels, sl1.objoid=c.oid AND sl1.objsubid=0
(SELECT ) AS seclabels,
array_agg(provider)
FROM
pg_seclabels sl2
WHERE
sl2.objoid=c.oid AND sl2.objsubid=0) AS providers,
substring(array_to_string(c.reloptions, ',') substring(array_to_string(c.reloptions, ',')
FROM 'check_option=([a-z]*)') AS check_option, FROM 'check_option=([a-z]*)') AS check_option,
(substring(array_to_string(c.reloptions, ',') (substring(array_to_string(c.reloptions, ',')

View File

@@ -1,5 +1,5 @@
{# ============================ Update View ========================= #} {# ============================ Update View ========================= #}
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{% if data %} {% if data %}
{% set view_name = data.name if data.name else o_data.name %} {% set view_name = data.name if data.name else o_data.name %}
@@ -58,17 +58,17 @@ COMMENT ON VIEW {{ conn|qtIdent(view_schema, view_name) }}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.DROP(conn, 'VIEW', data.name, r.provider) }} {{ SECLABEL.UNSET(conn, 'VIEW', data.name, r.provider, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }} {{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }} {{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %} {% endif %}

View File

@@ -1,6 +1,6 @@
{# ===== Grant Permissions to User Role on Views/Tables ===== #} {# ===== Grant Permissions to User Role on Views/Tables ===== #}
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{# ===== We will generate Security Label SQL using macro ===== #} {# ===== We will generate Security Label SQL using macro ===== #}
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %} {% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %}
{% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %} {% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %}

View File

@@ -14,18 +14,13 @@ SELECT
{% if vid and datlastsysoid %} {% if vid and datlastsysoid %}
CASE WHEN {{vid}} <= {{datlastsysoid}} THEN True ELSE False END AS system_view, CASE WHEN {{vid}} <= {{datlastsysoid}} THEN True ELSE False END AS system_view,
{% endif %} {% endif %}
(SELECT (SELECT
array_agg(label) array_agg(provider || '=' || label)
FROM FROM
pg_seclabels sl1 pg_seclabels sl1
WHERE WHERE
sl1.objoid=c.oid AND sl1.objsubid=0) AS labels, sl1.objoid=c.oid AND sl1.objsubid=0
(SELECT ) AS seclabels,
array_agg(provider)
FROM
pg_seclabels sl2
WHERE
sl2.objoid=c.oid AND sl2.objsubid=0) AS providers,
(substring(array_to_string(c.reloptions, ',') (substring(array_to_string(c.reloptions, ',')
FROM 'security_barrier=([a-z|0-9]*)'))::boolean AS security_barrier FROM 'security_barrier=([a-z|0-9]*)'))::boolean AS security_barrier
FROM pg_class c FROM pg_class c

View File

@@ -1,5 +1,5 @@
{# ============================ Update View ========================= #} {# ============================ Update View ========================= #}
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{% if data %} {% if data %}
{% set view_name = data.name if data.name else o_data.name %} {% set view_name = data.name if data.name else o_data.name %}
@@ -58,17 +58,17 @@ COMMENT ON VIEW {{ conn|qtIdent(view_schema, view_name) }}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.DROP(conn, 'VIEW', data.name, r.provider) }} {{ SECLABEL.UNSET(conn, 'VIEW', data.name, r.provider, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }} {{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }} {{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %} {% endif %}

View File

@@ -1,6 +1,6 @@
{# ===== Grant Permissions to User Role on Views/Tables ===== #} {# ===== Grant Permissions to User Role on Views/Tables ===== #}
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{# ===== We will generate Security Label SQL using macro ===== #} {# ===== We will generate Security Label SQL using macro ===== #}
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %} {% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %}
{% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %} {% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %}

View File

@@ -16,18 +16,13 @@ SELECT
{% if vid and datlastsysoid %} {% if vid and datlastsysoid %}
CASE WHEN {{vid}} <= {{datlastsysoid}} THEN True ELSE False END AS system_view, CASE WHEN {{vid}} <= {{datlastsysoid}} THEN True ELSE False END AS system_view,
{% endif %} {% endif %}
(SELECT (SELECT
array_agg(label) array_agg(provider || '=' || label)
FROM FROM
pg_seclabels sl1 pg_seclabels sl1
WHERE WHERE
sl1.objoid=c.oid AND sl1.objsubid=0) AS labels, sl1.objoid=c.oid AND sl1.objsubid=0
(SELECT ) AS seclabels,
array_agg(provider)
FROM
pg_seclabels sl2
WHERE
sl2.objoid=c.oid AND sl2.objsubid=0) AS providers,
(substring(array_to_string(c.reloptions, ',') (substring(array_to_string(c.reloptions, ',')
FROM 'security_barrier=([a-z|0-9]*)'))::boolean AS security_barrier FROM 'security_barrier=([a-z|0-9]*)'))::boolean AS security_barrier
FROM pg_class c FROM pg_class c

View File

@@ -1,5 +1,5 @@
{# ============================ Update View ========================= #} {# ============================ Update View ========================= #}
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{% if data %} {% if data %}
{% set view_name = data.name if data.name else o_data.name %} {% set view_name = data.name if data.name else o_data.name %}
@@ -58,17 +58,17 @@ COMMENT ON VIEW {{ conn|qtIdent(view_schema, view_name) }}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.DROP(conn, 'VIEW', data.name, r.provider) }} {{ SECLABEL.UNSET(conn, 'VIEW', data.name, r.provider, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }} {{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }} {{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %} {% endif %}

View File

@@ -1,6 +1,6 @@
{# ===== Grant Permissions to User Role on Views/Tables ===== #} {# ===== Grant Permissions to User Role on Views/Tables ===== #}
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{# ===== We will generate Security Label SQL using macro ===== #} {# ===== We will generate Security Label SQL using macro ===== #}
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %} {% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %}
{% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %} {% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %}

View File

@@ -17,18 +17,13 @@ SELECT
{% if vid and datlastsysoid %} {% if vid and datlastsysoid %}
CASE WHEN {{vid}} <= {{datlastsysoid}} THEN True ELSE False END AS system_view, CASE WHEN {{vid}} <= {{datlastsysoid}} THEN True ELSE False END AS system_view,
{% endif %} {% endif %}
(SELECT (SELECT
array_agg(label) array_agg(provider || '=' || label)
FROM FROM
pg_seclabels sl1 pg_seclabels sl1
WHERE WHERE
sl1.objoid=c.oid AND sl1.objsubid=0) AS labels, sl1.objoid=c.oid AND sl1.objsubid=0
(SELECT ) AS seclabels,
array_agg(provider)
FROM
pg_seclabels sl2
WHERE
sl2.objoid=c.oid AND sl2.objsubid=0) AS providers,
substring(array_to_string(c.reloptions, ',') substring(array_to_string(c.reloptions, ',')
FROM 'check_option=([a-z]*)') AS check_option, FROM 'check_option=([a-z]*)') AS check_option,
(substring(array_to_string(c.reloptions, ',') (substring(array_to_string(c.reloptions, ',')

View File

@@ -1,5 +1,5 @@
{# ============================ Update View ========================= #} {# ============================ Update View ========================= #}
{% import 'macros/security.macros' as SECLABLE %} {% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{% if data %} {% if data %}
{% set view_name = data.name if data.name else o_data.name %} {% set view_name = data.name if data.name else o_data.name %}
@@ -64,17 +64,17 @@ COMMENT ON VIEW {{ conn|qtIdent(view_schema, view_name) }}
{% set seclabels = data.seclabels %} {% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} {% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %} {% for r in seclabels.deleted %}
{{ SECLABLE.DROP(conn, 'VIEW', data.name, r.provider) }} {{ SECLABEL.UNSET(conn, 'VIEW', data.name, r.provider, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %} {% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %} {% for r in seclabels.added %}
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }} {{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %} {% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %} {% for r in seclabels.changed %}
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }} {{ SECLABEL.SET(conn, 'VIEW', data.name, r.provider, r.label, data.schema) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %} {% endif %}

View File

@@ -289,7 +289,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
canAdd: true, canEdit: false, canDelete: true, hasRole: true, canAdd: true, canEdit: false, canDelete: true, hasRole: true,
control: Backform.VariableCollectionControl, node: 'role' control: Backform.VariableCollectionControl, node: 'role'
},{ },{
id: 'securities', label: '{{ _('Security Labels') }}', id: 'seclabels', label: '{{ _('Security Labels') }}',
model: pgBrowser.SecLabelModel, model: pgBrowser.SecLabelModel,
editable: false, type: 'collection', canEdit: false, editable: false, type: 'collection', canEdit: false,
group: '{{ _('Security') }}', canDelete: true, group: '{{ _('Security') }}', canDelete: true,

View File

@@ -1,3 +1,4 @@
{% import 'macros/security.macros' as SECLABEL %}
{% import 'macros/variable.macros' as VARIABLE %} {% import 'macros/variable.macros' as VARIABLE %}
{% import 'macros/privilege.macros' as PRIVILEGE %} {% import 'macros/privilege.macros' as PRIVILEGE %}
{% import 'macros/default_privilege.macros' as DEFAULT_PRIVILEGE %} {% import 'macros/default_privilege.macros' as DEFAULT_PRIVILEGE %}
@@ -128,3 +129,22 @@ ALTER DATABASE {{ conn|qtIdent(data.name) }} WITH CONNECTION LIMIT = {{ data.dat
{% endif %} {% endif %}
{% endif %} {% endif %}
{# Change the security labels #}
{% if data.seclabels and data.seclabels|length > 0 %}
{% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %}
{{ SECLABEL.DROP(conn, 'DATABASE', data.name, r.provider) }}
{% endfor %}
{% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %}
{{ SECLABEL.APPLY(conn, 'DATABASE', data.name, r.provider, r.label) }}
{% endfor %}
{% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %}
{{ SECLABEL.APPLY(conn, 'DATABASE', data.name, r.provider, r.label) }}
{% endfor %}
{% endif %}
{% endif %}

View File

@@ -3,6 +3,7 @@
# other sql statments along with it, so we wrote # other sql statments along with it, so we wrote
# seprate sql for rest alter sql statments here # seprate sql for rest alter sql statments here
#} #}
{% import 'macros/security.macros' as SECLABEL %}
{% import 'macros/variable.macros' as VARIABLE %} {% import 'macros/variable.macros' as VARIABLE %}
{% import 'macros/privilege.macros' as PRIVILEGE %} {% import 'macros/privilege.macros' as PRIVILEGE %}
{% import 'macros/default_privilege.macros' as DEFAULT_PRIVILEGE %} {% import 'macros/default_privilege.macros' as DEFAULT_PRIVILEGE %}
@@ -11,6 +12,12 @@ COMMENT ON DATABASE {{ conn|qtIdent(data.name) }}
IS {{ data.comments|qtLiteral }}; IS {{ data.comments|qtLiteral }};
{% endif %} {% endif %}
{# Generate the security labels #}
{% if data.seclabels %}
{% for r in data.seclabels %}
{{ SECLABEL.APPLY(conn, 'DATABASE', data.name, r.provider, r.label) }}
{% endfor %}
{% endif %}
{# TO generate Variable SQL using macro #} {# TO generate Variable SQL using macro #}
{% if data.variables %} {% if data.variables %}
{% for var in data.variables %} {% for var in data.variables %}

Some files were not shown because too many files have changed in this diff Show More