mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Improvement in the security tab for each of the nodes.
* Hide the security tab for the objects under the catalog schema. Patched by Surinder Kumar, vastly improved by me. * Make the securtiy label across all the nodes, using the same backbone model across the nodes, and make changes in the backend code for the same.
This commit is contained in:
@@ -146,8 +146,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
model: OptionsModel, control: 'unique-col-collection', mode: ['edit', 'create'],
|
||||
canAdd: true, canDelete: true, uniqueCol : ['fsrvoption'],
|
||||
columns: ['fsrvoption','fsrvvalue']
|
||||
},{
|
||||
id: 'fsrvacl', label: 'Privileges', type: 'collection', group: '{{ _('Security') }}',
|
||||
}, pgBrowser.SecurityGroupUnderSchema, {
|
||||
id: 'fsrvacl', label: 'Privileges', type: 'collection', group: 'security',
|
||||
model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend({privileges: ['U']}), control: 'unique-col-collection',
|
||||
mode: ['edit', 'create'], canAdd: true, canDelete: true, uniqueCol : ['grantee']
|
||||
},{
|
||||
|
||||
@@ -5,18 +5,19 @@ define(
|
||||
function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
|
||||
// Extend the browser's node model class to create a Options model
|
||||
var OptionsModel = pgAdmin.Browser.Node.Model.extend({
|
||||
var OptionsModel = pgBrowser.Node.Model.extend({
|
||||
defaults: {
|
||||
fdwoption: undefined,
|
||||
fdwvalue: undefined
|
||||
},
|
||||
|
||||
// Defining schema for the Options model
|
||||
schema: [
|
||||
{id: 'fdwoption', label:'Options', type:'text', cellHeaderClasses:'width_percent_50', group: null, editable: true},
|
||||
{id: 'fdwvalue', label:'Value', type: 'text', cellHeaderClasses:'width_percent_50', group:null, editable: true},
|
||||
],
|
||||
|
||||
schema: [{
|
||||
id: 'fdwoption', label: '{{ _('Option') }}', type:'text',
|
||||
cellHeaderClasses:'width_percent_50', editable: true
|
||||
},{
|
||||
id: 'fdwvalue', label:'{{ _('Value') }}', type: 'text',
|
||||
cellHeaderClasses:'width_percent_50', group:null, editable: true
|
||||
}],
|
||||
/* validate function is used to validate the input given by
|
||||
* the user. In case of error, message will be displayed on
|
||||
* the browser for the respective control.
|
||||
@@ -38,8 +39,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
|
||||
// Extend the browser's collection class for foreign data wrapper collection
|
||||
if (!pgBrowser.Nodes['coll-foreign_data_wrapper']) {
|
||||
var foreign_data_wrappers = pgAdmin.Browser.Nodes['coll-foreign_data_wrapper'] =
|
||||
pgAdmin.Browser.Collection.extend({
|
||||
var foreign_data_wrappers = pgBrowser.Nodes['coll-foreign_data_wrapper'] =
|
||||
pgBrowser.Collection.extend({
|
||||
node: 'foreign_data_wrapper',
|
||||
label: '{{ _('Foreign Data Wrappers') }}',
|
||||
type: 'coll-foreign_data_wrapper',
|
||||
@@ -49,7 +50,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
|
||||
// Extend the browser's node class for foreign data wrapper node
|
||||
if (!pgBrowser.Nodes['foreign_data_wrapper']) {
|
||||
pgAdmin.Browser.Nodes['foreign_data_wrapper'] = pgAdmin.Browser.Node.extend({
|
||||
pgBrowser.Nodes['foreign_data_wrapper'] = pgBrowser.Node.extend({
|
||||
parent_type: 'database',
|
||||
type: 'foreign_data_wrapper',
|
||||
sqlAlterHelp: 'sql-alterforeigndatawrapper.html',
|
||||
@@ -91,7 +92,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
},
|
||||
|
||||
// Defining model for foreign data wrapper node
|
||||
model: pgAdmin.Browser.Node.Model.extend({
|
||||
model: pgBrowser.Node.Model.extend({
|
||||
defaults: {
|
||||
name: undefined,
|
||||
fdwowner: undefined,
|
||||
@@ -111,7 +112,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
|
||||
this.set({'fdwowner': userInfo.name}, {silent: true});
|
||||
}
|
||||
pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
pgBrowser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
|
||||
// Defining schema for the foreign data wrapper node
|
||||
@@ -148,15 +149,18 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
id: 'fdwvalue', label:'{{ _('Validator') }}', type: 'text', control: 'node-ajax-options',
|
||||
group: '{{ _('Definition') }}', mode: ['edit', 'create', 'properties'], url:'get_validators'
|
||||
},{
|
||||
id: 'fdwacl', label: 'Privileges', type: 'collection', group: '{{ _('Security') }}',
|
||||
model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend({privileges: ['U']}), control: 'unique-col-collection',
|
||||
mode: ['edit', 'create'], canAdd: true, canDelete: true, uniqueCol : ['grantee']
|
||||
id: 'security', label: '{{ _("Security") }}', type: 'group'
|
||||
},{
|
||||
id: 'fdwacl', label: 'Privileges', type: 'collection',
|
||||
group: 'security', mode: ['edit', 'create'], canAdd: true,
|
||||
canDelete: true, uniqueCol : ['grantee'],
|
||||
model: pgBrowser.Node.PrivilegeRoleModel.extend({
|
||||
privileges: ['U']
|
||||
}), control: 'unique-col-collection'
|
||||
},{
|
||||
id: 'acl', label: '{{ _('Privileges') }}', type: 'text',
|
||||
group: '{{ _('Security') }}', mode: ['properties'], disabled: true
|
||||
}
|
||||
],
|
||||
|
||||
}],
|
||||
/* validate function is used to validate the input given by
|
||||
* the user. In case of error, message will be displayed on
|
||||
* the browser for the respective control.
|
||||
@@ -176,8 +180,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return pgBrowser.Nodes['coll-foreign_data_wrapper'];
|
||||
return pgBrowser.Nodes['foreign_data_wrapper'];
|
||||
});
|
||||
|
||||
@@ -3,46 +3,10 @@ define(
|
||||
'alertify', 'pgadmin.browser.collection', 'pgadmin.browser.server.privilege'],
|
||||
function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
|
||||
// Extend the browser's node model class to create a security model
|
||||
var SecurityModel = Backform.SecurityModel = pgAdmin.Browser.Node.Model.extend({
|
||||
defaults: {
|
||||
provider: null,
|
||||
security_label: null
|
||||
},
|
||||
|
||||
// Define the schema for the Security Label
|
||||
schema: [{
|
||||
id: 'provider', label: '{{ _('Provider') }}',
|
||||
type: 'text', disabled: false,
|
||||
cellHeaderClasses:'width_percent_50'
|
||||
},{
|
||||
id: 'security_label', label: '{{ _('Security Label') }}',
|
||||
type: 'text', disabled: false,
|
||||
cellHeaderClasses:'width_percent_50'
|
||||
}],
|
||||
/* validate function is used to validate the input given by
|
||||
* the user. In case of error, message will be displayed on
|
||||
* the GUI for the respective control.
|
||||
*/
|
||||
validate: function() {
|
||||
var errmsg = null;
|
||||
if (_.isUndefined(this.get('security_label')) ||
|
||||
_.isNull(this.get('security_label')) ||
|
||||
String(this.get('security_label')).replace(/^\s+|\s+$/g, '') == '') {
|
||||
errmsg = '{{ _('Please specify the value for all the security providers.')}}';
|
||||
this.errorModel.set('security_label', errmsg);
|
||||
return errmsg;
|
||||
} else {
|
||||
this.errorModel.unset('security_label');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
// Extend the browser's collection class for languages collection
|
||||
if (!pgBrowser.Nodes['coll-language']) {
|
||||
var languages = pgAdmin.Browser.Nodes['coll-language'] =
|
||||
pgAdmin.Browser.Collection.extend({
|
||||
var languages = pgBrowser.Nodes['coll-language'] =
|
||||
pgBrowser.Collection.extend({
|
||||
node: 'language',
|
||||
label: '{{ _('Languages') }}',
|
||||
type: 'coll-language',
|
||||
@@ -52,7 +16,7 @@ define(
|
||||
|
||||
// Extend the browser's node class for language node
|
||||
if (!pgBrowser.Nodes['language']) {
|
||||
pgAdmin.Browser.Nodes['language'] = pgAdmin.Browser.Node.extend({
|
||||
pgBrowser.Nodes['language'] = pgBrowser.Node.extend({
|
||||
parent_type: 'database',
|
||||
type: 'language',
|
||||
sqlAlterHelp: 'sql-alterlanguage.html',
|
||||
@@ -70,7 +34,7 @@ define(
|
||||
},
|
||||
|
||||
// Define the model for language node
|
||||
model: pgAdmin.Browser.Node.Model.extend({
|
||||
model: pgBrowser.Node.Model.extend({
|
||||
defaults: {
|
||||
name: undefined,
|
||||
lanowner: undefined,
|
||||
@@ -167,16 +131,18 @@ define(
|
||||
}, disabled: function(m) {
|
||||
return !(m.isNew());
|
||||
}
|
||||
}, pgBrowser.SecurityGroupUnderSchema, {
|
||||
id: 'lanacl', label: '{{ _('Privileges') }}', type: 'collection',
|
||||
group: 'security', control: 'unique-col-collection', mode: ['edit'],
|
||||
model: pgBrowser.Node.PrivilegeRoleModel.extend({
|
||||
privileges: ['U']
|
||||
}), canAdd: true, canDelete: true, uniqueCol : ['grantee']
|
||||
},{
|
||||
id: 'lanacl', label: '{{ _('Privileges') }}', type: 'collection', group: '{{ _('Security') }}',
|
||||
model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend({privileges: ['U']}), control: 'unique-col-collection',
|
||||
mode: ['edit'], canAdd: true, canDelete: true, uniqueCol : ['grantee']
|
||||
},{
|
||||
id: 'seclabels', label: '{{ _('Security Labels') }}',
|
||||
model: SecurityModel, editable: false, type: 'collection',
|
||||
group: '{{ _('Security') }}', mode: ['edit'],
|
||||
min_version: 90200, canAdd: true,
|
||||
canEdit: false, canDelete: true, control: 'unique-col-collection'
|
||||
id: 'seclabels', label: '{{ _('Security Labels') }}', mode: ['edit'],
|
||||
model: pgBrowser.SecLabelModel, editable: false,
|
||||
type: 'collection', group: 'security', min_version: 90200,
|
||||
canAdd: true, canEdit: false, canDelete: true,
|
||||
control: 'unique-col-collection'
|
||||
}
|
||||
],
|
||||
/* validate function is used to validate the input given by
|
||||
|
||||
@@ -319,7 +319,7 @@ class SchemaView(PGChildNodeView):
|
||||
sec = re.search(r'([^=]+)=(.*$)', sec)
|
||||
seclabels.append({
|
||||
'provider': sec.group(1),
|
||||
'security_label': sec.group(2)
|
||||
'label': sec.group(2)
|
||||
})
|
||||
|
||||
data['seclabels'] = seclabels
|
||||
|
||||
@@ -60,11 +60,9 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
},{
|
||||
id: 'description', label:'{{ _('Comment') }}', cell: 'string',
|
||||
type: 'multiline', disabled: true
|
||||
}
|
||||
]
|
||||
}]
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return pgBrowser.Nodes['catalog_object_column'];
|
||||
|
||||
@@ -6,8 +6,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
|
||||
// Define Domain Collection Node
|
||||
if (!pgBrowser.Nodes['coll-domain']) {
|
||||
var domains = pgAdmin.Browser.Nodes['coll-domain'] =
|
||||
pgAdmin.Browser.Collection.extend({
|
||||
var domains = pgBrowser.Nodes['coll-domain'] =
|
||||
pgBrowser.Collection.extend({
|
||||
node: 'domain',
|
||||
label: '{{ _('Domains') }}',
|
||||
type: 'coll-domain',
|
||||
@@ -15,45 +15,15 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
});
|
||||
};
|
||||
|
||||
// Security Model
|
||||
var SecurityModel = Backform.SecurityModel = pgAdmin.Browser.Node.Model.extend({
|
||||
defaults: {
|
||||
provider: null,
|
||||
security_label: null
|
||||
},
|
||||
schema: [{
|
||||
id: 'provider', label: '{{ _('Provider') }}',
|
||||
type: 'text', editable: true, cellHeaderClasses:'width_percent_50'
|
||||
},{
|
||||
id: 'security_label', label: '{{ _('Security Label') }}',
|
||||
type: 'text', editable: true, cellHeaderClasses:'width_percent_50'
|
||||
}],
|
||||
validate: function() {
|
||||
var err = {},
|
||||
errmsg = null;
|
||||
|
||||
if (_.isUndefined(this.get('security_label')) ||
|
||||
_.isNull(this.get('security_label')) ||
|
||||
String(this.get('security_label')).replace(/^\s+|\s+$/g, '') == '') {
|
||||
errmsg = '{{ _('Please specify the value for all the security providers.')}}';
|
||||
this.errorModel.set('security_label', errmsg);
|
||||
return errmsg;
|
||||
} else {
|
||||
this.errorModel.unset('security_label');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
// Constraint Model
|
||||
var ConstraintModel = pgAdmin.Browser.Node.Model.extend({
|
||||
var ConstraintModel = pgBrowser.Node.Model.extend({
|
||||
idAttribute: 'conoid',
|
||||
initialize: function(attrs, args) {
|
||||
var isNew = (_.size(attrs) === 0);
|
||||
if (!isNew) {
|
||||
this.convalidated_default = this.get('convalidated')
|
||||
}
|
||||
pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
pgBrowser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
defaults: {
|
||||
conoid: undefined,
|
||||
@@ -107,7 +77,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
|
||||
// Domain Node
|
||||
if (!pgBrowser.Nodes['domain']) {
|
||||
pgAdmin.Browser.Nodes['domain'] = pgBrowser.Node.extend({
|
||||
pgBrowser.Nodes['domain'] = pgBrowser.Node.extend({
|
||||
type: 'domain',
|
||||
sqlAlterHelp: 'sql-alterdomain.html',
|
||||
sqlCreateHelp: 'sql-createdomain.html',
|
||||
@@ -149,7 +119,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
canDrop: pgBrowser.Nodes['schema'].canChildDrop,
|
||||
canDropCascade: pgBrowser.Nodes['schema'].canChildDrop,
|
||||
// Domain Node Model
|
||||
model: pgAdmin.Browser.Node.Model.extend({
|
||||
model: pgBrowser.Node.Model.extend({
|
||||
initialize: function(attrs, args) {
|
||||
var isNew = (_.size(attrs) === 0);
|
||||
if (isNew) {
|
||||
@@ -161,7 +131,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
||||
this.set({'owner': userInfo.name}, {silent: true});
|
||||
}
|
||||
pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
pgBrowser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
defaults: {
|
||||
name: undefined,
|
||||
@@ -293,17 +263,17 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
type: 'collection', group: '{{ _('Constraints') }}', mode: ['edit', 'create'],
|
||||
model: ConstraintModel, canAdd: true, canDelete: true,
|
||||
canEdit: false, columns: ['conname','consrc', 'convalidated']
|
||||
},{
|
||||
},
|
||||
pgBrowser.SecurityGroupUnderSchema,
|
||||
{
|
||||
id: 'seclabels', label: '{{ _('Security Labels') }}',
|
||||
model: SecurityModel, type: 'collection',
|
||||
group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
||||
model: pgBrowser.SecLabelModel, type: 'collection',
|
||||
group: 'security', mode: ['edit', 'create'],
|
||||
min_version: 90100, canAdd: true,
|
||||
canEdit: false, canDelete: true,
|
||||
control: 'unique-col-collection', uniqueCol : ['provider']
|
||||
}
|
||||
],
|
||||
validate: function() // Client Side Validation
|
||||
{
|
||||
}],
|
||||
validate: function() { // Client Side Validation
|
||||
var err = {},
|
||||
errmsg,
|
||||
seclabels = this.get('seclabels');
|
||||
|
||||
@@ -20,10 +20,10 @@ ALTER DOMAIN {{ conn|qtIdent(data.basensp, data.name) }} OWNER TO {{ conn|qtIden
|
||||
COMMENT ON DOMAIN {{ conn|qtIdent(data.basensp, data.name) }}
|
||||
IS '{{ data.description }}';{% endif -%}{% if data.seclabels %}
|
||||
{% for r in data.seclabels %}
|
||||
{% if r.security_label and r.provider %}
|
||||
{% if r.label and r.provider %}
|
||||
|
||||
|
||||
{{ SECLABLE.SET(conn, 'DOMAIN', data.name, r.provider, r.security_label, data.basensp) }}{% endif -%}
|
||||
{{ SECLABLE.SET(conn, 'DOMAIN', data.name, r.provider, r.label, data.basensp) }}{% endif -%}
|
||||
{% endfor -%}
|
||||
{% endif -%}
|
||||
|
||||
|
||||
@@ -49,13 +49,13 @@ ALTER DOMAIN {{ conn|qtIdent(o_data.basensp, name) }}
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABLE.SET(conn, 'DOMAIN', name, r.provider, r.security_label, o_data.basensp) }}
|
||||
{{ SECLABLE.SET(conn, 'DOMAIN', name, r.provider, r.label, o_data.basensp) }}
|
||||
|
||||
{% endfor -%}
|
||||
{% endif %}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABLE.SET(conn, 'DOMAIN', name, r.provider, r.security_label, o_data.basensp) }}
|
||||
{{ SECLABLE.SET(conn, 'DOMAIN', name, r.provider, r.label, o_data.basensp) }}
|
||||
|
||||
{% endfor -%}
|
||||
{% endif -%}{% if data.description %}
|
||||
|
||||
@@ -26,10 +26,10 @@ COMMENT ON DOMAIN {{ conn|qtIdent(data.basensp, data.name) }}
|
||||
|
||||
{% if data.seclabels %}
|
||||
{% for r in data.seclabels %}
|
||||
{% if r.security_label and r.provider %}
|
||||
{% if r.label and r.provider %}
|
||||
|
||||
|
||||
{{ SECLABLE.SET(conn, 'DOMAIN', data.name, r.provider, r.security_label, data.basensp) }}{% endif -%}
|
||||
{{ SECLABLE.SET(conn, 'DOMAIN', data.name, r.provider, r.label, data.basensp) }}{% endif -%}
|
||||
{% endfor -%}
|
||||
{% endif -%}
|
||||
|
||||
|
||||
@@ -62,12 +62,12 @@ ALTER DOMAIN {{ conn|qtIdent(o_data.basensp, name) }}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
|
||||
{{ SECLABLE.SET(conn, 'DOMAIN', name, r.provider, r.security_label, o_data.basensp) }}
|
||||
{{ SECLABLE.SET(conn, 'DOMAIN', name, r.provider, r.label, o_data.basensp) }}
|
||||
{% endfor %}
|
||||
{% endif -%}{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
|
||||
{{ SECLABLE.SET(conn, 'DOMAIN', name, r.provider, r.security_label, o_data.basensp) }}
|
||||
{{ SECLABLE.SET(conn, 'DOMAIN', name, r.provider, r.label, o_data.basensp) }}
|
||||
{% endfor %}
|
||||
{% endif -%}{% if data.description %}
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ define(
|
||||
function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
|
||||
if (!pgBrowser.Nodes['coll-foreign-table']) {
|
||||
var foreigntable = pgAdmin.Browser.Nodes['coll-foreign-table'] =
|
||||
pgAdmin.Browser.Collection.extend({
|
||||
var foreigntable = pgBrowser.Nodes['coll-foreign-table'] =
|
||||
pgBrowser.Collection.extend({
|
||||
node: 'foreign-table',
|
||||
label: '{{ _('Foreign Tables') }}',
|
||||
type: 'coll-foreign-table',
|
||||
@@ -13,33 +13,6 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
});
|
||||
};
|
||||
|
||||
// Security Model
|
||||
var SecurityModel = Backform.SecurityModel = pgAdmin.Browser.Node.Model.extend({
|
||||
defaults: {
|
||||
provider: null,
|
||||
label: null
|
||||
},
|
||||
schema: [{
|
||||
id: 'provider', label: '{{ _('Provider') }}',
|
||||
type: 'text', editable: true, cellHeaderClasses:'width_percent_50'
|
||||
},{
|
||||
id: 'security_label', label: '{{ _('Security Label') }}',
|
||||
type: 'text', editable: true, cellHeaderClasses:'width_percent_50'
|
||||
}],
|
||||
validate: function() {
|
||||
var err = {},
|
||||
errmsg = null,
|
||||
data = this.toJSON();
|
||||
|
||||
if (_.isUndefined(data.security_label) ||
|
||||
_.isNull(data.security_label) ||
|
||||
String(data.security_label).replace(/^\s+|\s+$/g, '') == '') {
|
||||
return _("Please specify the value for all the security providers.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
// Integer Cell for Columns Length and Precision
|
||||
var IntegerDepCell = Backgrid.IntegerCell.extend({
|
||||
initialize: function() {
|
||||
@@ -64,7 +37,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
|
||||
|
||||
// Columns Model
|
||||
var ColumnsModel = pgAdmin.Browser.Node.Model.extend({
|
||||
var ColumnsModel = pgBrowser.Node.Model.extend({
|
||||
idAttribute: 'attnum',
|
||||
defaults: {
|
||||
attname: undefined,
|
||||
@@ -395,7 +368,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
cache_level = this.field.get('cache_level') || node.type,
|
||||
cache_node = this.field.get('cache_node');
|
||||
|
||||
cache_node = (cache_node && pgAdmin.Browser.Nodes['cache_node']) || node;
|
||||
cache_node = (cache_node && pgBrowser.Nodes['cache_node']) || node;
|
||||
|
||||
m.trigger('pgadmin:view:fetching', m, self.field);
|
||||
data = {attrelid: table_id}
|
||||
@@ -431,14 +404,14 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
|
||||
|
||||
// Constraints Model
|
||||
var ConstraintModel = pgAdmin.Browser.Node.Model.extend({
|
||||
var ConstraintModel = pgBrowser.Node.Model.extend({
|
||||
idAttribute: 'conoid',
|
||||
initialize: function(attrs, args) {
|
||||
var isNew = (_.size(attrs) === 0);
|
||||
if (!isNew) {
|
||||
this.convalidated_default = this.get('convalidated')
|
||||
}
|
||||
pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
pgBrowser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
defaults: {
|
||||
conoid: undefined,
|
||||
@@ -505,7 +478,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
|
||||
|
||||
// Options Model
|
||||
var OptionsModel = pgAdmin.Browser.Node.Model.extend({
|
||||
var OptionsModel = pgBrowser.Node.Model.extend({
|
||||
defaults: {
|
||||
option: undefined,
|
||||
value: undefined
|
||||
@@ -526,7 +499,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
|
||||
|
||||
if (!pgBrowser.Nodes['foreign-table']) {
|
||||
pgAdmin.Browser.Nodes['foreign-table'] = pgBrowser.Node.extend({
|
||||
pgBrowser.Nodes['foreign-table'] = pgBrowser.Node.extend({
|
||||
type: 'foreign-table',
|
||||
sqlAlterHelp: 'sql-alterforeigntable.html',
|
||||
sqlCreateHelp: 'sql-createforeigntable.html',
|
||||
@@ -567,7 +540,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
},
|
||||
canDrop: pgBrowser.Nodes['schema'].canChildDrop,
|
||||
canDropCascade: pgBrowser.Nodes['schema'].canChildDrop,
|
||||
model: pgAdmin.Browser.Node.Model.extend({
|
||||
model: pgBrowser.Node.Model.extend({
|
||||
initialize: function(attrs, args) {
|
||||
var isNew = (_.size(attrs) === 0);
|
||||
if (isNew) {
|
||||
@@ -579,7 +552,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
||||
this.set({'owner': userInfo.name}, {silent: true});
|
||||
}
|
||||
pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
pgBrowser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
defaults: {
|
||||
name: undefined,
|
||||
@@ -672,18 +645,18 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
id: 'relacl', label: '{{ _('Privileges') }}', cell: 'string',
|
||||
type: 'text', group: '{{ _('Security') }}',
|
||||
mode: ['properties'], min_version: 90200
|
||||
},{
|
||||
}, pgBrowser.SecurityGroupUnderSchema, {
|
||||
id: 'acl', label: '{{ _('Privileges') }}', model: pgAdmin
|
||||
.Browser.Node.PrivilegeRoleModel.extend(
|
||||
{privileges: ['a','r','w','x']}), uniqueCol : ['grantee', 'grantor'],
|
||||
editable: false, type: 'collection', group: '{{ _('Security') }}',
|
||||
editable: false, type: 'collection', group: 'security',
|
||||
mode: ['edit', 'create'],
|
||||
canAdd: true, canDelete: true, control: 'unique-col-collection',
|
||||
min_version: 90200
|
||||
},{
|
||||
id: 'seclabels', label: '{{ _('Security Labels') }}',
|
||||
model: SecurityModel, type: 'collection',
|
||||
group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
||||
model: pgBrowser.SecLabelModel, type: 'collection',
|
||||
group: 'security', mode: ['edit', 'create'],
|
||||
min_version: 90100, canAdd: true,
|
||||
canEdit: false, canDelete: true,
|
||||
control: 'unique-col-collection', uniqueCol : ['provider']
|
||||
|
||||
@@ -27,9 +27,9 @@ COMMENT ON FOREIGN TABLE {{ conn|qtIdent(data.basensp, data.name) }}
|
||||
{% endif -%}
|
||||
{% if data.seclabels %}
|
||||
{% for r in data.seclabels %}
|
||||
{% if r.security_label and r.provider %}
|
||||
{% if r.label and r.provider %}
|
||||
|
||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', data.name, r.provider, r.security_label, data.basensp) }}
|
||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', data.name, r.provider, r.label, data.basensp) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
@@ -87,13 +87,13 @@ ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
|
||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.security_label, o_data.basensp) }}
|
||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
|
||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.security_label, o_data.basensp) }}
|
||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if data.description is defined and data.description != o_data.description%}
|
||||
|
||||
@@ -36,8 +36,8 @@ COMMENT ON FOREIGN TABLE {{ conn|qtIdent(data.basensp, data.name) }}
|
||||
{% endif -%}
|
||||
{% if data.seclabels %}
|
||||
|
||||
{% for r in data.seclabels %}{% if r.security_label and r.provider %}
|
||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', data.name, r.provider, r.security_label, data.basensp) }}
|
||||
{% for r in data.seclabels %}{% if r.label and r.provider %}
|
||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', data.name, r.provider, r.label, data.basensp) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
@@ -126,13 +126,13 @@ ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
|
||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.security_label, o_data.basensp) }}
|
||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
|
||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.security_label, o_data.basensp) }}
|
||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if data.description is defined and data.description != o_data.description%}
|
||||
|
||||
@@ -52,9 +52,9 @@ COMMENT ON FOREIGN TABLE {{ conn|qtIdent(data.basensp, data.name) }}
|
||||
{% endif -%}
|
||||
{% if data.seclabels %}
|
||||
{% for r in data.seclabels %}
|
||||
{% if r.security_label and r.provider %}
|
||||
{% if r.label and r.provider %}
|
||||
|
||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', data.name, r.provider, r.security_label, data.basensp) }}
|
||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', data.name, r.provider, r.label, data.basensp) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
@@ -138,13 +138,13 @@ ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
|
||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.security_label, o_data.basensp) }}
|
||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
|
||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.security_label, o_data.basensp) }}
|
||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if data.description is defined and data.description != o_data.description%}
|
||||
|
||||
@@ -6,8 +6,8 @@ define(
|
||||
function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
|
||||
if (!pgBrowser.Nodes['coll-function']) {
|
||||
var functions = pgAdmin.Browser.Nodes['coll-function'] =
|
||||
pgAdmin.Browser.Collection.extend({
|
||||
var functions = pgBrowser.Nodes['coll-function'] =
|
||||
pgBrowser.Collection.extend({
|
||||
node: 'function',
|
||||
label: '{{ _('Functions') }}',
|
||||
type: 'coll-function',
|
||||
@@ -15,35 +15,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
});
|
||||
};
|
||||
|
||||
// Security Model
|
||||
var SecurityModel = Backform.SecurityModel = pgAdmin.Browser.Node.Model.extend({
|
||||
defaults: {
|
||||
provider: null,
|
||||
label: null
|
||||
},
|
||||
schema: [{
|
||||
id: 'provider', label: '{{ _('Provider') }}',
|
||||
type: 'text', editable: true, cellHeaderClasses:'width_percent_50'
|
||||
},{
|
||||
id: 'security_label', label: '{{ _('Security Label') }}',
|
||||
type: 'text', editable: true, cellHeaderClasses:'width_percent_50'
|
||||
}],
|
||||
validate: function() {
|
||||
var err = {},
|
||||
errmsg = null,
|
||||
data = this.toJSON();
|
||||
|
||||
if (_.isUndefined(data.label) ||
|
||||
_.isNull(data.label) ||
|
||||
String(data.label).replace(/^\s+|\s+$/g, '') == '') {
|
||||
return _("Please specify the value for all the security providers.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
// Argument Model
|
||||
var ArgumentModel = pgAdmin.Browser.Node.Model.extend({
|
||||
var ArgumentModel = pgBrowser.Node.Model.extend({
|
||||
idAttribute: 'argid',
|
||||
defaults: {
|
||||
argid: undefined,
|
||||
@@ -100,7 +73,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
});
|
||||
|
||||
if (!pgBrowser.Nodes['function']) {
|
||||
pgAdmin.Browser.Nodes['function'] = pgBrowser.Node.extend({
|
||||
pgBrowser.Nodes['function'] = pgBrowser.Node.extend({
|
||||
type: 'function',
|
||||
sqlAlterHelp: 'sql-alterfunction.html',
|
||||
sqlCreateHelp: 'sql-createfunction.html',
|
||||
@@ -142,7 +115,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
},
|
||||
canDrop: pgBrowser.Nodes['schema'].canChildDrop,
|
||||
canDropCascade: pgBrowser.Nodes['schema'].canChildDrop,
|
||||
model: pgAdmin.Browser.Node.Model.extend({
|
||||
model: pgBrowser.Node.Model.extend({
|
||||
initialize: function(attrs, args) {
|
||||
var isNew = (_.size(attrs) === 0);
|
||||
if (isNew) {
|
||||
@@ -154,7 +127,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
||||
this.set({'funcowner': userInfo.name}, {silent: true});
|
||||
}
|
||||
pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
pgBrowser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
defaults: {
|
||||
name: undefined,
|
||||
@@ -176,7 +149,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
procost: undefined, /* Estimated execution Cost */
|
||||
prorows: undefined, /* Estimated number of rows */
|
||||
proleakproof: undefined,
|
||||
arguments: [],
|
||||
args: [],
|
||||
prosrc: undefined,
|
||||
prosrc_c: undefined,
|
||||
probin: '$libdir/',
|
||||
@@ -273,13 +246,12 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
{'label': 'IMMUTABLE', 'value': 'i'},
|
||||
], disabled: 'isDisabled'
|
||||
},{
|
||||
id: 'proretset', label: '{{ _('Returns a set?') }}', group: '{{ _('Options') }}',
|
||||
cell:'boolean', type: 'switch', disabled: 'isDisabled',
|
||||
id: 'proretset', label: '{{ _('Returns a set?') }}', type: 'switch',
|
||||
disabled: 'isDisabled', group: '{{ _('Options') }}',
|
||||
visible: 'isVisible'
|
||||
},{
|
||||
id: 'proisstrict', label: '{{ _('Strict?') }}', group: '{{ _
|
||||
('Options') }}',
|
||||
cell:'boolean', type: 'switch', disabled: 'isDisabled',
|
||||
id: 'proisstrict', label: '{{ _('Strict?') }}', type: 'switch',
|
||||
group: '{{ _('Options') }}', disabled: 'isDisabled',
|
||||
options: {
|
||||
'onText': 'Yes', 'offText': 'No',
|
||||
'onColor': 'success', 'offColor': 'primary',
|
||||
@@ -287,7 +259,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
}
|
||||
},{
|
||||
id: 'prosecdef', label: '{{ _('Security of definer?') }}',
|
||||
group: '{{ _('Options') }}', cell:'boolean', type: 'switch',
|
||||
group: '{{ _('Options') }}', type: 'switch',
|
||||
disabled: 'isDisabled'
|
||||
},{
|
||||
id: 'proiswindow', label: '{{ _('Window?') }}',
|
||||
@@ -297,20 +269,18 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
id: 'procost', label: '{{ _('Estimated cost') }}', group: '{{ _('Options') }}',
|
||||
cell:'string', type: 'text', disabled: 'isDisabled'
|
||||
},{
|
||||
id: 'prorows', label: '{{ _('Estimated rows') }}', group: '{{ _
|
||||
('Options') }}',
|
||||
cell:'string', type: 'text', disabled: 'isDisabled',
|
||||
deps: ['proretset'], visible: 'isVisible'
|
||||
id: 'prorows', label: '{{ _('Estimated rows') }}', type: 'text',
|
||||
deps: ['proretset'], visible: 'isVisible', disabled: 'isDisabled',
|
||||
group: '{{ _('Options') }}'
|
||||
},{
|
||||
id: 'proleakproof', label: '{{ _('Leak proof?') }}',
|
||||
group: '{{ _('Options') }}', cell:'boolean', type: 'switch', min_version: 90200,
|
||||
disabled: 'isDisabled'
|
||||
},{
|
||||
id: 'proacl', label: '{{ _('Privileges') }}',
|
||||
group: '{{ _('Security') }}', cell:'boolean', type: 'text', cell: 'string',
|
||||
mode: ['properties']
|
||||
id: 'proacl', label: '{{ _('Privileges') }}', type: 'text',
|
||||
mode: ['properties'], group: '{{ _('Security') }}'
|
||||
},{
|
||||
id: 'arguments', label: '{{ _('Arguments') }}', cell: 'string',
|
||||
id: 'args', label: '{{ _('Arguments') }}', cell: 'string',
|
||||
group: '{{ _('Arguments') }}', type: 'collection', canAdd: function(m){
|
||||
return m.isNew();
|
||||
},
|
||||
@@ -320,26 +290,23 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
},{
|
||||
id: 'variables', label: '{{ _('Parameters') }}', type: 'collection',
|
||||
group: '{{ _('Parameters') }}', control: 'variable-collection',
|
||||
model: pgAdmin.Browser.Node.VariableModel,
|
||||
model: pgBrowser.Node.VariableModel,
|
||||
mode: ['edit', 'create'], canAdd: 'canVarAdd', canEdit: false,
|
||||
canDelete: true, disabled: 'isDisabled'
|
||||
}, pgBrowser.SecurityGroupUnderSchema, {
|
||||
id: 'acl', label: '{{ _('Privileges') }}', editable: false,
|
||||
model: pgBrowser.Node.PrivilegeRoleModel.extend({
|
||||
privileges: ['X']
|
||||
}), uniqueCol : ['grantee', 'grantor'], type: 'collection',
|
||||
group: 'security', mode: ['edit', 'create'], canAdd: true,
|
||||
canDelete: true, control: 'unique-col-collection',
|
||||
disabled: 'isDisabled'
|
||||
},{
|
||||
id: 'acl', label: '{{ _('Privileges') }}', model: pgAdmin
|
||||
.Browser.Node.PrivilegeRoleModel.extend(
|
||||
{privileges: ['X']}), uniqueCol : ['grantee', 'grantor'],
|
||||
editable: false, type: 'collection', group: '{{ _('Security') }}',
|
||||
mode: ['edit', 'create'],
|
||||
canAdd: true, canDelete: true, control: 'unique-col-collection',
|
||||
disabled: 'isDisabled'
|
||||
},
|
||||
{
|
||||
id: 'seclabels', label: '{{ _('Security Labels') }}',
|
||||
model: SecurityModel, type: 'collection',
|
||||
group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
||||
min_version: 90100, canAdd: true,
|
||||
canEdit: true, canDelete: true,
|
||||
control: 'unique-col-collection', uniqueCol : ['provider'],
|
||||
disabled: 'isDisabled'
|
||||
id: 'seclabels', label: '{{ _('Security Labels') }}', canAdd: true,
|
||||
model: pgBrowser.SecLabelModel, type: 'collection',
|
||||
min_version: 90100, group: 'security', mode: ['edit', 'create'],
|
||||
canEdit: true, canDelete: true, uniqueCol : ['provider'],
|
||||
disabled: 'isDisabled', control: 'unique-col-collection'
|
||||
}
|
||||
],
|
||||
validate: function()
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
{% import 'macros/functions/variable.macros' as VARIABLE %}
|
||||
{% set is_columns = [] %}
|
||||
{% if data %}
|
||||
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data.arguments %}
|
||||
{% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname)}} {% endif %}{% if p.argtype %}{{p.argtype}}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data.args %}
|
||||
{% for p in data.args %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname)}} {% endif %}{% if p.argtype %}{{ conn|qtIdent(p.argtype) }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
{% if not loop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
@@ -43,9 +43,9 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
|
||||
{% endif -%}
|
||||
{% if data.seclabels %}
|
||||
{% for r in data.seclabels %}
|
||||
{% if r.security_label and r.provider %}
|
||||
{% if r.label and r.provider %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', data.name, r.provider, r.security_label, data.pronamespace, data.func_args) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', data.name, r.provider, r.label, data.pronamespace, data.func_args) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
|
||||
@@ -11,8 +11,8 @@ ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, o_data.name) }}({{o_data.pro
|
||||
{% endif -%}
|
||||
{% if data.change_func %}
|
||||
|
||||
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.arguments %}
|
||||
{% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname) }} {% endif %}{% if p.argtype %}{{p.argtype}}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.args %}
|
||||
{% for p in data.args %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname) }} {% endif %}{% if p.argtype %}{{ conn|qtIdent(p.argtype) }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
{% if not loop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
@@ -84,12 +84,12 @@ ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({{ o_data.proargtyp
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}{% endif -%}
|
||||
{% if data.description is defined and data.description != o_data.description%}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
{% import 'macros/functions/variable.macros' as VARIABLE %}
|
||||
{% set is_columns = [] %}
|
||||
{% if data %}
|
||||
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data.arguments %}
|
||||
{% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname)}} {% endif %}{% if p.argtype %}{{p.argtype}}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data.args %}
|
||||
{% for p in data.args %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname)}} {% endif %}{% if p.argtype %}{{ conn|qtIdent(p.argtype) }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
{% if not loop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
@@ -47,9 +47,9 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
|
||||
{% endif -%}
|
||||
{% if data.seclabels %}
|
||||
{% for r in data.seclabels %}
|
||||
{% if r.security_label and r.provider %}
|
||||
{% if r.label and r.provider %}
|
||||
|
||||
{{ SECLABLE.SET(conn, 'FUNCTION', data.name, r.provider, r.security_label, data.pronamespace, data.func_args) }}
|
||||
{{ SECLABLE.SET(conn, 'FUNCTION', data.name, r.provider, r.label, data.pronamespace, data.func_args) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
|
||||
@@ -11,8 +11,8 @@ ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, o_data.name) }}({{o_data.pro
|
||||
{% endif -%}
|
||||
{% if data.change_func %}
|
||||
|
||||
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.arguments %}
|
||||
{% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{conn|qtIdent(p.argname)}} {% endif %}{% if p.argtype %}{{p.argtype}}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.args %}
|
||||
{% for p in data.args %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{conn|qtIdent(p.argname)}} {% endif %}{% if p.argtype %}{{ conn|qtIdent(p.argtype) }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
{% if not loop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
@@ -91,13 +91,13 @@ ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({{ o_data.proargtyp
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if data.description is defined and data.description != o_data.description%}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
{% set is_columns = [] %}
|
||||
{% if data %}
|
||||
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data
|
||||
.arguments %}
|
||||
{% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname)}}{% endif %}{% if p.argtype %}{{p.argtype}}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
.args %}
|
||||
{% for p in data.args %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname)}}{% endif %}{% if p.argtype %}{{ conn|qtIdent(p.argtype) }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
{% if not loop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
@@ -47,9 +47,9 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
|
||||
{% endif -%}
|
||||
{% if data.seclabels %}
|
||||
{% for r in data.seclabels %}
|
||||
{% if r.security_label and r.provider %}
|
||||
{% if r.label and r.provider %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', data.name, r.provider, r.security_label, data.pronamespace, data.func_args) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', data.name, r.provider, r.label, data.pronamespace, data.func_args) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
|
||||
@@ -12,8 +12,8 @@ o_data.proargtypenames }})
|
||||
{% endif -%}
|
||||
{% if data.change_func %}
|
||||
|
||||
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.arguments %}
|
||||
{% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname) }} {% endif %}{% if p.argtype %}{{p.argtype}}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.args %}
|
||||
{% for p in data.args %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname) }} {% endif %}{% if p.argtype %}{{ conn|qtIdent(p.argtype) }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
{% if not loop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
@@ -90,13 +90,13 @@ ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({{o_data.proargtype
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if data.description is defined and data.description != o_data.description%}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
{% import 'macros/functions/variable.macros' as VARIABLE %}
|
||||
{% set is_columns = [] %}
|
||||
{% if data %}
|
||||
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data.arguments %}
|
||||
{% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname)}} {% endif %}{% if p.argtype %}{{p.argtype}}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data.args %}
|
||||
{% for p in data.args %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname)}} {% endif %}{% if p.argtype %}{{ conn|qtIdent(p.argtype) }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
{% if not loop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
@@ -43,9 +43,9 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
|
||||
{% endif -%}
|
||||
{% if data.seclabels %}
|
||||
{% for r in data.seclabels %}
|
||||
{% if r.security_label and r.provider %}
|
||||
{% if r.label and r.provider %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', data.name, r.provider, r.security_label, data.pronamespace, data.func_args) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', data.name, r.provider, r.label, data.pronamespace, data.func_args) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
|
||||
@@ -11,8 +11,8 @@ ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, o_data.name) }}({{o_data.pro
|
||||
{% endif -%}
|
||||
{% if data.change_func %}
|
||||
|
||||
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.arguments %}
|
||||
{% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname) }} {% endif %}{% if p.argtype %}{{p.argtype}}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.args %}
|
||||
{% for p in data.args %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname) }} {% endif %}{% if p.argtype %}{{p.argtype}}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
{% if not loop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
@@ -84,12 +84,12 @@ ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({{ o_data.proargtyp
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}{% endif -%}
|
||||
{% if data.description is defined and data.description != o_data.description%}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
{% import 'macros/functions/variable.macros' as VARIABLE %}
|
||||
{% set is_columns = [] %}
|
||||
{% if data %}
|
||||
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data.arguments %}
|
||||
{% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname)}} {% endif %}{% if p.argtype %}{{p.argtype}}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data.args %}
|
||||
{% for p in data.args %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname)}} {% endif %}{% if p.argtype %}{{ conn|qtIdent(p.argtype) }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
{% if not loop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
@@ -47,9 +47,9 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
|
||||
{% endif -%}
|
||||
{% if data.seclabels %}
|
||||
{% for r in data.seclabels %}
|
||||
{% if r.security_label and r.provider %}
|
||||
{% if r.label and r.provider %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', data.name, r.provider, r.security_label, data.pronamespace, data.func_args) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', data.name, r.provider, r.label, data.pronamespace, data.func_args) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
|
||||
@@ -11,8 +11,8 @@ ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, o_data.name) }}({{o_data.pro
|
||||
{% endif -%}
|
||||
{% if data.change_func %}
|
||||
|
||||
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.arguments %}
|
||||
{% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{conn|qtIdent(p.argname)}} {% endif %}{% if p.argtype %}{{p.argtype}}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.args %}
|
||||
{% for p in data.args %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{conn|qtIdent(p.argname)}} {% endif %}{% if p.argtype %}{{ conn|qtIdent(p.argtype) }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
{% if not loop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
@@ -91,13 +91,13 @@ ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({{ o_data.proargtyp
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if data.description is defined and data.description != o_data.description%}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
{% set is_columns = [] %}
|
||||
{% if data %}
|
||||
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data
|
||||
.arguments %}
|
||||
{% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname)}}{% endif %}{% if p.argtype %}{{p.argtype}}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
.args %}
|
||||
{% for p in data.args %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname)}}{% endif %}{% if p.argtype %}{{ conn|qtIdent(p.argtype) }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
{% if not loop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
@@ -47,9 +47,9 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
|
||||
{% endif -%}
|
||||
{% if data.seclabels %}
|
||||
{% for r in data.seclabels %}
|
||||
{% if r.security_label and r.provider %}
|
||||
{% if r.label and r.provider %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', data.name, r.provider, r.security_label, data.pronamespace, data.func_args) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', data.name, r.provider, r.label, data.pronamespace, data.func_args) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
|
||||
@@ -12,8 +12,8 @@ o_data.proargtypenames }})
|
||||
{% endif -%}
|
||||
{% if data.change_func %}
|
||||
|
||||
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.arguments %}
|
||||
{% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname) }} {% endif %}{% if p.argtype %}{{p.argtype}}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.args %}
|
||||
{% for p in data.args %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname) }} {% endif %}{% if p.argtype %}{{ conn|qtIdent(p.argtype) }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
{% if not loop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
@@ -90,13 +90,13 @@ ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({{o_data.proargtype
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if data.description is defined and data.description != o_data.description%}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
{% import 'macros/functions/variable.macros' as VARIABLE %}
|
||||
{% set is_columns = [] %}
|
||||
{% if data %}
|
||||
CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.arguments %}(
|
||||
{% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname)}} {% endif %}{% if p.argtype %}{{p.argtype}}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.args %}(
|
||||
{% for p in data.args %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname)}} {% endif %}{% if p.argtype %}{{ conn|qtIdent(p.argtype) }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
{% if not loop.last %},{% endif %}
|
||||
{% endfor %})
|
||||
{% endif %}
|
||||
|
||||
@@ -11,7 +11,7 @@ ALTER PROCEDURE {{ conn|qtIdent(o_data.pronamespace, o_data.name) }}{% if o_data
|
||||
|
||||
{% endif -%}
|
||||
{% if data.change_func %}
|
||||
CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(o_data.pronamespace, name) }}{% if data.arguments %}({% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname) }} {% endif %}{% if p.argtype %}{{p.argtype}}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(o_data.pronamespace, name) }}{% if data.args %}({% for p in data.args %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname) }} {% endif %}{% if p.argtype %}{{ conn|qtIdent(p.argtype) }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
{% if not loop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
)
|
||||
@@ -59,13 +59,13 @@ ALTER PROCEDURE {{ conn|qtIdent(o_data.pronamespace, name) }}{% if o_data.proarg
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'PROCEDURE', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'PROCEDURE', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'PROCEDURE', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'PROCEDURE', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if data.description is defined and data.description != o_data.description%}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
{% import 'macros/functions/variable.macros' as VARIABLE %}
|
||||
{% set is_columns = [] %}
|
||||
{% if data %}
|
||||
CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.arguments %}
|
||||
({% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %} {{ conn|qtIdent(p.argname)}}{% endif %}{% if p.argtype %}{{p.argtype}}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.args %}
|
||||
({% for p in data.args %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %} {{ conn|qtIdent(p.argname)}}{% endif %}{% if p.argtype %}{{ conn|qtIdent(p.argtype) }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
{% if not loop.last %}, {% endif %}
|
||||
{% endfor -%}){% endif %}
|
||||
|
||||
@@ -22,9 +22,9 @@ COMMENT ON PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}
|
||||
{% endif -%}
|
||||
{% if data.seclabels %}
|
||||
{% for r in data.seclabels %}
|
||||
{% if r.security_label and r.provider %}
|
||||
{% if r.label and r.provider %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'PROCEDURE', data.name, r.provider, r.security_label, data.pronamespace, data.func_args) }}
|
||||
{{ SECLABEL.SET(conn, 'PROCEDURE', data.name, r.provider, r.label, data.pronamespace, data.func_args) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
|
||||
@@ -10,7 +10,7 @@ ALTER PROCEDURE {{ conn|qtIdent(o_data.pronamespace, o_data.name) }}
|
||||
{% endif -%}
|
||||
{% if data.change_func %}
|
||||
|
||||
CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(o_data.pronamespace, name) }}{% if data.arguments %}({% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname) }} {% endif %}{% if p.argtype %}{{p.argtype}}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(o_data.pronamespace, name) }}{% if data.args %}({% for p in data.args %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname) }} {% endif %}{% if p.argtype %}{{ conn|qtIdent(p.argtype) }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
{% if not loop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
)
|
||||
@@ -55,13 +55,13 @@ ALTER PROCEDURE {{ conn|qtIdent(o_data.pronamespace, name) }}{% if o_data.proarg
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'PROCEDURE', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'PROCEDURE', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'PROCEDURE', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'PROCEDURE', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if data.description is defined and data.description != o_data.description%}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
{% import 'macros/functions/variable.macros' as VARIABLE %}
|
||||
{% set is_columns = [] %}
|
||||
{% if data %}
|
||||
CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.arguments %}
|
||||
({% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname)}} {% endif %}{% if p.argtype %}{{p.argtype}}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.args %}
|
||||
({% for p in data.args %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname)}} {% endif %}{% if p.argtype %}{{ conn|qtIdent(p.argtype) }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
{% if not loop.last %}, {% endif %}
|
||||
{% endfor -%}){% endif %}
|
||||
|
||||
@@ -33,9 +33,9 @@ COMMENT ON PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}
|
||||
{% endif -%}
|
||||
{% if data.seclabels %}
|
||||
{% for r in data.seclabels %}
|
||||
{% if r.security_label and r.provider %}
|
||||
{% if r.label and r.provider %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'PROCEDURE', data.name, r.provider, r.security_label, data.pronamespace, data.func_args) }}
|
||||
{{ SECLABEL.SET(conn, 'PROCEDURE', data.name, r.provider, r.label, data.pronamespace, data.func_args) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
|
||||
@@ -10,7 +10,7 @@ ALTER PROCEDURE {{ conn|qtIdent(o_data.pronamespace, o_data.name) }}
|
||||
{% endif %}
|
||||
{% endif -%}
|
||||
{% if data.change_func %}
|
||||
CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(o_data.pronamespace, name) }}{% if data.arguments %}({% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname) }} {% endif %}{% if p.argtype %}{{p.argtype}}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(o_data.pronamespace, name) }}{% if data.args %}({% for p in data.args %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname) }} {% endif %}{% if p.argtype %}{{ conn|qtIdent(p.argtype) }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
|
||||
{% if not loop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
)
|
||||
@@ -79,13 +79,13 @@ ALTER PROCEDURE {{ conn|qtIdent(o_data.pronamespace, name) }}{% if o_data.proarg
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'PROCEDURE', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'PROCEDURE', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'PROCEDURE', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'PROCEDURE', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if data.description is defined and data.description != o_data.description%}
|
||||
|
||||
@@ -6,8 +6,8 @@ define(
|
||||
function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
|
||||
if (!pgBrowser.Nodes['coll-trigger_function']) {
|
||||
var trigger_functions = pgAdmin.Browser.Nodes['coll-trigger_function'] =
|
||||
pgAdmin.Browser.Collection.extend({
|
||||
var trigger_functions = pgBrowser.Nodes['coll-trigger_function'] =
|
||||
pgBrowser.Collection.extend({
|
||||
node: 'trigger_function',
|
||||
label: '{{ _('Trigger functions') }}',
|
||||
type: 'coll-trigger_function',
|
||||
@@ -16,7 +16,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
};
|
||||
|
||||
if (!pgBrowser.Nodes['trigger_function']) {
|
||||
pgAdmin.Browser.Nodes['trigger_function'] = pgBrowser.Node.extend({
|
||||
pgBrowser.Nodes['trigger_function'] = pgBrowser.Node.extend({
|
||||
type: 'trigger_function',
|
||||
sqlAlterHelp: 'plpgsql-trigger.html',
|
||||
sqlCreateHelp: 'plpgsql-trigger.html',
|
||||
@@ -57,7 +57,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
},
|
||||
canDrop: pgBrowser.Nodes['schema'].canChildDrop,
|
||||
canDropCascade: pgBrowser.Nodes['schema'].canChildDrop,
|
||||
model: pgAdmin.Browser.Node.Model.extend({
|
||||
model: pgBrowser.Node.Model.extend({
|
||||
initialize: function(attrs, args) {
|
||||
var isNew = (_.size(attrs) === 0);
|
||||
if (isNew) {
|
||||
@@ -69,7 +69,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
||||
this.set({'funcowner': userInfo.name}, {silent: true});
|
||||
}
|
||||
pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
pgBrowser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
defaults: {
|
||||
name: undefined,
|
||||
@@ -91,7 +91,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
procost: undefined, /* Estimated execution Cost */
|
||||
prorows: undefined, /* Estimated number of rows */
|
||||
proleakproof: undefined,
|
||||
arguments: [],
|
||||
args: [],
|
||||
prosrc: undefined,
|
||||
prosrc_c: undefined,
|
||||
probin: '$libdir/',
|
||||
@@ -194,13 +194,12 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
{'label': 'IMMUTABLE', 'value': 'i'},
|
||||
], disabled: 'isDisabled', select2: { allowClear: false }
|
||||
},{
|
||||
id: 'proretset', label: '{{ _('Returns a set?') }}', group: '{{ _('Options') }}',
|
||||
cell:'boolean', type: 'switch', disabled: 'isDisabled',
|
||||
id: 'proretset', label: '{{ _('Returns a set?') }}', type: 'switch',
|
||||
group: '{{ _('Options') }}', disabled: 'isDisabled',
|
||||
visible: 'isVisible'
|
||||
},{
|
||||
id: 'proisstrict', label: '{{ _('Strict?') }}', group: '{{ _
|
||||
('Options') }}',
|
||||
cell:'boolean', type: 'switch', disabled: 'isDisabled',
|
||||
id: 'proisstrict', label: '{{ _('Strict?') }}', type: 'switch',
|
||||
disabled: 'isDisabled', group: '{{ _('Options') }}',
|
||||
options: {
|
||||
'onText': 'Yes', 'offText': 'No',
|
||||
'onColor': 'success', 'offColor': 'primary',
|
||||
@@ -215,46 +214,40 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
group: '{{ _('Options') }}', cell:'boolean', type: 'switch',
|
||||
disabled: 'isDisabled', visible: 'isVisible'
|
||||
},{
|
||||
id: 'procost', label: '{{ _('Estimated cost') }}', group: '{{ _('Options') }}',
|
||||
cell:'string', type: 'text', disabled: 'isDisabled'
|
||||
id: 'procost', label: '{{ _('Estimated cost') }}', type: 'text',
|
||||
group: '{{ _('Options') }}', disabled: 'isDisabled'
|
||||
},{
|
||||
id: 'prorows', label: '{{ _('Estimated rows') }}', group: '{{ _
|
||||
('Options') }}',
|
||||
cell:'string', type: 'text', disabled: 'isDisabled',
|
||||
id: 'prorows', label: '{{ _('Estimated rows') }}', type: 'text',
|
||||
group: '{{ _('Options') }}',
|
||||
disabled: 'isDisabled',
|
||||
deps: ['proretset'], visible: 'isVisible'
|
||||
},{
|
||||
id: 'proleakproof', label: '{{ _('Leak proof?') }}',
|
||||
group: '{{ _('Options') }}', cell:'boolean', type: 'switch', min_version: 90200,
|
||||
disabled: 'isDisabled'
|
||||
},{
|
||||
id: 'proacl', label: '{{ _('Privileges') }}',
|
||||
group: '{{ _('Security') }}', cell:'boolean', type: 'text', cell: 'string',
|
||||
mode: ['properties']
|
||||
}, pgBrowser.SecurityGroupUnderSchema, {
|
||||
id: 'proacl', label: '{{ _('Privileges') }}', mode: ['properties'],
|
||||
group: '{{ _('Security') }}', type: 'text'
|
||||
},{
|
||||
id: 'variables', label: '{{ _('Parameters') }}', type: 'collection',
|
||||
group: '{{ _('Parameters') }}', control: 'variable-collection',
|
||||
model: pgAdmin.Browser.Node.VariableModel,
|
||||
model: pgBrowser.Node.VariableModel,
|
||||
mode: ['edit', 'create'], canAdd: 'canVarAdd', canEdit: false,
|
||||
canDelete: true, disabled: 'isDisabled'
|
||||
},{
|
||||
id: 'acl', label: '{{ _('Privileges') }}', model: pgAdmin
|
||||
.Browser.Node.PrivilegeRoleModel.extend(
|
||||
{privileges: ['X']}), uniqueCol : ['grantee', 'grantor'],
|
||||
editable: false, type: 'collection', group: '{{ _('Security') }}',
|
||||
mode: ['edit', 'create'],
|
||||
canAdd: true, canDelete: true, control: 'unique-col-collection',
|
||||
disabled: 'isDisabled'
|
||||
},
|
||||
{
|
||||
id: 'seclabels', label: '{{ _('Security Labels') }}',
|
||||
model: Backform.SecurityModel, type: 'collection',
|
||||
group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
||||
min_version: 90100, canAdd: true,
|
||||
canEdit: true, canDelete: true,
|
||||
control: 'unique-col-collection', uniqueCol : ['provider'],
|
||||
disabled: 'isDisabled'
|
||||
}
|
||||
],
|
||||
id: 'acl', label: '{{ _('Privileges') }}', editable: false,
|
||||
type: 'collection', group: 'security', mode: ['edit', 'create'],
|
||||
model: pgBrowser.Node.PrivilegeRoleModel.extend({
|
||||
privileges: ['X']
|
||||
}), uniqueCol : ['grantee', 'grantor'], disabled: 'isDisabled',
|
||||
canAdd: true, canDelete: true, control: 'unique-col-collection'
|
||||
},{
|
||||
id: 'seclabels', label: '{{ _('Security Labels') }}', canEdit: true,
|
||||
model: pgBrowser.SecLabelModel, type: 'collection',
|
||||
min_version: 90100, group: 'security', mode: ['edit', 'create'],
|
||||
canDelete: true, control: 'unique-col-collection', canAdd: true,
|
||||
uniqueCol : ['provider'], disabled: 'isDisabled'
|
||||
}],
|
||||
validate: function(keys)
|
||||
{
|
||||
var err = {},
|
||||
|
||||
@@ -38,9 +38,9 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
|
||||
{% endif -%}
|
||||
{% if data.seclabels %}
|
||||
{% for r in data.seclabels %}
|
||||
{% if r.security_label and r.provider %}
|
||||
{% if r.label and r.provider %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', data.name, r.provider, r.security_label, data.pronamespace, data.func_args) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', data.name, r.provider, r.label, data.pronamespace, data.func_args) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
|
||||
@@ -79,12 +79,12 @@ ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({{ o_data.proargtyp
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}{% endif -%}
|
||||
{% if data.description is defined and data.description != o_data.description%}
|
||||
|
||||
|
||||
@@ -42,9 +42,9 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
|
||||
{% endif -%}
|
||||
{% if data.seclabels %}
|
||||
{% for r in data.seclabels %}
|
||||
{% if r.security_label and r.provider %}
|
||||
{% if r.label and r.provider %}
|
||||
|
||||
{{ SECLABLE.SET(conn, 'FUNCTION', data.name, r.provider, r.security_label, data.pronamespace, data.func_args) }}
|
||||
{{ SECLABLE.SET(conn, 'FUNCTION', data.name, r.provider, r.label, data.pronamespace, data.func_args) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
|
||||
@@ -86,13 +86,13 @@ ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({{ o_data.proargtyp
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if data.description is defined and data.description != o_data.description%}
|
||||
|
||||
@@ -41,9 +41,9 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
|
||||
{% endif -%}
|
||||
{% if data.seclabels %}
|
||||
{% for r in data.seclabels %}
|
||||
{% if r.security_label and r.provider %}
|
||||
{% if r.label and r.provider %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', data.name, r.provider, r.security_label, data.pronamespace, data.func_args) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', data.name, r.provider, r.label, data.pronamespace, data.func_args) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
|
||||
@@ -85,13 +85,13 @@ ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({{o_data.proargtype
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if data.description is defined and data.description != o_data.description%}
|
||||
|
||||
@@ -38,9 +38,9 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
|
||||
{% endif -%}
|
||||
{% if data.seclabels %}
|
||||
{% for r in data.seclabels %}
|
||||
{% if r.security_label and r.provider %}
|
||||
{% if r.label and r.provider %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', data.name, r.provider, r.security_label, data.pronamespace, data.func_args) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', data.name, r.provider, r.label, data.pronamespace, data.func_args) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
|
||||
@@ -79,12 +79,12 @@ ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({{ o_data.proargtyp
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}{% endif -%}
|
||||
{% if data.description is defined and data.description != o_data.description%}
|
||||
|
||||
|
||||
@@ -42,9 +42,9 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
|
||||
{% endif -%}
|
||||
{% if data.seclabels %}
|
||||
{% for r in data.seclabels %}
|
||||
{% if r.security_label and r.provider %}
|
||||
{% if r.label and r.provider %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', data.name, r.provider, r.security_label, data.pronamespace, data.func_args) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', data.name, r.provider, r.label, data.pronamespace, data.func_args) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
|
||||
@@ -86,13 +86,13 @@ ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({{ o_data.proargtyp
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if data.description is defined and data.description != o_data.description%}
|
||||
|
||||
@@ -41,9 +41,9 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
|
||||
{% endif -%}
|
||||
{% if data.seclabels %}
|
||||
{% for r in data.seclabels %}
|
||||
{% if r.security_label and r.provider %}
|
||||
{% if r.label and r.provider %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', data.name, r.provider, r.security_label, data.pronamespace, data.func_args) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', data.name, r.provider, r.label, data.pronamespace, data.func_args) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
|
||||
@@ -85,13 +85,13 @@ ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({{o_data.proargtype
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.security_label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
{% if data.description is defined and data.description != o_data.description%}
|
||||
|
||||
@@ -241,7 +241,7 @@ class SequenceView(PGChildNodeView):
|
||||
sec = re.search(r'([^=]+)=(.*$)', sec)
|
||||
sec_lbls.append({
|
||||
'provider': sec.group(1),
|
||||
'security_label': sec.group(2)
|
||||
'label': sec.group(2)
|
||||
})
|
||||
res['securities'] = sec_lbls
|
||||
|
||||
@@ -599,7 +599,7 @@ class SequenceView(PGChildNodeView):
|
||||
seclabels = []
|
||||
for seclbls in data['securities']:
|
||||
k, v = seclbls.split('=')
|
||||
seclabels.append({'provider': k, 'security_label': v})
|
||||
seclabels.append({'provider': k, 'label': v})
|
||||
|
||||
data['securities'] = seclabels
|
||||
|
||||
|
||||
@@ -2,44 +2,10 @@ define(
|
||||
['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'],
|
||||
function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
|
||||
// Extend the browser's node model class to create a security model
|
||||
var SecurityModel = pgAdmin.Browser.Node.Model.extend({
|
||||
defaults: {
|
||||
provider: undefined,
|
||||
securitylabel: undefined
|
||||
},
|
||||
// Define the schema for the Security Label
|
||||
schema: [{
|
||||
id: 'provider', label: '{{ _('Provider') }}',
|
||||
type: 'text', editable: true,
|
||||
cellHeaderClasses:'width_percent_50'
|
||||
},{
|
||||
id: 'security_label', label: '{{ _('Security Label') }}',
|
||||
type: 'text', editable: true,
|
||||
cellHeaderClasses:'width_percent_50'
|
||||
}],
|
||||
/* validate function is used to validate the input given by
|
||||
* the user. In case of error, message will be displayed on
|
||||
* the GUI for the respective control.
|
||||
*/
|
||||
validate: function() {
|
||||
var err = {},
|
||||
errmsg = null,
|
||||
data = this.toJSON();
|
||||
|
||||
if (_.isUndefined(data.label) ||
|
||||
_.isNull(data.label) ||
|
||||
String(data.label).replace(/^\s+|\s+$/g, '') == '') {
|
||||
return _("Please specify the value for all the security providers.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
// Extend the browser's collection class for sequence collection
|
||||
if (!pgBrowser.Nodes['coll-sequence']) {
|
||||
var databases = pgAdmin.Browser.Nodes['coll-sequence'] =
|
||||
pgAdmin.Browser.Collection.extend({
|
||||
var databases = pgBrowser.Nodes['coll-sequence'] =
|
||||
pgBrowser.Collection.extend({
|
||||
node: 'sequence',
|
||||
label: '{{ _('Sequences') }}',
|
||||
type: 'coll-sequence',
|
||||
@@ -49,7 +15,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
|
||||
// Extend the browser's node class for sequence node
|
||||
if (!pgBrowser.Nodes['sequence']) {
|
||||
pgAdmin.Browser.Nodes['sequence'] = pgBrowser.Node.extend({
|
||||
pgBrowser.Nodes['sequence'] = pgBrowser.Node.extend({
|
||||
type: 'sequence',
|
||||
sqlAlterHelp: 'sql-altersequence.html',
|
||||
sqlCreateHelp: 'sql-createsequence.html',
|
||||
@@ -58,7 +24,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
collection_type: 'coll-sequence',
|
||||
hasSQL: true,
|
||||
hasDepends: true,
|
||||
parent_type: ['schema'],
|
||||
parent_type: ['schema', 'catalog'],
|
||||
Init: function() {
|
||||
/* Avoid mulitple registration of menus */
|
||||
if (this.initialized)
|
||||
@@ -119,7 +85,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
return true;
|
||||
},
|
||||
// Define the model for sequence node.
|
||||
model: pgAdmin.Browser.Node.Model.extend({
|
||||
model: pgBrowser.Node.Model.extend({
|
||||
defaults: {
|
||||
name: undefined,
|
||||
oid: undefined,
|
||||
@@ -148,7 +114,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
this.set({'seqowner': userInfo.name}, {silent: true});
|
||||
this.set({'schema': schemaInfo.label}, {silent: true});
|
||||
}
|
||||
pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
pgBrowser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
|
||||
// Define the schema for sequence node.
|
||||
@@ -202,21 +168,23 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
'onColor': 'success', 'offColor': 'primary',
|
||||
'size': 'small'
|
||||
}
|
||||
},{
|
||||
}, pgBrowser.SecurityGroupUnderSchema,{
|
||||
id: 'acl', label: '{{ _('Privileges') }}', type: 'text',
|
||||
group: '{{ _('Security') }}', mode: ['properties'], disabled: true
|
||||
group: '{{ _("Security") }}', mode: ['properties'], disabled: true
|
||||
},{
|
||||
id: 'relacl', label: '{{ _('Privileges') }}', model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend(
|
||||
{privileges: ['r', 'w', 'U']}), uniqueCol : ['grantee', 'grantor'],
|
||||
editable: false, type: 'collection', group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
||||
canAdd: true, canDelete: true, control: 'unique-col-collection',
|
||||
id: 'relacl', label: '{{ _('Privileges') }}', group: 'security',
|
||||
model: pgBrowser.Node.PrivilegeRoleModel.extend({
|
||||
privileges: ['r', 'w', 'U']
|
||||
}), uniqueCol : ['grantee', 'grantor'], mode: ['edit', 'create'],
|
||||
editable: false, type: 'collection', canAdd: true, canDelete: true,
|
||||
control: 'unique-col-collection',
|
||||
},{
|
||||
id: 'securities', label: '{{ _('Securitiy Labels') }}', model: SecurityModel,
|
||||
editable: false, type: 'collection', canEdit: false,
|
||||
group: '{{ _('Security') }}', canDelete: true,
|
||||
mode: ['edit', 'create'], canAdd: true,
|
||||
control: 'unique-col-collection', uniqueCol : ['provider'],
|
||||
min_version: 90200
|
||||
id: 'securities', label: '{{ _('Securitiy Labels') }}', canAdd: true,
|
||||
model: pgBrowser.SecLabelModel, editable: false,
|
||||
type: 'collection', canEdit: false, group: 'security',
|
||||
mode: ['edit', 'create'], canDelete: true,
|
||||
control: 'unique-col-collection',
|
||||
min_version: 90200, uniqueCol : ['provider']
|
||||
}],
|
||||
/* validate function is used to validate the input given by
|
||||
* the user. In case of error, message will be displayed on
|
||||
|
||||
@@ -15,7 +15,7 @@ COMMENT ON SEQUENCE {{ seqname }}
|
||||
{% if data.securities %}
|
||||
|
||||
{% for r in data.securities %}
|
||||
{{ SECLABLE.SET(conn, 'SEQUENCE', data.name, r.provider, r.security_label, data.schema) }}
|
||||
{{ SECLABLE.SET(conn, 'SEQUENCE', data.name, r.provider, r.label, data.schema) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if data.relacl %}
|
||||
|
||||
@@ -63,12 +63,12 @@ COMMENT ON SEQUENCE {{ seqname }}
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABLE.SET(conn, 'SEQUENCE', data.name, r.provider, r.security_label, schema) }}
|
||||
{{ SECLABLE.SET(conn, 'SEQUENCE', data.name, r.provider, r.label, schema) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABLE.SET(conn, 'SEQUENCE', data.name, r.provider, r.security_label, schema) }}
|
||||
{{ SECLABLE.SET(conn, 'SEQUENCE', data.name, r.provider, r.label, schema) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -4,8 +4,8 @@ define(
|
||||
function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||
|
||||
if (!pgBrowser.Nodes['coll-column']) {
|
||||
var databases = pgAdmin.Browser.Nodes['coll-column'] =
|
||||
pgAdmin.Browser.Collection.extend({
|
||||
var databases = pgBrowser.Nodes['coll-column'] =
|
||||
pgBrowser.Collection.extend({
|
||||
node: 'column',
|
||||
label: '{{ _('Columns') }}',
|
||||
type: 'coll-column',
|
||||
@@ -14,7 +14,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||
};
|
||||
|
||||
// This Node model will be used for variable control for column
|
||||
var VariablesModel = Backform.VariablesModel = pgAdmin.Browser.Node.Model.extend({
|
||||
var VariablesModel = Backform.VariablesModel = pgBrowser.Node.Model.extend({
|
||||
defaults: {
|
||||
name: null,
|
||||
value: null
|
||||
@@ -49,7 +49,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||
});
|
||||
|
||||
if (!pgBrowser.Nodes['column']) {
|
||||
pgAdmin.Browser.Nodes['column'] = pgAdmin.Browser.Node.extend({
|
||||
pgBrowser.Nodes['column'] = pgBrowser.Node.extend({
|
||||
parent_type: ['table', 'view', 'mview'],
|
||||
collection_type: ['coll-table', 'coll-view', 'coll-mview'],
|
||||
type: 'column',
|
||||
@@ -115,7 +115,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||
}
|
||||
]);
|
||||
},
|
||||
model: pgAdmin.Browser.Node.Model.extend({
|
||||
model: pgBrowser.Node.Model.extend({
|
||||
defaults: {
|
||||
name: undefined,
|
||||
attowner: undefined,
|
||||
@@ -190,7 +190,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||
}
|
||||
},{
|
||||
id: 'attnum', label:'{{ _('Position') }}', cell: 'string',
|
||||
type: 'text', disabled: 'inSchema', mode: ['properties']
|
||||
type: 'text', disabled: 'notInSchema', mode: ['properties']
|
||||
},{
|
||||
id: 'cltype', label:'{{ _('Data type') }}', cell: 'node-ajax-options',
|
||||
type: 'text', disabled: 'inSchemaWithColumnCheck',
|
||||
@@ -379,29 +379,27 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||
},{
|
||||
id: 'description', label:'{{ _('Comment') }}', cell: 'string',
|
||||
type: 'multiline', mode: ['properties', 'create', 'edit'],
|
||||
disabled: 'inSchema'
|
||||
disabled: 'notInSchema'
|
||||
},{
|
||||
id: 'attoptions', label: 'Variables', type: 'collection',
|
||||
group: '{{ _('Variables') }}', control: 'unique-col-collection',
|
||||
model: VariablesModel, uniqueCol : ['name'],
|
||||
mode: ['edit', 'create'], canAdd: true, canEdit: false,
|
||||
canDelete: true
|
||||
},{
|
||||
}, pgBrowser.SecurityGroupUnderSchema, {
|
||||
id: 'attacl', label: 'Privileges', type: 'collection',
|
||||
group: '{{ _('Security') }}', control: 'unique-col-collection',
|
||||
model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend({
|
||||
group: 'security', control: 'unique-col-collection',
|
||||
model: pgBrowser.Node.PrivilegeRoleModel.extend({
|
||||
privileges: ['a','r','w','x']}),
|
||||
mode: ['edit'], canAdd: true, canDelete: true,
|
||||
uniqueCol : ['grantee']
|
||||
},{
|
||||
id: 'seclabels', label: '{{ _('Security Labels') }}',
|
||||
model: pgAdmin.Browser.SecurityModel,
|
||||
editable: false, type: 'collection',
|
||||
group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
||||
min_version: 90100, canAdd: true,
|
||||
canEdit: false, canDelete: true, control: 'unique-col-collection'
|
||||
}
|
||||
],
|
||||
id: 'seclabels', label: '{{ _('Security Labels') }}', canAdd: true,
|
||||
model: pgBrowser.SecLabelModel, group: 'security',
|
||||
mode: ['edit', 'create'], editable: false, type: 'collection',
|
||||
min_version: 90100, canEdit: false, canDelete: true,
|
||||
control: 'unique-col-collection'
|
||||
}],
|
||||
validate: function(keys) {
|
||||
var err = {},
|
||||
changedAttrs = this.changed,
|
||||
@@ -463,10 +461,8 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||
|
||||
return null;
|
||||
},
|
||||
isInhertedColumn: function() {
|
||||
},
|
||||
// We will check if we are under schema node & in 'create' mode
|
||||
inSchema: function() {
|
||||
notInSchema: function() {
|
||||
if(this.node_info && 'catalog' in this.node_info)
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -7,8 +7,8 @@ define(
|
||||
function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
|
||||
if (!pgBrowser.Nodes['coll-table']) {
|
||||
var databases = pgAdmin.Browser.Nodes['coll-table'] =
|
||||
pgAdmin.Browser.Collection.extend({
|
||||
var databases = pgBrowser.Nodes['coll-table'] =
|
||||
pgBrowser.Collection.extend({
|
||||
node: 'table',
|
||||
label: '{{ _('Tables') }}',
|
||||
type: 'coll-table',
|
||||
@@ -17,7 +17,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
};
|
||||
|
||||
if (!pgBrowser.Nodes['table']) {
|
||||
pgAdmin.Browser.Nodes['table'] = pgBrowser.Node.extend({
|
||||
pgBrowser.Nodes['table'] = pgBrowser.Node.extend({
|
||||
type: 'table',
|
||||
label: '{{ _('Table') }}',
|
||||
collection_type: 'coll-table',
|
||||
@@ -242,7 +242,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
});
|
||||
}
|
||||
},
|
||||
model: pgAdmin.Browser.Node.Model.extend({
|
||||
model: pgBrowser.Node.Model.extend({
|
||||
defaults: {
|
||||
name: undefined,
|
||||
oid: undefined,
|
||||
@@ -283,7 +283,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
this.set({'relowner': userInfo.name}, {silent: true});
|
||||
this.set({'schema': schemaInfo.label}, {silent: true});
|
||||
}
|
||||
pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
pgBrowser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
|
||||
},
|
||||
schema: [{
|
||||
@@ -500,7 +500,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
type: 'text', mode: ['properties'], group: '{{ _('Advanced') }}',
|
||||
disabled: 'inSchema'
|
||||
},{
|
||||
// Here we will create tab control for columns
|
||||
// Tab control for columns
|
||||
id: 'columns', label:'{{ _('Columns') }}', type: 'collection',
|
||||
group: '{{ _('Columns') }}',
|
||||
model: pgBrowser.Nodes['column'].model,
|
||||
@@ -715,24 +715,22 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
id: 'relacl_str', label:'{{ _('Privileges') }}', cell: 'string',
|
||||
type: 'text', mode: ['properties'], group: '{{ _('Security') }}',
|
||||
disabled: 'inSchema'
|
||||
},{
|
||||
id: 'relacl', label: 'Privileges', type: 'collection',
|
||||
group: '{{ _('Security') }}', control: 'unique-col-collection',
|
||||
model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend({
|
||||
}, pgBrowser.SecurityGroupUnderSchema,{
|
||||
id: 'relacl', label: '{{ _('Privileges') }}', type: 'collection',
|
||||
group: 'security', control: 'unique-col-collection',
|
||||
model: pgBrowser.Node.PrivilegeRoleModel.extend({
|
||||
privileges: ['a','r','w','d','D','x','t']}),
|
||||
mode: ['edit', 'create'], canAdd: true, canDelete: true,
|
||||
uniqueCol : ['grantee']
|
||||
},{
|
||||
id: 'seclabels', label: '{{ _('Security labels') }}',
|
||||
model: pgAdmin.Browser.SecurityModel, editable: false, type: 'collection',
|
||||
group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
||||
min_version: 90100, canAdd: true,
|
||||
canEdit: false, canDelete: true, control: 'unique-col-collection'
|
||||
id: 'seclabels', label: '{{ _('Security labels') }}', canEdit: false,
|
||||
model: pgBrowser.SecLabelModel, editable: false, canAdd: true,
|
||||
type: 'collection', min_version: 90100, mode: ['edit', 'create'],
|
||||
group: 'security', canDelete: true, control: 'unique-col-collection'
|
||||
},{
|
||||
id: 'vacuum_settings_str', label: '{{ _('Storage settings') }}',
|
||||
type: 'multiline', group: '{{ _('Advanced') }}', mode: ['properties']
|
||||
}
|
||||
],
|
||||
}],
|
||||
validate: function(keys) {
|
||||
var err = {},
|
||||
changedAttrs = this.changed,
|
||||
@@ -789,11 +787,10 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
// We will disable it if Oftype is defined
|
||||
// Oftype is defined?
|
||||
checkInheritance: function(m) {
|
||||
// coll_inherits || typname
|
||||
if(!m.inSchema.apply(this, [m]) &&
|
||||
@@ -872,20 +869,19 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
url = 'get_columns',
|
||||
m = self.model.top || self.model,
|
||||
old_columns = _.clone(m.get('columns'))
|
||||
data = undefined;
|
||||
|
||||
if (url) {
|
||||
var node = this.field.get('schema_node'),
|
||||
data = undefined,
|
||||
node = this.field.get('schema_node'),
|
||||
node_info = this.field.get('node_info'),
|
||||
full_url = node.generate_url.apply(
|
||||
node, [
|
||||
null, url, this.field.get('node_data'),
|
||||
this.field.get('url_with_id') || false, node_info
|
||||
]),
|
||||
]
|
||||
),
|
||||
cache_level = this.field.get('cache_level') || node.type,
|
||||
cache_node = this.field.get('cache_node');
|
||||
|
||||
cache_node = (cache_node && pgAdmin.Browser.Nodes['cache_node']) || node;
|
||||
cache_node = (cache_node && pgBrowser.Nodes['cache_node']) || node;
|
||||
|
||||
m.trigger('pgadmin:view:fetching', m, self.field);
|
||||
// Fetching Columns data for the selected table.
|
||||
@@ -904,7 +900,6 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
data = (data && data.data) || [];
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}),
|
||||
canCreate: function(itemData, item, data) {
|
||||
//If check is false then , we will allow create menu
|
||||
@@ -957,7 +952,6 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return pgBrowser.Nodes['table'];
|
||||
|
||||
@@ -2,42 +2,11 @@
|
||||
['jquery', 'underscore', 'underscore.string', 'pgadmin',
|
||||
'pgadmin.browser', 'backform', 'alertify', 'pgadmin.browser.collection'],
|
||||
function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||
// Extend the browser's collection class for SecurityLabel control
|
||||
var SecurityModel = Backform.SecurityModel = pgAdmin.Browser.Node.Model.extend({
|
||||
defaults: {
|
||||
provider: null,
|
||||
security_label: null
|
||||
},
|
||||
schema: [{
|
||||
id: 'provider', label: '{{ _('Provider') }}',
|
||||
type: 'text', disabled: false,
|
||||
cellHeaderClasses:'width_percent_50'
|
||||
},{
|
||||
id: 'security_label', label: '{{ _('Security Label') }}',
|
||||
type: 'text', disabled: false,
|
||||
cellHeaderClasses:'width_percent_50'
|
||||
}],
|
||||
validate: function() {
|
||||
var err = {},
|
||||
errmsg = null;
|
||||
|
||||
if (_.isUndefined(this.get('security_label')) ||
|
||||
_.isNull(this.get('security_label')) ||
|
||||
String(this.get('security_label')).replace(/^\s+|\s+$/g, '') == '') {
|
||||
errmsg = '{{ _('Please specify the value for all the security providers.')}}';
|
||||
this.errorModel.set('security_label', errmsg);
|
||||
return errmsg;
|
||||
} else {
|
||||
this.errorModel.unset('security_label');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
// Extend the browser's collection class for catalog collection
|
||||
if (!pgBrowser.Nodes['coll-catalog']) {
|
||||
var databases = pgAdmin.Browser.Nodes['coll-catalog'] =
|
||||
pgAdmin.Browser.Collection.extend({
|
||||
var databases = pgBrowser.Nodes['coll-catalog'] =
|
||||
pgBrowser.Collection.extend({
|
||||
node: 'catalog',
|
||||
label: '{{ _('Catalogs') }}',
|
||||
type: 'coll-catalog',
|
||||
@@ -46,7 +15,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||
};
|
||||
// Extend the browser's node class for catalog node
|
||||
if (!pgBrowser.Nodes['catalog']) {
|
||||
pgAdmin.Browser.Nodes['catalog'] = pgAdmin.Browser.Node.extend({
|
||||
pgBrowser.Nodes['catalog'] = pgBrowser.Node.extend({
|
||||
parent_type: 'database',
|
||||
type: 'catalog',
|
||||
label: '{{ _('Catalog') }}',
|
||||
@@ -60,7 +29,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||
this.initialized = true;
|
||||
|
||||
},
|
||||
model: pgAdmin.Browser.Node.Model.extend({
|
||||
model: pgBrowser.Node.Model.extend({
|
||||
defaults: {
|
||||
name: undefined,
|
||||
namespaceowner: undefined,
|
||||
@@ -76,7 +45,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||
|
||||
this.set({'namespaceowner': userInfo.name}, {silent: true});
|
||||
}
|
||||
pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
pgBrowser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
schema: [{
|
||||
id: 'name', label: '{{ _('Name') }}', cell: 'string',
|
||||
@@ -95,7 +64,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||
type: 'multiline'
|
||||
},{
|
||||
id: 'seclabels', label: '{{ _('Security Labels') }}',
|
||||
model: SecurityModel, editable: false, type: 'collection',
|
||||
model: pgBrowser.SecLabelModel, editable: false, type: 'collection',
|
||||
group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
||||
min_version: 90200, canAdd: true,
|
||||
canEdit: false, canDelete: true, control: 'unique-col-collection'
|
||||
|
||||
@@ -17,12 +17,12 @@ COMMENT ON SCHEMA {{ conn|qtIdent(o_data.name) }}
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -17,12 +17,12 @@ COMMENT ON SCHEMA {{ conn|qtIdent(o_data.name) }}
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -17,12 +17,12 @@ COMMENT ON SCHEMA {{ conn|qtIdent(o_data.name) }}
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -17,12 +17,12 @@ COMMENT ON SCHEMA {{ conn|qtIdent(o_data.name) }}
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -108,8 +108,19 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||
}
|
||||
};
|
||||
|
||||
pgBrowser.SecurityGroupUnderSchema = {
|
||||
id: 'security', label: '{{ _("Security") }}', type: 'group',
|
||||
// Show/Hide security group for nodes under the catalog
|
||||
visible: function(args) {
|
||||
if (args && 'node_info' in args && 'catalog' in args.node_info) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// Define Security Model with fields and validation for VacuumSettings Control
|
||||
var VacuumTableModel = Backform.VacuumTableModel = pgAdmin.Browser.Node.Model.extend({
|
||||
var VacuumTableModel = Backform.VacuumTableModel = pgBrowser.Node.Model.extend({
|
||||
defaults: {
|
||||
name: undefined,
|
||||
setting: undefined,
|
||||
@@ -119,7 +130,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||
},
|
||||
|
||||
toJSON: function(){
|
||||
var d = pgAdmin.Browser.Node.Model.prototype.toJSON.apply(this);
|
||||
var d = pgBrowser.Node.Model.prototype.toJSON.apply(this);
|
||||
delete d.label;
|
||||
delete d.setting;
|
||||
delete d.column_type;
|
||||
@@ -128,8 +139,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||
});
|
||||
|
||||
// Extend the browser's collection class for VacuumSettingsModel
|
||||
var VacuumSettingsSchema = Backform.VacuumSettingsSchema =
|
||||
[{
|
||||
var VacuumSettingsSchema = Backform.VacuumSettingsSchema = [{
|
||||
id: 'autovacuum_custom', label: '{{ _("Custom auto-vacuum?") }}',
|
||||
group: '{{ _("Table") }}', mode: ['edit', 'create'],
|
||||
type: 'switch',
|
||||
@@ -251,45 +261,12 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||
]
|
||||
}),
|
||||
deps: ['toast_autovacuum_enabled']
|
||||
}
|
||||
];
|
||||
|
||||
// Extend the browser's collection class for SecurityLabel control
|
||||
var SecurityModel = Backform.SecurityModel = pgAdmin.Browser.Node.Model.extend({
|
||||
defaults: {
|
||||
provider: null,
|
||||
security_label: null
|
||||
},
|
||||
schema: [{
|
||||
id: 'provider', label: '{{ _('Provider') }}',
|
||||
type: 'text', disabled: false,
|
||||
cellHeaderClasses:'width_percent_50'
|
||||
},{
|
||||
id: 'security_label', label: '{{ _('Security Label') }}',
|
||||
type: 'text', disabled: false,
|
||||
cellHeaderClasses:'width_percent_50'
|
||||
}],
|
||||
validate: function() {
|
||||
var err = {},
|
||||
errmsg = null;
|
||||
|
||||
if (_.isUndefined(this.get('security_label')) ||
|
||||
_.isNull(this.get('security_label')) ||
|
||||
String(this.get('security_label')).replace(/^\s+|\s+$/g, '') == '') {
|
||||
errmsg = '{{ _('Please specify the value for all the security providers.')}}';
|
||||
this.errorModel.set('security_label', errmsg);
|
||||
return errmsg;
|
||||
} else {
|
||||
this.errorModel.unset('security_label');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}];
|
||||
|
||||
// Extend the browser's collection class for schema collection
|
||||
if (!pgBrowser.Nodes['coll-schema']) {
|
||||
var databases = pgAdmin.Browser.Nodes['coll-schema'] =
|
||||
pgAdmin.Browser.Collection.extend({
|
||||
var databases = pgBrowser.Nodes['coll-schema'] =
|
||||
pgBrowser.Collection.extend({
|
||||
node: 'schema',
|
||||
label: '{{ _('Schemas') }}',
|
||||
type: 'coll-schema',
|
||||
@@ -298,7 +275,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||
};
|
||||
// Extend the browser's node class for schema node
|
||||
if (!pgBrowser.Nodes['schema']) {
|
||||
pgAdmin.Browser.Nodes['schema'] = pgAdmin.Browser.Node.extend({
|
||||
pgBrowser.Nodes['schema'] = pgBrowser.Node.extend({
|
||||
parent_type: 'database',
|
||||
type: 'schema',
|
||||
sqlAlterHelp: 'sql-alterschema.html',
|
||||
@@ -334,7 +311,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||
}
|
||||
]);
|
||||
},
|
||||
model: pgAdmin.Browser.Node.Model.extend({
|
||||
model: pgBrowser.Node.Model.extend({
|
||||
defaults: {
|
||||
name: undefined,
|
||||
namespaceowner: undefined,
|
||||
@@ -349,7 +326,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||
|
||||
this.set({'namespaceowner': userInfo.name}, {silent: true});
|
||||
}
|
||||
pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
pgBrowser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
schema: [{
|
||||
id: 'name', label: '{{ _('Name') }}', cell: 'string',
|
||||
@@ -387,14 +364,14 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||
}
|
||||
},{
|
||||
id: 'nspacl', label: '{{ _('Privileges') }}',
|
||||
model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend(
|
||||
model: pgBrowser.Node.PrivilegeRoleModel.extend(
|
||||
{privileges: ['C', 'U']}), uniqueCol : ['grantee', 'grantor'],
|
||||
editable: false, type: 'collection', group: '{{ _('Security') }}',
|
||||
mode: ['edit', 'create'],
|
||||
canAdd: true, canDelete: true, control: 'unique-col-collection',
|
||||
},{
|
||||
id: 'seclabels', label: '{{ _('Security Labels') }}',
|
||||
model: SecurityModel, editable: false, type: 'collection',
|
||||
model: pgBrowser.SecLabelModel, editable: false, type: 'collection',
|
||||
group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
||||
min_version: 90200, canAdd: true,
|
||||
canEdit: false, canDelete: true, control: 'unique-col-collection'
|
||||
@@ -402,28 +379,28 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||
type: 'nested', control: 'tab', group: '{{ _('Default Privileges') }}',
|
||||
mode: ['edit'],
|
||||
schema:[{
|
||||
id: 'deftblacl', model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend(
|
||||
id: 'deftblacl', model: pgBrowser.Node.PrivilegeRoleModel.extend(
|
||||
{privileges: ['a', 'r', 'w', 'd', 'D', 'x', 't']}),
|
||||
label: '{{ _('Default Privileges: Tables') }}',
|
||||
editable: false, type: 'collection', group: '{{ _('Tables') }}',
|
||||
mode: ['edit', 'create'], control: 'unique-col-collection',
|
||||
canAdd: true, canDelete: true, uniqueCol : ['grantee', 'grantor']
|
||||
},{
|
||||
id: 'defseqacl', model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend(
|
||||
id: 'defseqacl', model: pgBrowser.Node.PrivilegeRoleModel.extend(
|
||||
{privileges: ['r', 'w', 'U']}),
|
||||
label: '{{ _('Default Privileges: Sequences') }}',
|
||||
editable: false, type: 'collection', group: '{{ _('Sequences') }}',
|
||||
mode: ['edit', 'create'], control: 'unique-col-collection',
|
||||
canAdd: true, canDelete: true, uniqueCol : ['grantee', 'grantor']
|
||||
},{
|
||||
id: 'deffuncacl', model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend(
|
||||
id: 'deffuncacl', model: pgBrowser.Node.PrivilegeRoleModel.extend(
|
||||
{privileges: ['X']}),
|
||||
label: '{{ _('Default Privileges: Functions') }}',
|
||||
editable: false, type: 'collection', group: '{{ _('Functions') }}',
|
||||
mode: ['edit', 'create'], control: 'unique-col-collection',
|
||||
canAdd: true, canDelete: true, uniqueCol : ['grantee', 'grantor']
|
||||
},{
|
||||
id: 'deftypeacl', model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend(
|
||||
id: 'deftypeacl', model: pgBrowser.Node.PrivilegeRoleModel.extend(
|
||||
{privileges: ['U']}),
|
||||
label: '{{ _('Default Privileges: Types') }}',
|
||||
editable: false, type: 'collection', group: '{{ _('Types') }}',
|
||||
@@ -506,6 +483,5 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||
remove: Backgrid.Extension.DependentCell.prototype.remove
|
||||
});
|
||||
|
||||
|
||||
return pgBrowser.Nodes['schema'];
|
||||
});
|
||||
|
||||
@@ -30,6 +30,6 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
|
||||
{# Security Labels on schema #}
|
||||
{% if data.seclabels and data.seclabels|length > 0 %}
|
||||
{% for r in data.seclabels %}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
@@ -72,12 +72,12 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', 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, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -30,6 +30,6 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
|
||||
{# Security Labels on schema #}
|
||||
{% if data.seclabels and data.seclabels|length > 0 %}
|
||||
{% for r in data.seclabels %}
|
||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
@@ -72,12 +72,12 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', 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, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -30,6 +30,6 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
|
||||
{# Security Labels on schema #}
|
||||
{% if data.seclabels and data.seclabels|length > 0 %}
|
||||
{% for r in data.seclabels %}
|
||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
@@ -31,12 +31,12 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -30,6 +30,6 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
|
||||
{# Security Labels on schema #}
|
||||
{% if data.seclabels and data.seclabels|length > 0 %}
|
||||
{% for r in data.seclabels %}
|
||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
@@ -31,12 +31,12 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ define(
|
||||
function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
||||
|
||||
if (!pgBrowser.Nodes['coll-type']) {
|
||||
var databases = pgAdmin.Browser.Nodes['coll-type'] =
|
||||
pgAdmin.Browser.Collection.extend({
|
||||
var databases = pgBrowser.Nodes['coll-type'] =
|
||||
pgBrowser.Collection.extend({
|
||||
node: 'type',
|
||||
label: '{{ _('Types') }}',
|
||||
type: 'coll-type',
|
||||
@@ -63,39 +63,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
||||
remove: Backgrid.Extension.DependentCell.prototype.remove
|
||||
});
|
||||
|
||||
// Security label model declaration
|
||||
var SecurityModel = Backform.SecurityModel = pgAdmin.Browser.Node.Model.extend({
|
||||
defaults: {
|
||||
provider: undefined,
|
||||
security_label: undefined
|
||||
},
|
||||
schema: [{
|
||||
id: 'provider', label: '{{ _('Provider') }}',
|
||||
type: 'text', disabled: false, cellHeaderClasses:'width_percent_50'
|
||||
},{
|
||||
id: 'security_label', label: '{{ _('Security Label') }}',
|
||||
type: 'text', disabled: false, cellHeaderClasses:'width_percent_50'
|
||||
}],
|
||||
validate: function() {
|
||||
var err = {},
|
||||
errmsg = null,
|
||||
data = this.toJSON();
|
||||
|
||||
if (_.isUndefined(this.get('security_label')) ||
|
||||
_.isNull(this.get('security_label')) ||
|
||||
String(this.get('security_label')).replace(/^\s+|\s+$/g, '') == '') {
|
||||
errmsg = '{{ _('Please provide the value for security label.') }}';
|
||||
this.errorModel.set('security_label', errmsg);
|
||||
return errmsg;
|
||||
} else {
|
||||
this.errorModel.unset('security_label');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
// Composite type model declaration
|
||||
var CompositeModel = Backform.CompositeModel = pgAdmin.Browser.Node.Model.extend({
|
||||
var CompositeModel = Backform.CompositeModel = pgBrowser.Node.Model.extend({
|
||||
idAttribute: 'attnum',
|
||||
defaults: {
|
||||
attnum: undefined,
|
||||
@@ -247,7 +216,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
||||
}
|
||||
});
|
||||
|
||||
var EnumModel = Backform.EnumModel = pgAdmin.Browser.Node.Model.extend({
|
||||
var EnumModel = Backform.EnumModel = pgBrowser.Node.Model.extend({
|
||||
defaults: {
|
||||
label: undefined,
|
||||
},
|
||||
@@ -275,7 +244,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
||||
});
|
||||
|
||||
if (!pgBrowser.Nodes['type']) {
|
||||
pgAdmin.Browser.Nodes['type'] = pgBrowser.Node.extend({
|
||||
pgBrowser.Nodes['type'] = pgBrowser.Node.extend({
|
||||
type: 'type',
|
||||
sqlAlterHelp: 'sql-altertype.html',
|
||||
sqlCreateHelp: 'sql-createtype.html',
|
||||
@@ -317,7 +286,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
||||
canDrop: pgBrowser.Nodes['schema'].canChildDrop,
|
||||
canDropCascade: pgBrowser.Nodes['schema'].canChildDrop,
|
||||
ext_funcs: undefined,
|
||||
model: pgAdmin.Browser.Node.Model.extend({
|
||||
model: pgBrowser.Node.Model.extend({
|
||||
defaults: {
|
||||
name: undefined,
|
||||
oid: undefined,
|
||||
@@ -336,7 +305,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
||||
this.set({'typeowner': userInfo.name}, {silent: true});
|
||||
this.set({'schema': schemaInfo.label}, {silent: true});
|
||||
}
|
||||
pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
pgBrowser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
|
||||
schema: [{
|
||||
@@ -747,9 +716,9 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
||||
id: 'alias', label:'{{ _('Alias') }}', cell: 'string',
|
||||
type: 'text', mode: ['properties'],
|
||||
disabled: 'inSchema'
|
||||
},{
|
||||
}, pgBrowser.SecurityGroupUnderSchema,{
|
||||
id: 'type_acl', label:'{{ _('Privileges') }}', cell: 'string',
|
||||
type: 'text', mode: ['properties'], group: '{{ _('Security') }}',
|
||||
type: 'text', mode: ['properties'], group: 'security',
|
||||
disabled: 'inSchema'
|
||||
},{
|
||||
id: 'member_list', label:'{{ _('Members') }}', cell: 'string',
|
||||
@@ -778,9 +747,11 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
||||
type: 'multiline', mode: ['properties', 'create', 'edit'],
|
||||
disabled: 'inSchema'
|
||||
},{
|
||||
id: 'typacl', label: 'Privileges', type: 'collection',
|
||||
group: '{{ _('Security') }}', control: 'unique-col-collection',
|
||||
model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend({privileges: ['U']}),
|
||||
id: 'typacl', label:'{{ _('Privileges') }}', type: 'collection',
|
||||
group: 'security', control: 'unique-col-collection',
|
||||
model: pgBrowser.Node.PrivilegeRoleModel.extend({
|
||||
privileges: ['U']
|
||||
}),
|
||||
mode: ['edit', 'create'], canDelete: true,
|
||||
uniqueCol : ['grantee'], deps: ['typtype'],
|
||||
canAdd: function(m) {
|
||||
@@ -789,15 +760,14 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
||||
}
|
||||
},{
|
||||
id: 'seclabels', label: '{{ _('Security Labels') }}',
|
||||
model: SecurityModel, editable: false, type: 'collection',
|
||||
group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
||||
model: pgBrowser.SecLabglModel, editable: false, type: 'collection',
|
||||
group: 'security', mode: ['edit', 'create'],
|
||||
min_version: 90100, canEdit: false, canDelete: true,
|
||||
control: 'unique-col-collection', deps: ['typtype'],
|
||||
canAdd: function(m) {
|
||||
// Do not allow to add when shell type is selected
|
||||
return !(m.get('typtype') === 'p');
|
||||
}
|
||||
|
||||
}],
|
||||
validate: function() {
|
||||
// Validation code for required fields
|
||||
|
||||
@@ -76,8 +76,8 @@ COMMENT ON TYPE {% if data.schema %}{{ conn|qtIdent(data.schema, data.name) }}{%
|
||||
{% if data.seclabels %}
|
||||
|
||||
{% for r in data.seclabels %}
|
||||
{% if r.provider and r.security_label %}
|
||||
{{ SECLABLE.SET(conn, 'TYPE', data.name, r.provider, r.security_label, data.schema) }}
|
||||
{% if r.provider and r.label %}
|
||||
{{ SECLABLE.SET(conn, 'TYPE', data.name, r.provider, r.label, data.schema) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
@@ -90,12 +90,12 @@ ALTER TYPE {{ conn|qtIdent(o_data.schema, o_data.name) }}
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABLE.SET(conn, 'TYPE', o_data.name, r.provider, r.security_label, o_data.schema) }}
|
||||
{{ SECLABLE.SET(conn, 'TYPE', o_data.name, r.provider, r.label, o_data.schema) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABLE.SET(conn, 'TYPE', o_data.name, r.provider, r.security_label, o_data.schema) }}
|
||||
{{ SECLABLE.SET(conn, 'TYPE', o_data.name, r.provider, r.label, o_data.schema) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -451,7 +451,7 @@ class ViewNode(PGChildNodeView, VacuumSettings):
|
||||
sec = re.search(r'([^=]+)=(.*$)', sec)
|
||||
sec_lbls.append({
|
||||
'provider': sec.group(1),
|
||||
'security_label': sec.group(2)
|
||||
'label': sec.group(2)
|
||||
})
|
||||
|
||||
frmtd_result.update({"seclabels": sec_lbls})
|
||||
|
||||
@@ -12,8 +12,8 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) {
|
||||
display under under properties.
|
||||
*/
|
||||
if (!pgBrowser.Nodes['coll-mview']) {
|
||||
var mviews= pgAdmin.Browser.Nodes['coll-mview'] =
|
||||
pgAdmin.Browser.Collection.extend({
|
||||
var mviews= pgBrowser.Nodes['coll-mview'] =
|
||||
pgBrowser.Collection.extend({
|
||||
node: 'mview',
|
||||
label: '{{ _("Materialized Views") }}',
|
||||
type: 'coll-mview',
|
||||
@@ -33,7 +33,7 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) {
|
||||
view option in the context menu
|
||||
*/
|
||||
if (!pgBrowser.Nodes['mview']) {
|
||||
pgAdmin.Browser.Nodes['mview'] = pgAdmin.Browser.Node.extend({
|
||||
pgBrowser.Nodes['mview'] = pgBrowser.Node.extend({
|
||||
parent_type: ['schema', 'catalog'],
|
||||
type: 'mview',
|
||||
sqlAlterHelp: 'sql-altermaterializedview.html',
|
||||
@@ -96,7 +96,7 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) {
|
||||
Define model for the view node and specify the
|
||||
properties of the model in schema.
|
||||
*/
|
||||
model: pgAdmin.Browser.Node.Model.extend({
|
||||
model: pgBrowser.Node.Model.extend({
|
||||
initialize: function(attrs, args) {
|
||||
var isNew = (_.size(attrs) === 0);
|
||||
if (isNew) {
|
||||
@@ -108,7 +108,7 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) {
|
||||
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
||||
this.set({'owner': userInfo.name}, {silent: true});
|
||||
}
|
||||
pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
pgBrowser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
defaults: {
|
||||
spcname: 'pg_default',
|
||||
@@ -118,44 +118,35 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) {
|
||||
schema: [{
|
||||
id: 'name', label: '{{ _("Name") }}', cell: 'string',
|
||||
type: 'text', disabled: 'inSchema'
|
||||
},
|
||||
{
|
||||
},{
|
||||
id: 'oid', label:'{{ _("OID") }}', cell: 'string',
|
||||
type: 'text', disabled: true, mode: ['properties']
|
||||
},
|
||||
{
|
||||
},{
|
||||
id: 'owner', label:'{{ _("Owner") }}', cell: 'string',
|
||||
control: 'node-list-by-name', select2: { allowClear: false },
|
||||
node: 'role', disabled: 'inSchema'
|
||||
},
|
||||
{
|
||||
},{
|
||||
id: 'schema', label:'{{ _("Schema") }}', cell: 'string', first_empty: false,
|
||||
control: 'node-list-by-name', type: 'text', cache_level: 'database',
|
||||
node: 'schema', mode: ['create', 'edit'], disabled: 'inSchema', select2: { allowClear: false }
|
||||
},
|
||||
{
|
||||
},{
|
||||
id: 'system_view', label:'{{ _("System view?") }}', cell: 'string',
|
||||
type: 'switch', disabled: true, mode: ['properties'],
|
||||
},
|
||||
{
|
||||
id: 'acl', label: '{{ _("ACL") }}',
|
||||
mode: ['properties'], type: 'text'
|
||||
},
|
||||
{
|
||||
}, pgBrowser.SecurityGroupUnderSchema, {
|
||||
id: 'acl', label: '{{ _("Privileges") }}',
|
||||
mode: ['properties'], type: 'text', group: '{{ _("Security") }}'
|
||||
},{
|
||||
id: 'comment', label:'{{ _("Comment") }}', cell: 'string',
|
||||
type: 'multiline'
|
||||
},
|
||||
{
|
||||
},{
|
||||
id: 'definition', label:'{{ _("") }}', cell: 'string',
|
||||
type: 'text', mode: ['create', 'edit'], group: 'Definition',
|
||||
control: Backform.SqlFieldControl, extraClasses:['sql_field_width_full']
|
||||
},
|
||||
{
|
||||
},{
|
||||
id: 'with_data', label: '{{ _("With Data") }}',
|
||||
group: '{{ _("Storage") }}', mode: ['edit', 'create'],
|
||||
type: 'switch',
|
||||
},
|
||||
{
|
||||
},{
|
||||
id: 'spcname', label: '{{ _("Tablespace") }}', cell: 'string',
|
||||
type: 'text', group: '{{ _("Storage") }}', first_empty: false,
|
||||
control: 'node-list-by-name', node: 'tablespace', select2: { allowClear: false },
|
||||
@@ -163,37 +154,31 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) {
|
||||
if (m.label == "pg_global") return false;
|
||||
else return true;
|
||||
}
|
||||
},
|
||||
{
|
||||
},{
|
||||
id: 'fillfactor', label: '{{ _("Fill Factor") }}',
|
||||
group: '{{ _("Storage") }}', mode: ['edit', 'create'],
|
||||
type: 'integer'
|
||||
},
|
||||
{
|
||||
},{
|
||||
type: 'nested', control: 'tab', id: 'materialization',
|
||||
label: '{{ _("Auto vacuum") }}', mode: ['edit', 'create'],
|
||||
group: '{{ _("Auto vacuum") }}',
|
||||
schema: Backform.VacuumSettingsSchema
|
||||
},
|
||||
},{
|
||||
// Add Privilege Control
|
||||
{
|
||||
id: 'datacl', label: '{{ _("Privileges") }}',
|
||||
model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend(
|
||||
{privileges: ['a', 'r', 'w', 'd', 'D', 'x', 't']}), uniqueCol : ['grantee'],
|
||||
editable: false, type: 'collection', group: '{{ _("Security") }}',
|
||||
mode: ['edit', 'create'], canAdd: true, canDelete: true,
|
||||
control: 'unique-col-collection', priority: 3
|
||||
},
|
||||
|
||||
id: 'datacl', label: '{{ _("Privileges") }}', type: 'collection',
|
||||
model: pgBrowser.Node.PrivilegeRoleModel.extend({
|
||||
privileges: ['a', 'r', 'w', 'd', 'D', 'x', 't']
|
||||
}), uniqueCol : ['grantee'], editable: false,
|
||||
group: "security", canAdd: true, canDelete: true,
|
||||
mode: ['edit', 'create'], control: 'unique-col-collection'
|
||||
},{
|
||||
// Add Security Labels Control
|
||||
{
|
||||
id: 'seclabels', label: '{{ _("Security Labels") }}',
|
||||
model: Backform.SecurityModel, editable: false, type: 'collection',
|
||||
canEdit: false, group: '{{ _("Security") }}', canDelete: true,
|
||||
model: pgBrowser.SecLabelModel, editable: false, type: 'collection',
|
||||
canEdit: false, group: "security", canDelete: true,
|
||||
mode: ['edit', 'create'], canAdd: true,
|
||||
control: 'unique-col-collection', uniqueCol : ['provider']
|
||||
}
|
||||
],
|
||||
}],
|
||||
validate: function(keys) {
|
||||
|
||||
// Triggers specific error messages for fields
|
||||
@@ -311,5 +296,5 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) {
|
||||
});
|
||||
}
|
||||
|
||||
return pgBrowser.Nodes['coll-mview'];
|
||||
return pgBrowser.Nodes['mview'];
|
||||
});
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
{% import 'macros/security.macros' as SECLABLE %}
|
||||
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
||||
{# 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.security_label) }}{% endfor %}{% endif %}
|
||||
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}{% 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 %}
|
||||
|
||||
@@ -202,12 +202,12 @@ COMMENT ON MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }}
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
{% import 'macros/security.macros' as SECLABLE %}
|
||||
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
||||
{# 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.security_label) }}{% endfor %}{% endif %}
|
||||
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}{% 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 %}
|
||||
|
||||
@@ -202,12 +202,12 @@ COMMENT ON MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }}
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -12,8 +12,8 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) {
|
||||
display under under properties.
|
||||
*/
|
||||
if (!pgBrowser.Nodes['coll-view']) {
|
||||
var views= pgAdmin.Browser.Nodes['coll-view'] =
|
||||
pgAdmin.Browser.Collection.extend({
|
||||
var views= pgBrowser.Nodes['coll-view'] =
|
||||
pgBrowser.Collection.extend({
|
||||
node: 'view',
|
||||
label: '{{ _("Views") }}',
|
||||
type: 'coll-view',
|
||||
@@ -33,7 +33,7 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) {
|
||||
view option in the context menu
|
||||
*/
|
||||
if (!pgBrowser.Nodes['view']) {
|
||||
pgAdmin.Browser.Nodes['view'] = pgAdmin.Browser.Node.extend({
|
||||
pgBrowser.Nodes['view'] = pgBrowser.Node.extend({
|
||||
parent_type: ['schema', 'catalog'],
|
||||
type: 'view',
|
||||
sqlAlterHelp: 'sql-alterview.html',
|
||||
@@ -87,7 +87,7 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) {
|
||||
Define model for the view node and specify the
|
||||
properties of the model in schema.
|
||||
*/
|
||||
model: pgAdmin.Browser.Node.Model.extend({
|
||||
model: pgBrowser.Node.Model.extend({
|
||||
initialize: function(attrs, args) {
|
||||
var isNew = (_.size(attrs) === 0);
|
||||
if (isNew) {
|
||||
@@ -99,96 +99,71 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) {
|
||||
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
||||
this.set({'owner': userInfo.name}, {silent: true});
|
||||
}
|
||||
pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
pgBrowser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
schema: [{
|
||||
id: 'name', label: '{{ _("Name") }}', cell: 'string',
|
||||
type: 'text', disabled: 'inSchema'
|
||||
},
|
||||
{
|
||||
type: 'text', disabled: 'notInSchema'
|
||||
},{
|
||||
id: 'oid', label:'{{ _("OID") }}', cell: 'string',
|
||||
type: 'text', disabled: true, mode: ['properties']
|
||||
},
|
||||
{
|
||||
},{
|
||||
id: 'owner', label:'{{ _("Owner") }}', cell: 'string', control: 'node-list-by-name',
|
||||
node: 'role', disabled: 'inSchema', select2: { allowClear: false }
|
||||
},
|
||||
{
|
||||
node: 'role', disabled: 'notInSchema', select2: { allowClear: false }
|
||||
},{
|
||||
id: 'schema', label:'{{ _("Schema") }}', cell: 'string', first_empty: false,
|
||||
control: 'node-list-by-name', type: 'text', cache_level: 'database',
|
||||
node: 'schema', disabled: 'inSchema', mode: ['create', 'edit'], select2: { allowClear: false }
|
||||
},
|
||||
{
|
||||
node: 'schema', disabled: 'notInSchema', mode: ['create', 'edit'], select2: { allowClear: false }
|
||||
},{
|
||||
id: 'system_view', label:'{{ _("System view?") }}', cell: 'string',
|
||||
type: 'switch', disabled: true, mode: ['properties']
|
||||
},
|
||||
{
|
||||
},{
|
||||
id: 'acl', label: '{{ _("Privileges") }}',
|
||||
mode: ['properties'], type: 'text'
|
||||
},
|
||||
{
|
||||
mode: ['properties'], type: 'text', group: '{{ _("Security") }}'
|
||||
},{
|
||||
id: 'comment', label:'{{ _("Comment") }}', cell: 'string',
|
||||
type: 'multiline', disabled: 'inSchema'
|
||||
},
|
||||
{
|
||||
id: 'security_barrier', label:'{{ _("Security barrier") }}', cell: 'string',
|
||||
type: 'switch', min_version: '90200',
|
||||
group: 'Definition', disabled: 'inSchema'
|
||||
},
|
||||
{
|
||||
type: 'multiline', disabled: 'notInSchema'
|
||||
},{
|
||||
id: 'security_barrier', label:'{{ _("Security barrier") }}',
|
||||
type: 'switch', min_version: '90200', group: 'Definition',
|
||||
disabled: 'notInSchema'
|
||||
},{
|
||||
id: 'check_option', label:'{{ _("Check options") }}',
|
||||
control: 'select2', group: 'Definition', type: 'text',
|
||||
min_version: '90400', mode:['properties', 'create', 'edit'],
|
||||
select2: {
|
||||
|
||||
// set select2 option width to 100%
|
||||
// Set select2 option width to 100%
|
||||
allowClear: false,
|
||||
width: '100%'
|
||||
},
|
||||
options:[
|
||||
{label: "No", value: "no"},
|
||||
{label: "Local", value: "local"},
|
||||
{label: "Cascaded", value: "cascaded"}
|
||||
], disabled: 'inSchema'
|
||||
},
|
||||
{
|
||||
}, disabled: 'notInSchema',
|
||||
options:[{
|
||||
label: "{{ _('No') }}", value: "no"
|
||||
},{
|
||||
label: "{{ _('Local') }}", value: "local"
|
||||
},{
|
||||
label: "{{ _('Cascaded') }}", value: "cascaded"
|
||||
}]
|
||||
},{
|
||||
id: 'definition', label:'{{ _("Definition") }}', cell: 'string',
|
||||
type: 'text', mode: ['create', 'edit'], group: 'Definition',
|
||||
control: Backform.SqlFieldControl,
|
||||
disabled: 'inSchema'
|
||||
},
|
||||
{
|
||||
id: 'security', label: '{{ _("Security") }}',
|
||||
type: 'group',
|
||||
visible: function(m) {
|
||||
if (m.top && 'catalog' in m.top.node_info) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
disabled: 'notInSchema'
|
||||
}, pgBrowser.SecurityGroupUnderSchema, {
|
||||
// Add Privilege Control
|
||||
{
|
||||
id: 'datacl', label: '{{ _("Privileges") }}',
|
||||
model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend(
|
||||
{privileges: ['a', 'r', 'w', 'd', 'D', 'x', 't']}), uniqueCol : ['grantee'],
|
||||
editable: false, type: 'collection', group: 'security',
|
||||
id: 'datacl', label: '{{ _("Privileges") }}', type: 'collection',
|
||||
model: pgBrowser.Node.PrivilegeRoleModel.extend({
|
||||
privileges: ['a', 'r', 'w', 'd', 'D', 'x', 't']
|
||||
}), uniqueCol : ['grantee'], editable: false, group: 'security',
|
||||
mode: ['edit', 'create'], canAdd: true, canDelete: true,
|
||||
control: 'unique-col-collection', disabled: 'inSchema'
|
||||
},
|
||||
|
||||
control: 'unique-col-collection', disabled: 'notInSchema'
|
||||
},{
|
||||
// Add Security Labels Control
|
||||
{
|
||||
id: 'seclabels', label: '{{ _("Security labels") }}',
|
||||
model: Backform.SecurityModel, editable: false, type: 'collection',
|
||||
model: pgBrowser.SecLabelModel, editable: false, type: 'collection',
|
||||
canEdit: false, group: 'security', canDelete: true,
|
||||
mode: ['edit', 'create'], canAdd: true, disabled: 'inSchema',
|
||||
mode: ['edit', 'create'], canAdd: true, disabled: 'notInSchema',
|
||||
control: 'unique-col-collection', uniqueCol : ['provider']
|
||||
},
|
||||
],
|
||||
}],
|
||||
validate: function() {
|
||||
|
||||
// Triggers specific error messages for fields
|
||||
var err = {},
|
||||
errmsg,
|
||||
@@ -215,9 +190,8 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) {
|
||||
return null;
|
||||
},
|
||||
// We will disable everything if we are under catalog node
|
||||
inSchema: function() {
|
||||
if(this.node_info && 'catalog' in this.node_info)
|
||||
{
|
||||
notInSchema: function() {
|
||||
if(this.node_info && 'catalog' in this.node_info) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -265,5 +239,5 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) {
|
||||
});
|
||||
}
|
||||
|
||||
return pgBrowser.Nodes['coll-view'];
|
||||
return pgBrowser.Nodes['view'];
|
||||
});
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
{% import 'macros/security.macros' as SECLABLE %}
|
||||
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
||||
{# ===== 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.security_label) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %}
|
||||
{% 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 %}
|
||||
{% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %}
|
||||
|
||||
@@ -55,12 +55,12 @@ COMMENT ON VIEW {{ conn|qtIdent(view_schema, view_name) }}
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
{% import 'macros/security.macros' as SECLABLE %}
|
||||
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
||||
{# ===== 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.security_label) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %}
|
||||
{% 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 %}
|
||||
{% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %}
|
||||
|
||||
@@ -63,12 +63,12 @@ COMMENT ON VIEW {{ conn|qtIdent(view_schema, view_name) }}
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
{% import 'macros/security.macros' as SECLABLE %}
|
||||
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
||||
{# ===== 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.security_label) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %}
|
||||
{% 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 %}
|
||||
{% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %}
|
||||
|
||||
@@ -63,12 +63,12 @@ COMMENT ON VIEW {{ conn|qtIdent(view_schema, view_name) }}
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
{% import 'macros/security.macros' as SECLABLE %}
|
||||
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
||||
{# ===== 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.security_label) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %}
|
||||
{% 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 %}
|
||||
{% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %}
|
||||
|
||||
@@ -69,12 +69,12 @@ COMMENT ON VIEW {{ conn|qtIdent(view_schema, view_name) }}
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
{% import 'macros/security.macros' as SECLABLE %}
|
||||
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
||||
{# ===== 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.security_label) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %}
|
||||
{% 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 %}
|
||||
{% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %}
|
||||
|
||||
@@ -63,12 +63,12 @@ COMMENT ON VIEW {{ conn|qtIdent(view_schema, view_name) }}
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
{% import 'macros/security.macros' as SECLABLE %}
|
||||
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
||||
{# ===== 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.security_label) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %}
|
||||
{% 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 %}
|
||||
{% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %}
|
||||
|
||||
@@ -63,12 +63,12 @@ COMMENT ON VIEW {{ conn|qtIdent(view_schema, view_name) }}
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
{% import 'macros/security.macros' as SECLABLE %}
|
||||
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
||||
{# ===== 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.security_label) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %}
|
||||
{% 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 %}
|
||||
{% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %}
|
||||
|
||||
@@ -63,12 +63,12 @@ COMMENT ON VIEW {{ conn|qtIdent(view_schema, view_name) }}
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
{% import 'macros/security.macros' as SECLABLE %}
|
||||
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
||||
{# ===== 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.security_label) }}{{'\r'}}{% endfor %}{{'\r'}}{% endif %}{% if data.datacl %}
|
||||
{% 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 %}
|
||||
{% for priv in data.datacl %}{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}{% endfor %}{% endif %}
|
||||
|
||||
@@ -69,12 +69,12 @@ COMMENT ON VIEW {{ conn|qtIdent(view_schema, view_name) }}
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||
{% for r in seclabels.changed %}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -6,8 +6,8 @@ define([
|
||||
function($, _, S, pgAdmin, pgBrowser, Alertify) {
|
||||
|
||||
if (!pgBrowser.Nodes['coll-database']) {
|
||||
var databases = pgAdmin.Browser.Nodes['coll-database'] =
|
||||
pgAdmin.Browser.Collection.extend({
|
||||
var databases = pgBrowser.Nodes['coll-database'] =
|
||||
pgBrowser.Collection.extend({
|
||||
node: 'database',
|
||||
label: '{{ _('Databases') }}',
|
||||
type: 'coll-database',
|
||||
@@ -16,36 +16,8 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
|
||||
});
|
||||
};
|
||||
|
||||
var SecurityModel = pgAdmin.Browser.Node.Model.extend({
|
||||
defaults: {
|
||||
provider: undefined,
|
||||
securitylabel: undefined
|
||||
},
|
||||
schema: [{
|
||||
id: 'provider', label: '{{ _('Provider') }}',
|
||||
type: 'text', editable: true,
|
||||
cellHeaderClasses:'width_percent_50'
|
||||
},{
|
||||
id: 'security_label', label: '{{ _('Security Label') }}',
|
||||
type: 'text', editable: true,
|
||||
cellHeaderClasses:'width_percent_50'
|
||||
}],
|
||||
validate: function() {
|
||||
var err = {},
|
||||
errmsg = null,
|
||||
data = this.toJSON();
|
||||
|
||||
if (_.isUndefined(data.label) ||
|
||||
_.isNull(data.label) ||
|
||||
String(data.label).replace(/^\s+|\s+$/g, '') == '') {
|
||||
return _("Please specify the value for all the security providers.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
if (!pgBrowser.Nodes['database']) {
|
||||
pgAdmin.Browser.Nodes['database'] = pgAdmin.Browser.Node.extend({
|
||||
pgBrowser.Nodes['database'] = pgBrowser.Node.extend({
|
||||
parent_type: 'server',
|
||||
type: 'database',
|
||||
sqlAlterHelp: 'sql-alterdatabase.html',
|
||||
@@ -210,7 +182,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
|
||||
return pgBrowser.Node.callbacks.selected.apply(this, arguments);
|
||||
},
|
||||
},
|
||||
model: pgAdmin.Browser.Node.Model.extend({
|
||||
model: pgBrowser.Node.Model.extend({
|
||||
defaults: {
|
||||
name: undefined,
|
||||
owner: undefined,
|
||||
@@ -240,7 +212,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
|
||||
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
||||
this.set({'datowner': userInfo.name}, {silent: true});
|
||||
}
|
||||
pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
pgBrowser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
|
||||
schema: [{
|
||||
@@ -300,18 +272,21 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
|
||||
'size': 'small'
|
||||
}
|
||||
},{
|
||||
id: 'datacl', label: '{{ _('Privileges') }}', model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend(
|
||||
{privileges: ['C', 'T', 'c']}), uniqueCol : ['grantee', 'grantor'],
|
||||
editable: false, type: 'collection', group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
||||
id: 'datacl', label: '{{ _('Privileges') }}', type: 'collection',
|
||||
model: pgBrowser.Node.PrivilegeRoleModel.extend({
|
||||
privileges: ['C', 'T', 'c']
|
||||
}), uniqueCol : ['grantee', 'grantor'], editable: false,
|
||||
group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
||||
canAdd: true, canDelete: true, control: 'unique-col-collection',
|
||||
},{
|
||||
id: 'variables', label: '{{ _('Parameters') }}', type: 'collection',
|
||||
model: pgAdmin.Browser.Node.VariableModel, editable: false,
|
||||
model: pgBrowser.Node.VariableModel, editable: false,
|
||||
group: '{{ _('Parameters') }}', mode: ['edit', 'create'],
|
||||
canAdd: true, canEdit: false, canDelete: true, hasRole: true,
|
||||
control: Backform.VariableCollectionControl, node: 'role'
|
||||
},{
|
||||
id: 'securities', label: '{{ _('Security Labels') }}', model: SecurityModel,
|
||||
id: 'securities', label: '{{ _('Security Labels') }}',
|
||||
model: pgBrowser.SecLabelModel,
|
||||
editable: false, type: 'collection', canEdit: false,
|
||||
group: '{{ _('Security') }}', canDelete: true,
|
||||
mode: ['edit', 'create'], canAdd: true,
|
||||
@@ -321,25 +296,25 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
|
||||
type: 'nested', control: 'tab', group: '{{ _('Default Privileges') }}',
|
||||
mode: ['edit'],
|
||||
schema:[{
|
||||
id: 'deftblacl', model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend(
|
||||
id: 'deftblacl', model: pgBrowser.Node.PrivilegeRoleModel.extend(
|
||||
{privileges: ['a', 'r', 'w', 'd', 'D', 'x', 't']}), label: '{{ _('Default Privileges: Tables') }}',
|
||||
editable: false, type: 'collection', group: '{{ _('Tables') }}',
|
||||
mode: ['edit', 'create'], control: 'unique-col-collection',
|
||||
canAdd: true, canDelete: true, uniqueCol : ['grantee', 'grantor']
|
||||
},{
|
||||
id: 'defseqacl', model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend(
|
||||
id: 'defseqacl', model: pgBrowser.Node.PrivilegeRoleModel.extend(
|
||||
{privileges: ['r', 'w', 'U']}), label: '{{ _('Default Privileges: Sequences') }}',
|
||||
editable: false, type: 'collection', group: '{{ _('Sequences') }}',
|
||||
mode: ['edit', 'create'], control: 'unique-col-collection',
|
||||
canAdd: true, canDelete: true, uniqueCol : ['grantee', 'grantor']
|
||||
},{
|
||||
id: 'deffuncacl', model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend(
|
||||
id: 'deffuncacl', model: pgBrowser.Node.PrivilegeRoleModel.extend(
|
||||
{privileges: ['X']}), label: '{{ _('Default Privileges: Functions') }}',
|
||||
editable: false, type: 'collection', group: '{{ _('Functions') }}',
|
||||
mode: ['edit', 'create'], control: 'unique-col-collection',
|
||||
canAdd: true, canDelete: true, uniqueCol : ['grantee', 'grantor']
|
||||
},{
|
||||
id: 'deftypeacl', model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend(
|
||||
id: 'deftypeacl', model: pgBrowser.Node.PrivilegeRoleModel.extend(
|
||||
{privileges: ['U']}), label: '{{ _('Default Privileges: Types') }}',
|
||||
editable: false, type: 'collection', group: 'deftypesacl_group',
|
||||
mode: ['edit', 'create'], control: 'unique-col-collection',
|
||||
|
||||
@@ -26,12 +26,12 @@ ALTER DATABASE {{ conn|qtIdent(data.name) }} WITH CONNECTION LIMIT = {{ data.dat
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABEL.APPLY(conn, 'DATABASE', data.name, r.provider, r.security_label) }}
|
||||
{{ 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.security_label) }}
|
||||
{{ SECLABEL.APPLY(conn, 'DATABASE', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -15,7 +15,7 @@ COMMENT ON DATABASE {{ conn|qtIdent(data.name) }}
|
||||
{# Generate the security labels #}
|
||||
{% if data.securities %}
|
||||
{% for r in data.securities %}
|
||||
{{ SECLABEL.APPLY(conn, 'DATABASE', data.name, r.provider, r.securitylabel) }}
|
||||
{{ SECLABEL.APPLY(conn, 'DATABASE', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{# Generate the variable/options #}
|
||||
|
||||
@@ -26,12 +26,12 @@ ALTER DATABASE {{ conn|qtIdent(data.name) }} WITH CONNECTION LIMIT = {{ data.dat
|
||||
{% endif %}
|
||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||
{% for r in seclabels.added %}
|
||||
{{ SECLABEL.APPLY(conn, 'DATABASE', data.name, r.provider, r.security_label) }}
|
||||
{{ 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.security_label) }}
|
||||
{{ SECLABEL.APPLY(conn, 'DATABASE', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -15,7 +15,7 @@ COMMENT ON DATABASE {{ conn|qtIdent(data.name) }}
|
||||
{# Change the security labels #}
|
||||
{% if data.securities %}
|
||||
{% for r in data.securities %}
|
||||
{{ SECLABEL.APPLY(conn, 'DATABASE', data.name, r.provider, r.securitylabel) }}
|
||||
{{ SECLABEL.APPLY(conn, 'DATABASE', data.name, r.provider, r.label) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{# Variables/options #}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user