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'],
|
model: OptionsModel, control: 'unique-col-collection', mode: ['edit', 'create'],
|
||||||
canAdd: true, canDelete: true, uniqueCol : ['fsrvoption'],
|
canAdd: true, canDelete: true, uniqueCol : ['fsrvoption'],
|
||||||
columns: ['fsrvoption','fsrvvalue']
|
columns: ['fsrvoption','fsrvvalue']
|
||||||
},{
|
}, pgBrowser.SecurityGroupUnderSchema, {
|
||||||
id: 'fsrvacl', label: 'Privileges', type: 'collection', group: '{{ _('Security') }}',
|
id: 'fsrvacl', label: 'Privileges', type: 'collection', group: 'security',
|
||||||
model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend({privileges: ['U']}), control: 'unique-col-collection',
|
model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend({privileges: ['U']}), control: 'unique-col-collection',
|
||||||
mode: ['edit', 'create'], canAdd: true, canDelete: true, uniqueCol : ['grantee']
|
mode: ['edit', 'create'], canAdd: true, canDelete: true, uniqueCol : ['grantee']
|
||||||
},{
|
},{
|
||||||
|
|||||||
@@ -5,18 +5,19 @@ define(
|
|||||||
function($, _, S, pgAdmin, pgBrowser, alertify) {
|
function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||||
|
|
||||||
// Extend the browser's node model class to create a Options model
|
// 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: {
|
defaults: {
|
||||||
fdwoption: undefined,
|
fdwoption: undefined,
|
||||||
fdwvalue: undefined
|
fdwvalue: undefined
|
||||||
},
|
},
|
||||||
|
|
||||||
// Defining schema for the Options model
|
// Defining schema for the Options model
|
||||||
schema: [
|
schema: [{
|
||||||
{id: 'fdwoption', label:'Options', type:'text', cellHeaderClasses:'width_percent_50', group: null, editable: true},
|
id: 'fdwoption', label: '{{ _('Option') }}', type:'text',
|
||||||
{id: 'fdwvalue', label:'Value', type: 'text', cellHeaderClasses:'width_percent_50', group:null, editable: true},
|
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
|
/* validate function is used to validate the input given by
|
||||||
* the user. In case of error, message will be displayed on
|
* the user. In case of error, message will be displayed on
|
||||||
* the browser for the respective control.
|
* 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
|
// Extend the browser's collection class for foreign data wrapper collection
|
||||||
if (!pgBrowser.Nodes['coll-foreign_data_wrapper']) {
|
if (!pgBrowser.Nodes['coll-foreign_data_wrapper']) {
|
||||||
var foreign_data_wrappers = pgAdmin.Browser.Nodes['coll-foreign_data_wrapper'] =
|
var foreign_data_wrappers = pgBrowser.Nodes['coll-foreign_data_wrapper'] =
|
||||||
pgAdmin.Browser.Collection.extend({
|
pgBrowser.Collection.extend({
|
||||||
node: 'foreign_data_wrapper',
|
node: 'foreign_data_wrapper',
|
||||||
label: '{{ _('Foreign Data Wrappers') }}',
|
label: '{{ _('Foreign Data Wrappers') }}',
|
||||||
type: 'coll-foreign_data_wrapper',
|
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
|
// Extend the browser's node class for foreign data wrapper node
|
||||||
if (!pgBrowser.Nodes['foreign_data_wrapper']) {
|
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',
|
parent_type: 'database',
|
||||||
type: 'foreign_data_wrapper',
|
type: 'foreign_data_wrapper',
|
||||||
sqlAlterHelp: 'sql-alterforeigndatawrapper.html',
|
sqlAlterHelp: 'sql-alterforeigndatawrapper.html',
|
||||||
@@ -91,7 +92,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Defining model for foreign data wrapper node
|
// Defining model for foreign data wrapper node
|
||||||
model: pgAdmin.Browser.Node.Model.extend({
|
model: pgBrowser.Node.Model.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
name: undefined,
|
name: undefined,
|
||||||
fdwowner: undefined,
|
fdwowner: undefined,
|
||||||
@@ -111,7 +112,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
|
|
||||||
this.set({'fdwowner': userInfo.name}, {silent: true});
|
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
|
// Defining schema for the foreign data wrapper node
|
||||||
@@ -148,36 +149,38 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
id: 'fdwvalue', label:'{{ _('Validator') }}', type: 'text', control: 'node-ajax-options',
|
id: 'fdwvalue', label:'{{ _('Validator') }}', type: 'text', control: 'node-ajax-options',
|
||||||
group: '{{ _('Definition') }}', mode: ['edit', 'create', 'properties'], url:'get_validators'
|
group: '{{ _('Definition') }}', mode: ['edit', 'create', 'properties'], url:'get_validators'
|
||||||
},{
|
},{
|
||||||
id: 'fdwacl', label: 'Privileges', type: 'collection', group: '{{ _('Security') }}',
|
id: 'security', label: '{{ _("Security") }}', type: 'group'
|
||||||
model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend({privileges: ['U']}), control: 'unique-col-collection',
|
},{
|
||||||
mode: ['edit', 'create'], canAdd: true, canDelete: true, uniqueCol : ['grantee']
|
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',
|
id: 'acl', label: '{{ _('Privileges') }}', type: 'text',
|
||||||
group: '{{ _('Security') }}', mode: ['properties'], disabled: true
|
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.
|
||||||
|
*/
|
||||||
|
validate: function() {
|
||||||
|
var name = this.get('name');
|
||||||
|
|
||||||
|
if (_.isUndefined(name) || _.isNull(name) ||
|
||||||
|
String(name).replace(/^\s+|\s+$/g, '') == '') {
|
||||||
|
var msg = '{{ _('Name cannot be empty.') }}';
|
||||||
|
this.errorModel.set('name', msg);
|
||||||
|
return msg;
|
||||||
|
} else {
|
||||||
|
this.errorModel.unset('name');
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
],
|
|
||||||
|
|
||||||
/* 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.
|
|
||||||
*/
|
|
||||||
validate: function() {
|
|
||||||
var name = this.get('name');
|
|
||||||
|
|
||||||
if (_.isUndefined(name) || _.isNull(name) ||
|
|
||||||
String(name).replace(/^\s+|\s+$/g, '') == '') {
|
|
||||||
var msg = '{{ _('Name cannot be empty.') }}';
|
|
||||||
this.errorModel.set('name', msg);
|
|
||||||
return msg;
|
|
||||||
} else {
|
|
||||||
this.errorModel.unset('name');
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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'],
|
'alertify', 'pgadmin.browser.collection', 'pgadmin.browser.server.privilege'],
|
||||||
function($, _, S, pgAdmin, pgBrowser, alertify) {
|
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
|
// Extend the browser's collection class for languages collection
|
||||||
if (!pgBrowser.Nodes['coll-language']) {
|
if (!pgBrowser.Nodes['coll-language']) {
|
||||||
var languages = pgAdmin.Browser.Nodes['coll-language'] =
|
var languages = pgBrowser.Nodes['coll-language'] =
|
||||||
pgAdmin.Browser.Collection.extend({
|
pgBrowser.Collection.extend({
|
||||||
node: 'language',
|
node: 'language',
|
||||||
label: '{{ _('Languages') }}',
|
label: '{{ _('Languages') }}',
|
||||||
type: 'coll-language',
|
type: 'coll-language',
|
||||||
@@ -52,7 +16,7 @@ define(
|
|||||||
|
|
||||||
// Extend the browser's node class for language node
|
// Extend the browser's node class for language node
|
||||||
if (!pgBrowser.Nodes['language']) {
|
if (!pgBrowser.Nodes['language']) {
|
||||||
pgAdmin.Browser.Nodes['language'] = pgAdmin.Browser.Node.extend({
|
pgBrowser.Nodes['language'] = pgBrowser.Node.extend({
|
||||||
parent_type: 'database',
|
parent_type: 'database',
|
||||||
type: 'language',
|
type: 'language',
|
||||||
sqlAlterHelp: 'sql-alterlanguage.html',
|
sqlAlterHelp: 'sql-alterlanguage.html',
|
||||||
@@ -70,7 +34,7 @@ define(
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Define the model for language node
|
// Define the model for language node
|
||||||
model: pgAdmin.Browser.Node.Model.extend({
|
model: pgBrowser.Node.Model.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
name: undefined,
|
name: undefined,
|
||||||
lanowner: undefined,
|
lanowner: undefined,
|
||||||
@@ -97,7 +61,7 @@ define(
|
|||||||
id: 'description', label:'{{ _('Comment') }}', cell: 'string',
|
id: 'description', label:'{{ _('Comment') }}', cell: 'string',
|
||||||
type: 'multiline'
|
type: 'multiline'
|
||||||
},{
|
},{
|
||||||
id: 'trusted', label:'{{ _('Trusted?') }}', type: 'switch',
|
id: 'trusted', label:'{{ _('Trusted?') }}', type: 'switch',
|
||||||
options: {
|
options: {
|
||||||
'onText': 'Yes', 'offText': 'No',
|
'onText': 'Yes', 'offText': 'No',
|
||||||
'onColor': 'success', 'offColor': 'primary',
|
'onColor': 'success', 'offColor': 'primary',
|
||||||
@@ -167,16 +131,18 @@ define(
|
|||||||
}, disabled: function(m) {
|
}, disabled: function(m) {
|
||||||
return !(m.isNew());
|
return !(m.isNew());
|
||||||
}
|
}
|
||||||
},{
|
}, pgBrowser.SecurityGroupUnderSchema, {
|
||||||
id: 'lanacl', label: '{{ _('Privileges') }}', type: 'collection', group: '{{ _('Security') }}',
|
id: 'lanacl', label: '{{ _('Privileges') }}', type: 'collection',
|
||||||
model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend({privileges: ['U']}), control: 'unique-col-collection',
|
group: 'security', control: 'unique-col-collection', mode: ['edit'],
|
||||||
mode: ['edit'], canAdd: true, canDelete: true, uniqueCol : ['grantee']
|
model: pgBrowser.Node.PrivilegeRoleModel.extend({
|
||||||
|
privileges: ['U']
|
||||||
|
}), canAdd: true, canDelete: true, uniqueCol : ['grantee']
|
||||||
},{
|
},{
|
||||||
id: 'seclabels', label: '{{ _('Security Labels') }}',
|
id: 'seclabels', label: '{{ _('Security Labels') }}', mode: ['edit'],
|
||||||
model: SecurityModel, editable: false, type: 'collection',
|
model: pgBrowser.SecLabelModel, editable: false,
|
||||||
group: '{{ _('Security') }}', mode: ['edit'],
|
type: 'collection', group: 'security', min_version: 90200,
|
||||||
min_version: 90200, canAdd: true,
|
canAdd: true, canEdit: false, canDelete: true,
|
||||||
canEdit: false, canDelete: true, control: 'unique-col-collection'
|
control: 'unique-col-collection'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
/* validate function is used to validate the input given by
|
/* validate function is used to validate the input given by
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ class SchemaView(PGChildNodeView):
|
|||||||
sec = re.search(r'([^=]+)=(.*$)', sec)
|
sec = re.search(r'([^=]+)=(.*$)', sec)
|
||||||
seclabels.append({
|
seclabels.append({
|
||||||
'provider': sec.group(1),
|
'provider': sec.group(1),
|
||||||
'security_label': sec.group(2)
|
'label': sec.group(2)
|
||||||
})
|
})
|
||||||
|
|
||||||
data['seclabels'] = seclabels
|
data['seclabels'] = seclabels
|
||||||
|
|||||||
@@ -60,11 +60,9 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
},{
|
},{
|
||||||
id: 'description', label:'{{ _('Comment') }}', cell: 'string',
|
id: 'description', label:'{{ _('Comment') }}', cell: 'string',
|
||||||
type: 'multiline', disabled: true
|
type: 'multiline', disabled: true
|
||||||
}
|
}]
|
||||||
]
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return pgBrowser.Nodes['catalog_object_column'];
|
return pgBrowser.Nodes['catalog_object_column'];
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
|
|
||||||
// Define Domain Collection Node
|
// Define Domain Collection Node
|
||||||
if (!pgBrowser.Nodes['coll-domain']) {
|
if (!pgBrowser.Nodes['coll-domain']) {
|
||||||
var domains = pgAdmin.Browser.Nodes['coll-domain'] =
|
var domains = pgBrowser.Nodes['coll-domain'] =
|
||||||
pgAdmin.Browser.Collection.extend({
|
pgBrowser.Collection.extend({
|
||||||
node: 'domain',
|
node: 'domain',
|
||||||
label: '{{ _('Domains') }}',
|
label: '{{ _('Domains') }}',
|
||||||
type: 'coll-domain',
|
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
|
// Constraint Model
|
||||||
var ConstraintModel = pgAdmin.Browser.Node.Model.extend({
|
var ConstraintModel = pgBrowser.Node.Model.extend({
|
||||||
idAttribute: 'conoid',
|
idAttribute: 'conoid',
|
||||||
initialize: function(attrs, args) {
|
initialize: function(attrs, args) {
|
||||||
var isNew = (_.size(attrs) === 0);
|
var isNew = (_.size(attrs) === 0);
|
||||||
if (!isNew) {
|
if (!isNew) {
|
||||||
this.convalidated_default = this.get('convalidated')
|
this.convalidated_default = this.get('convalidated')
|
||||||
}
|
}
|
||||||
pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments);
|
pgBrowser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||||
},
|
},
|
||||||
defaults: {
|
defaults: {
|
||||||
conoid: undefined,
|
conoid: undefined,
|
||||||
@@ -107,7 +77,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
|
|
||||||
// Domain Node
|
// Domain Node
|
||||||
if (!pgBrowser.Nodes['domain']) {
|
if (!pgBrowser.Nodes['domain']) {
|
||||||
pgAdmin.Browser.Nodes['domain'] = pgBrowser.Node.extend({
|
pgBrowser.Nodes['domain'] = pgBrowser.Node.extend({
|
||||||
type: 'domain',
|
type: 'domain',
|
||||||
sqlAlterHelp: 'sql-alterdomain.html',
|
sqlAlterHelp: 'sql-alterdomain.html',
|
||||||
sqlCreateHelp: 'sql-createdomain.html',
|
sqlCreateHelp: 'sql-createdomain.html',
|
||||||
@@ -149,7 +119,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
canDrop: pgBrowser.Nodes['schema'].canChildDrop,
|
canDrop: pgBrowser.Nodes['schema'].canChildDrop,
|
||||||
canDropCascade: pgBrowser.Nodes['schema'].canChildDrop,
|
canDropCascade: pgBrowser.Nodes['schema'].canChildDrop,
|
||||||
// Domain Node Model
|
// Domain Node Model
|
||||||
model: pgAdmin.Browser.Node.Model.extend({
|
model: pgBrowser.Node.Model.extend({
|
||||||
initialize: function(attrs, args) {
|
initialize: function(attrs, args) {
|
||||||
var isNew = (_.size(attrs) === 0);
|
var isNew = (_.size(attrs) === 0);
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
@@ -161,7 +131,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
||||||
this.set({'owner': userInfo.name}, {silent: true});
|
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: {
|
defaults: {
|
||||||
name: undefined,
|
name: undefined,
|
||||||
@@ -293,17 +263,17 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
type: 'collection', group: '{{ _('Constraints') }}', mode: ['edit', 'create'],
|
type: 'collection', group: '{{ _('Constraints') }}', mode: ['edit', 'create'],
|
||||||
model: ConstraintModel, canAdd: true, canDelete: true,
|
model: ConstraintModel, canAdd: true, canDelete: true,
|
||||||
canEdit: false, columns: ['conname','consrc', 'convalidated']
|
canEdit: false, columns: ['conname','consrc', 'convalidated']
|
||||||
},{
|
},
|
||||||
|
pgBrowser.SecurityGroupUnderSchema,
|
||||||
|
{
|
||||||
id: 'seclabels', label: '{{ _('Security Labels') }}',
|
id: 'seclabels', label: '{{ _('Security Labels') }}',
|
||||||
model: SecurityModel, type: 'collection',
|
model: pgBrowser.SecLabelModel, type: 'collection',
|
||||||
group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
group: 'security', mode: ['edit', 'create'],
|
||||||
min_version: 90100, canAdd: true,
|
min_version: 90100, canAdd: true,
|
||||||
canEdit: false, canDelete: true,
|
canEdit: false, canDelete: true,
|
||||||
control: 'unique-col-collection', uniqueCol : ['provider']
|
control: 'unique-col-collection', uniqueCol : ['provider']
|
||||||
}
|
}],
|
||||||
],
|
validate: function() { // Client Side Validation
|
||||||
validate: function() // Client Side Validation
|
|
||||||
{
|
|
||||||
var err = {},
|
var err = {},
|
||||||
errmsg,
|
errmsg,
|
||||||
seclabels = this.get('seclabels');
|
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) }}
|
COMMENT ON DOMAIN {{ conn|qtIdent(data.basensp, data.name) }}
|
||||||
IS '{{ data.description }}';{% endif -%}{% if data.seclabels %}
|
IS '{{ data.description }}';{% endif -%}{% if data.seclabels %}
|
||||||
{% for r in 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 -%}
|
{% endfor -%}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|
||||||
|
|||||||
@@ -49,13 +49,13 @@ ALTER DOMAIN {{ conn|qtIdent(o_data.basensp, name) }}
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABLE.SET(conn, 'DOMAIN', name, r.provider, r.security_label, o_data.basensp) }}
|
{{ SECLABLE.SET(conn, 'DOMAIN', name, r.provider, r.label, o_data.basensp) }}
|
||||||
|
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABLE.SET(conn, 'DOMAIN', name, r.provider, r.security_label, o_data.basensp) }}
|
{{ SECLABLE.SET(conn, 'DOMAIN', name, r.provider, r.label, o_data.basensp) }}
|
||||||
|
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
{% endif -%}{% if data.description %}
|
{% endif -%}{% if data.description %}
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ COMMENT ON DOMAIN {{ conn|qtIdent(data.basensp, data.name) }}
|
|||||||
|
|
||||||
{% if data.seclabels %}
|
{% if data.seclabels %}
|
||||||
{% for r in 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 -%}
|
{% endfor -%}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|
||||||
|
|||||||
@@ -62,12 +62,12 @@ ALTER DOMAIN {{ conn|qtIdent(o_data.basensp, name) }}
|
|||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
|
|
||||||
{{ SECLABLE.SET(conn, 'DOMAIN', name, r.provider, r.security_label, o_data.basensp) }}
|
{{ SECLABLE.SET(conn, 'DOMAIN', name, r.provider, r.label, o_data.basensp) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% endif -%}{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
|
|
||||||
{{ SECLABLE.SET(conn, 'DOMAIN', name, r.provider, r.security_label, o_data.basensp) }}
|
{{ SECLABLE.SET(conn, 'DOMAIN', name, r.provider, r.label, o_data.basensp) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}{% if data.description %}
|
{% endif -%}{% if data.description %}
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ define(
|
|||||||
function($, _, S, pgAdmin, pgBrowser, alertify) {
|
function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||||
|
|
||||||
if (!pgBrowser.Nodes['coll-foreign-table']) {
|
if (!pgBrowser.Nodes['coll-foreign-table']) {
|
||||||
var foreigntable = pgAdmin.Browser.Nodes['coll-foreign-table'] =
|
var foreigntable = pgBrowser.Nodes['coll-foreign-table'] =
|
||||||
pgAdmin.Browser.Collection.extend({
|
pgBrowser.Collection.extend({
|
||||||
node: 'foreign-table',
|
node: 'foreign-table',
|
||||||
label: '{{ _('Foreign Tables') }}',
|
label: '{{ _('Foreign Tables') }}',
|
||||||
type: 'coll-foreign-table',
|
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
|
// Integer Cell for Columns Length and Precision
|
||||||
var IntegerDepCell = Backgrid.IntegerCell.extend({
|
var IntegerDepCell = Backgrid.IntegerCell.extend({
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
@@ -64,7 +37,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
|
|
||||||
|
|
||||||
// Columns Model
|
// Columns Model
|
||||||
var ColumnsModel = pgAdmin.Browser.Node.Model.extend({
|
var ColumnsModel = pgBrowser.Node.Model.extend({
|
||||||
idAttribute: 'attnum',
|
idAttribute: 'attnum',
|
||||||
defaults: {
|
defaults: {
|
||||||
attname: undefined,
|
attname: undefined,
|
||||||
@@ -395,7 +368,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
cache_level = this.field.get('cache_level') || node.type,
|
cache_level = this.field.get('cache_level') || node.type,
|
||||||
cache_node = this.field.get('cache_node');
|
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);
|
m.trigger('pgadmin:view:fetching', m, self.field);
|
||||||
data = {attrelid: table_id}
|
data = {attrelid: table_id}
|
||||||
@@ -431,14 +404,14 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
|
|
||||||
|
|
||||||
// Constraints Model
|
// Constraints Model
|
||||||
var ConstraintModel = pgAdmin.Browser.Node.Model.extend({
|
var ConstraintModel = pgBrowser.Node.Model.extend({
|
||||||
idAttribute: 'conoid',
|
idAttribute: 'conoid',
|
||||||
initialize: function(attrs, args) {
|
initialize: function(attrs, args) {
|
||||||
var isNew = (_.size(attrs) === 0);
|
var isNew = (_.size(attrs) === 0);
|
||||||
if (!isNew) {
|
if (!isNew) {
|
||||||
this.convalidated_default = this.get('convalidated')
|
this.convalidated_default = this.get('convalidated')
|
||||||
}
|
}
|
||||||
pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments);
|
pgBrowser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||||
},
|
},
|
||||||
defaults: {
|
defaults: {
|
||||||
conoid: undefined,
|
conoid: undefined,
|
||||||
@@ -505,7 +478,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
|
|
||||||
|
|
||||||
// Options Model
|
// Options Model
|
||||||
var OptionsModel = pgAdmin.Browser.Node.Model.extend({
|
var OptionsModel = pgBrowser.Node.Model.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
option: undefined,
|
option: undefined,
|
||||||
value: undefined
|
value: undefined
|
||||||
@@ -526,7 +499,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
|
|
||||||
|
|
||||||
if (!pgBrowser.Nodes['foreign-table']) {
|
if (!pgBrowser.Nodes['foreign-table']) {
|
||||||
pgAdmin.Browser.Nodes['foreign-table'] = pgBrowser.Node.extend({
|
pgBrowser.Nodes['foreign-table'] = pgBrowser.Node.extend({
|
||||||
type: 'foreign-table',
|
type: 'foreign-table',
|
||||||
sqlAlterHelp: 'sql-alterforeigntable.html',
|
sqlAlterHelp: 'sql-alterforeigntable.html',
|
||||||
sqlCreateHelp: 'sql-createforeigntable.html',
|
sqlCreateHelp: 'sql-createforeigntable.html',
|
||||||
@@ -567,7 +540,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
},
|
},
|
||||||
canDrop: pgBrowser.Nodes['schema'].canChildDrop,
|
canDrop: pgBrowser.Nodes['schema'].canChildDrop,
|
||||||
canDropCascade: pgBrowser.Nodes['schema'].canChildDrop,
|
canDropCascade: pgBrowser.Nodes['schema'].canChildDrop,
|
||||||
model: pgAdmin.Browser.Node.Model.extend({
|
model: pgBrowser.Node.Model.extend({
|
||||||
initialize: function(attrs, args) {
|
initialize: function(attrs, args) {
|
||||||
var isNew = (_.size(attrs) === 0);
|
var isNew = (_.size(attrs) === 0);
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
@@ -579,7 +552,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
||||||
this.set({'owner': userInfo.name}, {silent: true});
|
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: {
|
defaults: {
|
||||||
name: undefined,
|
name: undefined,
|
||||||
@@ -672,18 +645,18 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
id: 'relacl', label: '{{ _('Privileges') }}', cell: 'string',
|
id: 'relacl', label: '{{ _('Privileges') }}', cell: 'string',
|
||||||
type: 'text', group: '{{ _('Security') }}',
|
type: 'text', group: '{{ _('Security') }}',
|
||||||
mode: ['properties'], min_version: 90200
|
mode: ['properties'], min_version: 90200
|
||||||
},{
|
}, pgBrowser.SecurityGroupUnderSchema, {
|
||||||
id: 'acl', label: '{{ _('Privileges') }}', model: pgAdmin
|
id: 'acl', label: '{{ _('Privileges') }}', model: pgAdmin
|
||||||
.Browser.Node.PrivilegeRoleModel.extend(
|
.Browser.Node.PrivilegeRoleModel.extend(
|
||||||
{privileges: ['a','r','w','x']}), uniqueCol : ['grantee', 'grantor'],
|
{privileges: ['a','r','w','x']}), uniqueCol : ['grantee', 'grantor'],
|
||||||
editable: false, type: 'collection', group: '{{ _('Security') }}',
|
editable: false, type: 'collection', group: 'security',
|
||||||
mode: ['edit', 'create'],
|
mode: ['edit', 'create'],
|
||||||
canAdd: true, canDelete: true, control: 'unique-col-collection',
|
canAdd: true, canDelete: true, control: 'unique-col-collection',
|
||||||
min_version: 90200
|
min_version: 90200
|
||||||
},{
|
},{
|
||||||
id: 'seclabels', label: '{{ _('Security Labels') }}',
|
id: 'seclabels', label: '{{ _('Security Labels') }}',
|
||||||
model: SecurityModel, type: 'collection',
|
model: pgBrowser.SecLabelModel, type: 'collection',
|
||||||
group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
group: 'security', mode: ['edit', 'create'],
|
||||||
min_version: 90100, canAdd: true,
|
min_version: 90100, canAdd: true,
|
||||||
canEdit: false, canDelete: true,
|
canEdit: false, canDelete: true,
|
||||||
control: 'unique-col-collection', uniqueCol : ['provider']
|
control: 'unique-col-collection', uniqueCol : ['provider']
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ COMMENT ON FOREIGN TABLE {{ conn|qtIdent(data.basensp, data.name) }}
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.seclabels %}
|
{% if data.seclabels %}
|
||||||
{% for r in 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 %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -87,13 +87,13 @@ ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }}
|
|||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
|
|
||||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.security_label, o_data.basensp) }}
|
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
|
|
||||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.security_label, o_data.basensp) }}
|
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.description is defined and data.description != o_data.description%}
|
{% if data.description is defined and data.description != o_data.description%}
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ COMMENT ON FOREIGN TABLE {{ conn|qtIdent(data.basensp, data.name) }}
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.seclabels %}
|
{% if data.seclabels %}
|
||||||
|
|
||||||
{% for r in data.seclabels %}{% if r.security_label and r.provider %}
|
{% for r in data.seclabels %}{% if r.label and r.provider %}
|
||||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', data.name, r.provider, r.security_label, data.basensp) }}
|
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', data.name, r.provider, r.label, data.basensp) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -126,13 +126,13 @@ ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }}
|
|||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
|
|
||||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.security_label, o_data.basensp) }}
|
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
|
|
||||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.security_label, o_data.basensp) }}
|
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.description is defined and data.description != o_data.description%}
|
{% if data.description is defined and data.description != o_data.description%}
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ COMMENT ON FOREIGN TABLE {{ conn|qtIdent(data.basensp, data.name) }}
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.seclabels %}
|
{% if data.seclabels %}
|
||||||
{% for r in 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 %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -138,13 +138,13 @@ ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }}
|
|||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
|
|
||||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.security_label, o_data.basensp) }}
|
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
|
|
||||||
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.security_label, o_data.basensp) }}
|
{{ SECLABLE.SET(conn, 'FOREIGN TABLE', name, r.provider, r.label, o_data.basensp) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.description is defined and data.description != o_data.description%}
|
{% if data.description is defined and data.description != o_data.description%}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ define(
|
|||||||
function($, _, S, pgAdmin, pgBrowser, alertify) {
|
function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||||
|
|
||||||
if (!pgBrowser.Nodes['coll-function']) {
|
if (!pgBrowser.Nodes['coll-function']) {
|
||||||
var functions = pgAdmin.Browser.Nodes['coll-function'] =
|
var functions = pgBrowser.Nodes['coll-function'] =
|
||||||
pgAdmin.Browser.Collection.extend({
|
pgBrowser.Collection.extend({
|
||||||
node: 'function',
|
node: 'function',
|
||||||
label: '{{ _('Functions') }}',
|
label: '{{ _('Functions') }}',
|
||||||
type: 'coll-function',
|
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
|
// Argument Model
|
||||||
var ArgumentModel = pgAdmin.Browser.Node.Model.extend({
|
var ArgumentModel = pgBrowser.Node.Model.extend({
|
||||||
idAttribute: 'argid',
|
idAttribute: 'argid',
|
||||||
defaults: {
|
defaults: {
|
||||||
argid: undefined,
|
argid: undefined,
|
||||||
@@ -100,7 +73,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!pgBrowser.Nodes['function']) {
|
if (!pgBrowser.Nodes['function']) {
|
||||||
pgAdmin.Browser.Nodes['function'] = pgBrowser.Node.extend({
|
pgBrowser.Nodes['function'] = pgBrowser.Node.extend({
|
||||||
type: 'function',
|
type: 'function',
|
||||||
sqlAlterHelp: 'sql-alterfunction.html',
|
sqlAlterHelp: 'sql-alterfunction.html',
|
||||||
sqlCreateHelp: 'sql-createfunction.html',
|
sqlCreateHelp: 'sql-createfunction.html',
|
||||||
@@ -142,7 +115,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
},
|
},
|
||||||
canDrop: pgBrowser.Nodes['schema'].canChildDrop,
|
canDrop: pgBrowser.Nodes['schema'].canChildDrop,
|
||||||
canDropCascade: pgBrowser.Nodes['schema'].canChildDrop,
|
canDropCascade: pgBrowser.Nodes['schema'].canChildDrop,
|
||||||
model: pgAdmin.Browser.Node.Model.extend({
|
model: pgBrowser.Node.Model.extend({
|
||||||
initialize: function(attrs, args) {
|
initialize: function(attrs, args) {
|
||||||
var isNew = (_.size(attrs) === 0);
|
var isNew = (_.size(attrs) === 0);
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
@@ -154,7 +127,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
||||||
this.set({'funcowner': userInfo.name}, {silent: true});
|
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: {
|
defaults: {
|
||||||
name: undefined,
|
name: undefined,
|
||||||
@@ -176,7 +149,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
procost: undefined, /* Estimated execution Cost */
|
procost: undefined, /* Estimated execution Cost */
|
||||||
prorows: undefined, /* Estimated number of rows */
|
prorows: undefined, /* Estimated number of rows */
|
||||||
proleakproof: undefined,
|
proleakproof: undefined,
|
||||||
arguments: [],
|
args: [],
|
||||||
prosrc: undefined,
|
prosrc: undefined,
|
||||||
prosrc_c: undefined,
|
prosrc_c: undefined,
|
||||||
probin: '$libdir/',
|
probin: '$libdir/',
|
||||||
@@ -273,13 +246,12 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
{'label': 'IMMUTABLE', 'value': 'i'},
|
{'label': 'IMMUTABLE', 'value': 'i'},
|
||||||
], disabled: 'isDisabled'
|
], disabled: 'isDisabled'
|
||||||
},{
|
},{
|
||||||
id: 'proretset', label: '{{ _('Returns a set?') }}', group: '{{ _('Options') }}',
|
id: 'proretset', label: '{{ _('Returns a set?') }}', type: 'switch',
|
||||||
cell:'boolean', type: 'switch', disabled: 'isDisabled',
|
disabled: 'isDisabled', group: '{{ _('Options') }}',
|
||||||
visible: 'isVisible'
|
visible: 'isVisible'
|
||||||
},{
|
},{
|
||||||
id: 'proisstrict', label: '{{ _('Strict?') }}', group: '{{ _
|
id: 'proisstrict', label: '{{ _('Strict?') }}', type: 'switch',
|
||||||
('Options') }}',
|
group: '{{ _('Options') }}', disabled: 'isDisabled',
|
||||||
cell:'boolean', type: 'switch', disabled: 'isDisabled',
|
|
||||||
options: {
|
options: {
|
||||||
'onText': 'Yes', 'offText': 'No',
|
'onText': 'Yes', 'offText': 'No',
|
||||||
'onColor': 'success', 'offColor': 'primary',
|
'onColor': 'success', 'offColor': 'primary',
|
||||||
@@ -287,7 +259,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
id: 'prosecdef', label: '{{ _('Security of definer?') }}',
|
id: 'prosecdef', label: '{{ _('Security of definer?') }}',
|
||||||
group: '{{ _('Options') }}', cell:'boolean', type: 'switch',
|
group: '{{ _('Options') }}', type: 'switch',
|
||||||
disabled: 'isDisabled'
|
disabled: 'isDisabled'
|
||||||
},{
|
},{
|
||||||
id: 'proiswindow', label: '{{ _('Window?') }}',
|
id: 'proiswindow', label: '{{ _('Window?') }}',
|
||||||
@@ -297,20 +269,18 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
id: 'procost', label: '{{ _('Estimated cost') }}', group: '{{ _('Options') }}',
|
id: 'procost', label: '{{ _('Estimated cost') }}', group: '{{ _('Options') }}',
|
||||||
cell:'string', type: 'text', disabled: 'isDisabled'
|
cell:'string', type: 'text', disabled: 'isDisabled'
|
||||||
},{
|
},{
|
||||||
id: 'prorows', label: '{{ _('Estimated rows') }}', group: '{{ _
|
id: 'prorows', label: '{{ _('Estimated rows') }}', type: 'text',
|
||||||
('Options') }}',
|
deps: ['proretset'], visible: 'isVisible', disabled: 'isDisabled',
|
||||||
cell:'string', type: 'text', disabled: 'isDisabled',
|
group: '{{ _('Options') }}'
|
||||||
deps: ['proretset'], visible: 'isVisible'
|
|
||||||
},{
|
},{
|
||||||
id: 'proleakproof', label: '{{ _('Leak proof?') }}',
|
id: 'proleakproof', label: '{{ _('Leak proof?') }}',
|
||||||
group: '{{ _('Options') }}', cell:'boolean', type: 'switch', min_version: 90200,
|
group: '{{ _('Options') }}', cell:'boolean', type: 'switch', min_version: 90200,
|
||||||
disabled: 'isDisabled'
|
disabled: 'isDisabled'
|
||||||
},{
|
},{
|
||||||
id: 'proacl', label: '{{ _('Privileges') }}',
|
id: 'proacl', label: '{{ _('Privileges') }}', type: 'text',
|
||||||
group: '{{ _('Security') }}', cell:'boolean', type: 'text', cell: 'string',
|
mode: ['properties'], group: '{{ _('Security') }}'
|
||||||
mode: ['properties']
|
|
||||||
},{
|
},{
|
||||||
id: 'arguments', label: '{{ _('Arguments') }}', cell: 'string',
|
id: 'args', label: '{{ _('Arguments') }}', cell: 'string',
|
||||||
group: '{{ _('Arguments') }}', type: 'collection', canAdd: function(m){
|
group: '{{ _('Arguments') }}', type: 'collection', canAdd: function(m){
|
||||||
return m.isNew();
|
return m.isNew();
|
||||||
},
|
},
|
||||||
@@ -320,26 +290,23 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
},{
|
},{
|
||||||
id: 'variables', label: '{{ _('Parameters') }}', type: 'collection',
|
id: 'variables', label: '{{ _('Parameters') }}', type: 'collection',
|
||||||
group: '{{ _('Parameters') }}', control: 'variable-collection',
|
group: '{{ _('Parameters') }}', control: 'variable-collection',
|
||||||
model: pgAdmin.Browser.Node.VariableModel,
|
model: pgBrowser.Node.VariableModel,
|
||||||
mode: ['edit', 'create'], canAdd: 'canVarAdd', canEdit: false,
|
mode: ['edit', 'create'], canAdd: 'canVarAdd', canEdit: false,
|
||||||
canDelete: true, disabled: 'isDisabled'
|
canDelete: true, disabled: 'isDisabled'
|
||||||
},{
|
}, pgBrowser.SecurityGroupUnderSchema, {
|
||||||
id: 'acl', label: '{{ _('Privileges') }}', model: pgAdmin
|
id: 'acl', label: '{{ _('Privileges') }}', editable: false,
|
||||||
.Browser.Node.PrivilegeRoleModel.extend(
|
model: pgBrowser.Node.PrivilegeRoleModel.extend({
|
||||||
{privileges: ['X']}), uniqueCol : ['grantee', 'grantor'],
|
privileges: ['X']
|
||||||
editable: false, type: 'collection', group: '{{ _('Security') }}',
|
}), uniqueCol : ['grantee', 'grantor'], type: 'collection',
|
||||||
mode: ['edit', 'create'],
|
group: 'security', mode: ['edit', 'create'], canAdd: true,
|
||||||
canAdd: true, canDelete: true, control: 'unique-col-collection',
|
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'
|
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()
|
validate: function()
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
{% import 'macros/functions/variable.macros' as VARIABLE %}
|
{% import 'macros/functions/variable.macros' as VARIABLE %}
|
||||||
{% set is_columns = [] %}
|
{% set is_columns = [] %}
|
||||||
{% if data %}
|
{% if data %}
|
||||||
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data.arguments %}
|
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data.args %}
|
||||||
{% 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 %}
|
{% 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 %}
|
{% if not loop.last %},{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
@@ -43,9 +43,9 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.seclabels %}
|
{% if data.seclabels %}
|
||||||
{% for r in 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 %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|||||||
@@ -4,15 +4,15 @@
|
|||||||
{% set name = o_data.name %}
|
{% set name = o_data.name %}
|
||||||
{% if data.name %}
|
{% if data.name %}
|
||||||
{% if data.name != o_data.name %}
|
{% if data.name != o_data.name %}
|
||||||
ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, o_data.name) }}({{o_data.proargtypenames }})
|
ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, o_data.name) }}({{ o_data.proargtypenames }})
|
||||||
RENAME TO {{ conn|qtIdent(data.name) }};
|
RENAME TO {{ conn|qtIdent(data.name) }};
|
||||||
{% set name = data.name %}
|
{% set name = data.name %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.change_func %}
|
{% if data.change_func %}
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.arguments %}
|
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.args %}
|
||||||
{% 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 %}
|
{% 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 %}
|
{% if not loop.last %}, {% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% 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 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ 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 -%}
|
{% endfor %}{% endif -%}
|
||||||
{% if data.description is defined and data.description != o_data.description%}
|
{% if data.description is defined and data.description != o_data.description%}
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
{% import 'macros/functions/variable.macros' as VARIABLE %}
|
{% import 'macros/functions/variable.macros' as VARIABLE %}
|
||||||
{% set is_columns = [] %}
|
{% set is_columns = [] %}
|
||||||
{% if data %}
|
{% if data %}
|
||||||
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data.arguments %}
|
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data.args %}
|
||||||
{% 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 %}
|
{% 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 %}
|
{% if not loop.last %},{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
@@ -47,9 +47,9 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.seclabels %}
|
{% if data.seclabels %}
|
||||||
{% for r in 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 %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, o_data.name) }}({{o_data.pro
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.change_func %}
|
{% if data.change_func %}
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.arguments %}
|
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.args %}
|
||||||
{% 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 %}
|
{% 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 %}
|
{% if not loop.last %}, {% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% 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 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
|
|
||||||
{{ 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.description is defined and data.description != o_data.description%}
|
{% if data.description is defined and data.description != o_data.description%}
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
{% set is_columns = [] %}
|
{% set is_columns = [] %}
|
||||||
{% if data %}
|
{% if data %}
|
||||||
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data
|
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data
|
||||||
.arguments %}
|
.args %}
|
||||||
{% 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 %}
|
{% 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 %}
|
{% if not loop.last %},{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
@@ -47,9 +47,9 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.seclabels %}
|
{% if data.seclabels %}
|
||||||
{% for r in 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 %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ o_data.proargtypenames }})
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.change_func %}
|
{% if data.change_func %}
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.arguments %}
|
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.args %}
|
||||||
{% 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 %}
|
{% 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 %}
|
{% if not loop.last %},{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% 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 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
|
|
||||||
{{ 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.description is defined and data.description != o_data.description%}
|
{% if data.description is defined and data.description != o_data.description%}
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
{% import 'macros/functions/variable.macros' as VARIABLE %}
|
{% import 'macros/functions/variable.macros' as VARIABLE %}
|
||||||
{% set is_columns = [] %}
|
{% set is_columns = [] %}
|
||||||
{% if data %}
|
{% if data %}
|
||||||
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data.arguments %}
|
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data.args %}
|
||||||
{% 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 %}
|
{% 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 %}
|
{% if not loop.last %},{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
@@ -43,9 +43,9 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.seclabels %}
|
{% if data.seclabels %}
|
||||||
{% for r in 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 %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, o_data.name) }}({{o_data.pro
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.change_func %}
|
{% if data.change_func %}
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.arguments %}
|
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.args %}
|
||||||
{% 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 %}
|
{% 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 %}
|
{% if not loop.last %}, {% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% 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 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ 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 -%}
|
{% endfor %}{% endif -%}
|
||||||
{% if data.description is defined and data.description != o_data.description%}
|
{% if data.description is defined and data.description != o_data.description%}
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
{% import 'macros/functions/variable.macros' as VARIABLE %}
|
{% import 'macros/functions/variable.macros' as VARIABLE %}
|
||||||
{% set is_columns = [] %}
|
{% set is_columns = [] %}
|
||||||
{% if data %}
|
{% if data %}
|
||||||
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data.arguments %}
|
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data.args %}
|
||||||
{% 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 %}
|
{% 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 %}
|
{% if not loop.last %},{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
@@ -47,9 +47,9 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.seclabels %}
|
{% if data.seclabels %}
|
||||||
{% for r in 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 %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, o_data.name) }}({{o_data.pro
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.change_func %}
|
{% if data.change_func %}
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.arguments %}
|
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.args %}
|
||||||
{% 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 %}
|
{% 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 %}
|
{% if not loop.last %}, {% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% 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 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
|
|
||||||
{{ 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.description is defined and data.description != o_data.description%}
|
{% if data.description is defined and data.description != o_data.description%}
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
{% set is_columns = [] %}
|
{% set is_columns = [] %}
|
||||||
{% if data %}
|
{% if data %}
|
||||||
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data
|
CREATE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data
|
||||||
.arguments %}
|
.args %}
|
||||||
{% 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 %}
|
{% 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 %}
|
{% if not loop.last %},{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
@@ -47,9 +47,9 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.seclabels %}
|
{% if data.seclabels %}
|
||||||
{% for r in 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 %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ o_data.proargtypenames }})
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.change_func %}
|
{% if data.change_func %}
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.arguments %}
|
CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.args %}
|
||||||
{% 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 %}
|
{% 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 %}
|
{% if not loop.last %},{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% 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 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
|
|
||||||
{{ 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.description is defined and data.description != o_data.description%}
|
{% if data.description is defined and data.description != o_data.description%}
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
{% import 'macros/functions/variable.macros' as VARIABLE %}
|
{% import 'macros/functions/variable.macros' as VARIABLE %}
|
||||||
{% set is_columns = [] %}
|
{% set is_columns = [] %}
|
||||||
{% if data %}
|
{% if data %}
|
||||||
CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.arguments %}(
|
CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.args %}(
|
||||||
{% 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 %}
|
{% 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 %}
|
{% if not loop.last %},{% endif %}
|
||||||
{% endfor %})
|
{% endfor %})
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ ALTER PROCEDURE {{ conn|qtIdent(o_data.pronamespace, o_data.name) }}{% if o_data
|
|||||||
|
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.change_func %}
|
{% 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 %}
|
{% if not loop.last %}, {% endif %}
|
||||||
{% endfor %}
|
{% 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 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
|
|
||||||
{{ 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.description is defined and data.description != o_data.description%}
|
{% if data.description is defined and data.description != o_data.description%}
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
{% import 'macros/functions/variable.macros' as VARIABLE %}
|
{% import 'macros/functions/variable.macros' as VARIABLE %}
|
||||||
{% set is_columns = [] %}
|
{% set is_columns = [] %}
|
||||||
{% if data %}
|
{% if data %}
|
||||||
CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.arguments %}
|
CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.args %}
|
||||||
({% 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 %}
|
({% 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 %}
|
{% if not loop.last %}, {% endif %}
|
||||||
{% endfor -%}){% endif %}
|
{% endfor -%}){% endif %}
|
||||||
|
|
||||||
@@ -22,9 +22,9 @@ COMMENT ON PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.seclabels %}
|
{% if data.seclabels %}
|
||||||
{% for r in 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 %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ ALTER PROCEDURE {{ conn|qtIdent(o_data.pronamespace, o_data.name) }}
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.change_func %}
|
{% 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 %}
|
{% if not loop.last %}, {% endif %}
|
||||||
{% endfor %}
|
{% 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 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
|
|
||||||
{{ 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.description is defined and data.description != o_data.description%}
|
{% if data.description is defined and data.description != o_data.description%}
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
{% import 'macros/functions/variable.macros' as VARIABLE %}
|
{% import 'macros/functions/variable.macros' as VARIABLE %}
|
||||||
{% set is_columns = [] %}
|
{% set is_columns = [] %}
|
||||||
{% if data %}
|
{% if data %}
|
||||||
CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.arguments %}
|
CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.args %}
|
||||||
({% 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 %}
|
({% 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 %}
|
{% if not loop.last %}, {% endif %}
|
||||||
{% endfor -%}){% endif %}
|
{% endfor -%}){% endif %}
|
||||||
|
|
||||||
@@ -33,9 +33,9 @@ COMMENT ON PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.seclabels %}
|
{% if data.seclabels %}
|
||||||
{% for r in 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 %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ ALTER PROCEDURE {{ conn|qtIdent(o_data.pronamespace, o_data.name) }}
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.change_func %}
|
{% 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 %}
|
{% if not loop.last %}, {% endif %}
|
||||||
{% endfor %}
|
{% 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 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
|
|
||||||
{{ 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.description is defined and data.description != o_data.description%}
|
{% if data.description is defined and data.description != o_data.description%}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ define(
|
|||||||
function($, _, S, pgAdmin, pgBrowser, alertify) {
|
function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||||
|
|
||||||
if (!pgBrowser.Nodes['coll-trigger_function']) {
|
if (!pgBrowser.Nodes['coll-trigger_function']) {
|
||||||
var trigger_functions = pgAdmin.Browser.Nodes['coll-trigger_function'] =
|
var trigger_functions = pgBrowser.Nodes['coll-trigger_function'] =
|
||||||
pgAdmin.Browser.Collection.extend({
|
pgBrowser.Collection.extend({
|
||||||
node: 'trigger_function',
|
node: 'trigger_function',
|
||||||
label: '{{ _('Trigger functions') }}',
|
label: '{{ _('Trigger functions') }}',
|
||||||
type: 'coll-trigger_function',
|
type: 'coll-trigger_function',
|
||||||
@@ -16,7 +16,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (!pgBrowser.Nodes['trigger_function']) {
|
if (!pgBrowser.Nodes['trigger_function']) {
|
||||||
pgAdmin.Browser.Nodes['trigger_function'] = pgBrowser.Node.extend({
|
pgBrowser.Nodes['trigger_function'] = pgBrowser.Node.extend({
|
||||||
type: 'trigger_function',
|
type: 'trigger_function',
|
||||||
sqlAlterHelp: 'plpgsql-trigger.html',
|
sqlAlterHelp: 'plpgsql-trigger.html',
|
||||||
sqlCreateHelp: 'plpgsql-trigger.html',
|
sqlCreateHelp: 'plpgsql-trigger.html',
|
||||||
@@ -57,7 +57,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
},
|
},
|
||||||
canDrop: pgBrowser.Nodes['schema'].canChildDrop,
|
canDrop: pgBrowser.Nodes['schema'].canChildDrop,
|
||||||
canDropCascade: pgBrowser.Nodes['schema'].canChildDrop,
|
canDropCascade: pgBrowser.Nodes['schema'].canChildDrop,
|
||||||
model: pgAdmin.Browser.Node.Model.extend({
|
model: pgBrowser.Node.Model.extend({
|
||||||
initialize: function(attrs, args) {
|
initialize: function(attrs, args) {
|
||||||
var isNew = (_.size(attrs) === 0);
|
var isNew = (_.size(attrs) === 0);
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
@@ -69,7 +69,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
||||||
this.set({'funcowner': userInfo.name}, {silent: true});
|
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: {
|
defaults: {
|
||||||
name: undefined,
|
name: undefined,
|
||||||
@@ -91,7 +91,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
procost: undefined, /* Estimated execution Cost */
|
procost: undefined, /* Estimated execution Cost */
|
||||||
prorows: undefined, /* Estimated number of rows */
|
prorows: undefined, /* Estimated number of rows */
|
||||||
proleakproof: undefined,
|
proleakproof: undefined,
|
||||||
arguments: [],
|
args: [],
|
||||||
prosrc: undefined,
|
prosrc: undefined,
|
||||||
prosrc_c: undefined,
|
prosrc_c: undefined,
|
||||||
probin: '$libdir/',
|
probin: '$libdir/',
|
||||||
@@ -194,13 +194,12 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
{'label': 'IMMUTABLE', 'value': 'i'},
|
{'label': 'IMMUTABLE', 'value': 'i'},
|
||||||
], disabled: 'isDisabled', select2: { allowClear: false }
|
], disabled: 'isDisabled', select2: { allowClear: false }
|
||||||
},{
|
},{
|
||||||
id: 'proretset', label: '{{ _('Returns a set?') }}', group: '{{ _('Options') }}',
|
id: 'proretset', label: '{{ _('Returns a set?') }}', type: 'switch',
|
||||||
cell:'boolean', type: 'switch', disabled: 'isDisabled',
|
group: '{{ _('Options') }}', disabled: 'isDisabled',
|
||||||
visible: 'isVisible'
|
visible: 'isVisible'
|
||||||
},{
|
},{
|
||||||
id: 'proisstrict', label: '{{ _('Strict?') }}', group: '{{ _
|
id: 'proisstrict', label: '{{ _('Strict?') }}', type: 'switch',
|
||||||
('Options') }}',
|
disabled: 'isDisabled', group: '{{ _('Options') }}',
|
||||||
cell:'boolean', type: 'switch', disabled: 'isDisabled',
|
|
||||||
options: {
|
options: {
|
||||||
'onText': 'Yes', 'offText': 'No',
|
'onText': 'Yes', 'offText': 'No',
|
||||||
'onColor': 'success', 'offColor': 'primary',
|
'onColor': 'success', 'offColor': 'primary',
|
||||||
@@ -215,46 +214,40 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
group: '{{ _('Options') }}', cell:'boolean', type: 'switch',
|
group: '{{ _('Options') }}', cell:'boolean', type: 'switch',
|
||||||
disabled: 'isDisabled', visible: 'isVisible'
|
disabled: 'isDisabled', visible: 'isVisible'
|
||||||
},{
|
},{
|
||||||
id: 'procost', label: '{{ _('Estimated cost') }}', group: '{{ _('Options') }}',
|
id: 'procost', label: '{{ _('Estimated cost') }}', type: 'text',
|
||||||
cell:'string', type: 'text', disabled: 'isDisabled'
|
group: '{{ _('Options') }}', disabled: 'isDisabled'
|
||||||
},{
|
},{
|
||||||
id: 'prorows', label: '{{ _('Estimated rows') }}', group: '{{ _
|
id: 'prorows', label: '{{ _('Estimated rows') }}', type: 'text',
|
||||||
('Options') }}',
|
group: '{{ _('Options') }}',
|
||||||
cell:'string', type: 'text', disabled: 'isDisabled',
|
disabled: 'isDisabled',
|
||||||
deps: ['proretset'], visible: 'isVisible'
|
deps: ['proretset'], visible: 'isVisible'
|
||||||
},{
|
},{
|
||||||
id: 'proleakproof', label: '{{ _('Leak proof?') }}',
|
id: 'proleakproof', label: '{{ _('Leak proof?') }}',
|
||||||
group: '{{ _('Options') }}', cell:'boolean', type: 'switch', min_version: 90200,
|
group: '{{ _('Options') }}', cell:'boolean', type: 'switch', min_version: 90200,
|
||||||
disabled: 'isDisabled'
|
disabled: 'isDisabled'
|
||||||
},{
|
}, pgBrowser.SecurityGroupUnderSchema, {
|
||||||
id: 'proacl', label: '{{ _('Privileges') }}',
|
id: 'proacl', label: '{{ _('Privileges') }}', mode: ['properties'],
|
||||||
group: '{{ _('Security') }}', cell:'boolean', type: 'text', cell: 'string',
|
group: '{{ _('Security') }}', type: 'text'
|
||||||
mode: ['properties']
|
|
||||||
},{
|
},{
|
||||||
id: 'variables', label: '{{ _('Parameters') }}', type: 'collection',
|
id: 'variables', label: '{{ _('Parameters') }}', type: 'collection',
|
||||||
group: '{{ _('Parameters') }}', control: 'variable-collection',
|
group: '{{ _('Parameters') }}', control: 'variable-collection',
|
||||||
model: pgAdmin.Browser.Node.VariableModel,
|
model: pgBrowser.Node.VariableModel,
|
||||||
mode: ['edit', 'create'], canAdd: 'canVarAdd', canEdit: false,
|
mode: ['edit', 'create'], canAdd: 'canVarAdd', canEdit: false,
|
||||||
canDelete: true, disabled: 'isDisabled'
|
canDelete: true, disabled: 'isDisabled'
|
||||||
},{
|
},{
|
||||||
id: 'acl', label: '{{ _('Privileges') }}', model: pgAdmin
|
id: 'acl', label: '{{ _('Privileges') }}', editable: false,
|
||||||
.Browser.Node.PrivilegeRoleModel.extend(
|
type: 'collection', group: 'security', mode: ['edit', 'create'],
|
||||||
{privileges: ['X']}), uniqueCol : ['grantee', 'grantor'],
|
model: pgBrowser.Node.PrivilegeRoleModel.extend({
|
||||||
editable: false, type: 'collection', group: '{{ _('Security') }}',
|
privileges: ['X']
|
||||||
mode: ['edit', 'create'],
|
}), uniqueCol : ['grantee', 'grantor'], disabled: 'isDisabled',
|
||||||
canAdd: true, canDelete: true, control: 'unique-col-collection',
|
canAdd: true, canDelete: true, control: 'unique-col-collection'
|
||||||
disabled: 'isDisabled'
|
},{
|
||||||
},
|
id: 'seclabels', label: '{{ _('Security Labels') }}', canEdit: true,
|
||||||
{
|
model: pgBrowser.SecLabelModel, type: 'collection',
|
||||||
id: 'seclabels', label: '{{ _('Security Labels') }}',
|
min_version: 90100, group: 'security', mode: ['edit', 'create'],
|
||||||
model: Backform.SecurityModel, type: 'collection',
|
canDelete: true, control: 'unique-col-collection', canAdd: true,
|
||||||
group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
uniqueCol : ['provider'], disabled: 'isDisabled'
|
||||||
min_version: 90100, canAdd: true,
|
}],
|
||||||
canEdit: true, canDelete: true,
|
|
||||||
control: 'unique-col-collection', uniqueCol : ['provider'],
|
|
||||||
disabled: 'isDisabled'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
validate: function(keys)
|
validate: function(keys)
|
||||||
{
|
{
|
||||||
var err = {},
|
var err = {},
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.seclabels %}
|
{% if data.seclabels %}
|
||||||
{% for r in 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 %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% 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 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ 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 -%}
|
{% endfor %}{% endif -%}
|
||||||
{% if data.description is defined and data.description != o_data.description%}
|
{% 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 -%}
|
{% endif -%}
|
||||||
{% if data.seclabels %}
|
{% if data.seclabels %}
|
||||||
{% for r in 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 %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% 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 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
|
|
||||||
{{ 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.description is defined and data.description != o_data.description%}
|
{% if data.description is defined and data.description != o_data.description%}
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.seclabels %}
|
{% if data.seclabels %}
|
||||||
{% for r in 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 %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% 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 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
|
|
||||||
{{ 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.description is defined and data.description != o_data.description%}
|
{% if data.description is defined and data.description != o_data.description%}
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.seclabels %}
|
{% if data.seclabels %}
|
||||||
{% for r in 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 %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% 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 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ 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 -%}
|
{% endfor %}{% endif -%}
|
||||||
{% if data.description is defined and data.description != o_data.description%}
|
{% 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 -%}
|
{% endif -%}
|
||||||
{% if data.seclabels %}
|
{% if data.seclabels %}
|
||||||
{% for r in 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 %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% 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 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
|
|
||||||
{{ 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.description is defined and data.description != o_data.description%}
|
{% if data.description is defined and data.description != o_data.description%}
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.seclabels %}
|
{% if data.seclabels %}
|
||||||
{% for r in 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 %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% 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 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
|
|
||||||
{{ 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 %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if data.description is defined and data.description != o_data.description%}
|
{% if data.description is defined and data.description != o_data.description%}
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ class SequenceView(PGChildNodeView):
|
|||||||
sec = re.search(r'([^=]+)=(.*$)', sec)
|
sec = re.search(r'([^=]+)=(.*$)', sec)
|
||||||
sec_lbls.append({
|
sec_lbls.append({
|
||||||
'provider': sec.group(1),
|
'provider': sec.group(1),
|
||||||
'security_label': sec.group(2)
|
'label': sec.group(2)
|
||||||
})
|
})
|
||||||
res['securities'] = sec_lbls
|
res['securities'] = sec_lbls
|
||||||
|
|
||||||
@@ -599,7 +599,7 @@ class SequenceView(PGChildNodeView):
|
|||||||
seclabels = []
|
seclabels = []
|
||||||
for seclbls in data['securities']:
|
for seclbls in data['securities']:
|
||||||
k, v = seclbls.split('=')
|
k, v = seclbls.split('=')
|
||||||
seclabels.append({'provider': k, 'security_label': v})
|
seclabels.append({'provider': k, 'label': v})
|
||||||
|
|
||||||
data['securities'] = seclabels
|
data['securities'] = seclabels
|
||||||
|
|
||||||
|
|||||||
@@ -2,44 +2,10 @@ define(
|
|||||||
['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'],
|
['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'],
|
||||||
function($, _, S, pgAdmin, pgBrowser, alertify) {
|
function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||||
|
|
||||||
// Extend the browser's node model class to create a security model
|
|
||||||
var 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
|
// Extend the browser's collection class for sequence collection
|
||||||
if (!pgBrowser.Nodes['coll-sequence']) {
|
if (!pgBrowser.Nodes['coll-sequence']) {
|
||||||
var databases = pgAdmin.Browser.Nodes['coll-sequence'] =
|
var databases = pgBrowser.Nodes['coll-sequence'] =
|
||||||
pgAdmin.Browser.Collection.extend({
|
pgBrowser.Collection.extend({
|
||||||
node: 'sequence',
|
node: 'sequence',
|
||||||
label: '{{ _('Sequences') }}',
|
label: '{{ _('Sequences') }}',
|
||||||
type: 'coll-sequence',
|
type: 'coll-sequence',
|
||||||
@@ -49,7 +15,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
|
|
||||||
// Extend the browser's node class for sequence node
|
// Extend the browser's node class for sequence node
|
||||||
if (!pgBrowser.Nodes['sequence']) {
|
if (!pgBrowser.Nodes['sequence']) {
|
||||||
pgAdmin.Browser.Nodes['sequence'] = pgBrowser.Node.extend({
|
pgBrowser.Nodes['sequence'] = pgBrowser.Node.extend({
|
||||||
type: 'sequence',
|
type: 'sequence',
|
||||||
sqlAlterHelp: 'sql-altersequence.html',
|
sqlAlterHelp: 'sql-altersequence.html',
|
||||||
sqlCreateHelp: 'sql-createsequence.html',
|
sqlCreateHelp: 'sql-createsequence.html',
|
||||||
@@ -58,7 +24,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
collection_type: 'coll-sequence',
|
collection_type: 'coll-sequence',
|
||||||
hasSQL: true,
|
hasSQL: true,
|
||||||
hasDepends: true,
|
hasDepends: true,
|
||||||
parent_type: ['schema'],
|
parent_type: ['schema', 'catalog'],
|
||||||
Init: function() {
|
Init: function() {
|
||||||
/* Avoid mulitple registration of menus */
|
/* Avoid mulitple registration of menus */
|
||||||
if (this.initialized)
|
if (this.initialized)
|
||||||
@@ -119,7 +85,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
// Define the model for sequence node.
|
// Define the model for sequence node.
|
||||||
model: pgAdmin.Browser.Node.Model.extend({
|
model: pgBrowser.Node.Model.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
name: undefined,
|
name: undefined,
|
||||||
oid: undefined,
|
oid: undefined,
|
||||||
@@ -136,7 +102,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
relacl: [],
|
relacl: [],
|
||||||
securities: []
|
securities: []
|
||||||
},
|
},
|
||||||
|
|
||||||
// Default values!
|
// Default values!
|
||||||
initialize: function(attrs, args) {
|
initialize: function(attrs, args) {
|
||||||
var isNew = (_.size(attrs) === 0);
|
var isNew = (_.size(attrs) === 0);
|
||||||
@@ -148,9 +114,9 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
this.set({'seqowner': userInfo.name}, {silent: true});
|
this.set({'seqowner': userInfo.name}, {silent: true});
|
||||||
this.set({'schema': schemaInfo.label}, {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.
|
// Define the schema for sequence node.
|
||||||
schema: [{
|
schema: [{
|
||||||
id: 'name', label: '{{ _('Name') }}', cell: 'string',
|
id: 'name', label: '{{ _('Name') }}', cell: 'string',
|
||||||
@@ -202,21 +168,23 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
'onColor': 'success', 'offColor': 'primary',
|
'onColor': 'success', 'offColor': 'primary',
|
||||||
'size': 'small'
|
'size': 'small'
|
||||||
}
|
}
|
||||||
},{
|
}, pgBrowser.SecurityGroupUnderSchema,{
|
||||||
id: 'acl', label: '{{ _('Privileges') }}', type: 'text',
|
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(
|
id: 'relacl', label: '{{ _('Privileges') }}', group: 'security',
|
||||||
{privileges: ['r', 'w', 'U']}), uniqueCol : ['grantee', 'grantor'],
|
model: pgBrowser.Node.PrivilegeRoleModel.extend({
|
||||||
editable: false, type: 'collection', group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
privileges: ['r', 'w', 'U']
|
||||||
canAdd: true, canDelete: true, control: 'unique-col-collection',
|
}), 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,
|
id: 'securities', label: '{{ _('Securitiy Labels') }}', canAdd: true,
|
||||||
editable: false, type: 'collection', canEdit: false,
|
model: pgBrowser.SecLabelModel, editable: false,
|
||||||
group: '{{ _('Security') }}', canDelete: true,
|
type: 'collection', canEdit: false, group: 'security',
|
||||||
mode: ['edit', 'create'], canAdd: true,
|
mode: ['edit', 'create'], canDelete: true,
|
||||||
control: 'unique-col-collection', uniqueCol : ['provider'],
|
control: 'unique-col-collection',
|
||||||
min_version: 90200
|
min_version: 90200, uniqueCol : ['provider']
|
||||||
}],
|
}],
|
||||||
/* validate function is used to validate the input given by
|
/* validate function is used to validate the input given by
|
||||||
* the user. In case of error, message will be displayed on
|
* the user. In case of error, message will be displayed on
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ COMMENT ON SEQUENCE {{ seqname }}
|
|||||||
{% if data.securities %}
|
{% if data.securities %}
|
||||||
|
|
||||||
{% for r in data.securities %}
|
{% for r in data.securities %}
|
||||||
{{ SECLABLE.SET(conn, 'SEQUENCE', data.name, r.provider, r.security_label, data.schema) }}
|
{{ SECLABLE.SET(conn, 'SEQUENCE', data.name, r.provider, r.label, data.schema) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if data.relacl %}
|
{% if data.relacl %}
|
||||||
@@ -23,4 +23,4 @@ COMMENT ON SEQUENCE {{ seqname }}
|
|||||||
{% for priv in data.relacl %}
|
{% for priv in data.relacl %}
|
||||||
{{ PRIVILEGE.SET(conn, 'SEQUENCE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}
|
{{ PRIVILEGE.SET(conn, 'SEQUENCE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ ALTER SEQUENCE {{ conn|qtIdent(o_data.schema, data.name) }} {{ defquery }};
|
|||||||
{% if data.schema and data.schema != o_data.schema %}
|
{% if data.schema and data.schema != o_data.schema %}
|
||||||
ALTER SEQUENCE {{ conn|qtIdent(o_data.schema, data.name) }}
|
ALTER SEQUENCE {{ conn|qtIdent(o_data.schema, data.name) }}
|
||||||
SET SCHEMA {{ conn|qtIdent(data.schema) }};
|
SET SCHEMA {{ conn|qtIdent(data.schema) }};
|
||||||
|
|
||||||
{% set seqname = conn|qtIdent(data.schema, data.name) %}
|
{% set seqname = conn|qtIdent(data.schema, data.name) %}
|
||||||
{% set schema = data.schema %}
|
{% set schema = data.schema %}
|
||||||
{% else %}
|
{% else %}
|
||||||
@@ -51,7 +51,7 @@ ALTER SEQUENCE {{ conn|qtIdent(o_data.schema, data.name) }}
|
|||||||
{% if data.comment is defined and data.comment != o_data.comment %}
|
{% if data.comment is defined and data.comment != o_data.comment %}
|
||||||
COMMENT ON SEQUENCE {{ seqname }}
|
COMMENT ON SEQUENCE {{ seqname }}
|
||||||
IS {{ data.comment|qtLiteral }};
|
IS {{ data.comment|qtLiteral }};
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if data.securities and data.securities|length > 0 %}
|
{% if data.securities and data.securities|length > 0 %}
|
||||||
|
|
||||||
@@ -63,12 +63,12 @@ COMMENT ON SEQUENCE {{ seqname }}
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABLE.SET(conn, 'SEQUENCE', data.name, r.provider, r.security_label, schema) }}
|
{{ SECLABLE.SET(conn, 'SEQUENCE', data.name, r.provider, r.label, schema) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABLE.SET(conn, 'SEQUENCE', data.name, r.provider, r.security_label, schema) }}
|
{{ SECLABLE.SET(conn, 'SEQUENCE', data.name, r.provider, r.label, schema) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -91,4 +91,4 @@ COMMENT ON SEQUENCE {{ seqname }}
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ define(
|
|||||||
function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||||
|
|
||||||
if (!pgBrowser.Nodes['coll-column']) {
|
if (!pgBrowser.Nodes['coll-column']) {
|
||||||
var databases = pgAdmin.Browser.Nodes['coll-column'] =
|
var databases = pgBrowser.Nodes['coll-column'] =
|
||||||
pgAdmin.Browser.Collection.extend({
|
pgBrowser.Collection.extend({
|
||||||
node: 'column',
|
node: 'column',
|
||||||
label: '{{ _('Columns') }}',
|
label: '{{ _('Columns') }}',
|
||||||
type: 'coll-column',
|
type: 'coll-column',
|
||||||
@@ -14,7 +14,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// This Node model will be used for variable control for column
|
// 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: {
|
defaults: {
|
||||||
name: null,
|
name: null,
|
||||||
value: null
|
value: null
|
||||||
@@ -49,7 +49,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!pgBrowser.Nodes['column']) {
|
if (!pgBrowser.Nodes['column']) {
|
||||||
pgAdmin.Browser.Nodes['column'] = pgAdmin.Browser.Node.extend({
|
pgBrowser.Nodes['column'] = pgBrowser.Node.extend({
|
||||||
parent_type: ['table', 'view', 'mview'],
|
parent_type: ['table', 'view', 'mview'],
|
||||||
collection_type: ['coll-table', 'coll-view', 'coll-mview'],
|
collection_type: ['coll-table', 'coll-view', 'coll-mview'],
|
||||||
type: 'column',
|
type: 'column',
|
||||||
@@ -115,7 +115,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
|||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
model: pgAdmin.Browser.Node.Model.extend({
|
model: pgBrowser.Node.Model.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
name: undefined,
|
name: undefined,
|
||||||
attowner: undefined,
|
attowner: undefined,
|
||||||
@@ -190,7 +190,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
|||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
id: 'attnum', label:'{{ _('Position') }}', cell: 'string',
|
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',
|
id: 'cltype', label:'{{ _('Data type') }}', cell: 'node-ajax-options',
|
||||||
type: 'text', disabled: 'inSchemaWithColumnCheck',
|
type: 'text', disabled: 'inSchemaWithColumnCheck',
|
||||||
@@ -379,29 +379,27 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
|||||||
},{
|
},{
|
||||||
id: 'description', label:'{{ _('Comment') }}', cell: 'string',
|
id: 'description', label:'{{ _('Comment') }}', cell: 'string',
|
||||||
type: 'multiline', mode: ['properties', 'create', 'edit'],
|
type: 'multiline', mode: ['properties', 'create', 'edit'],
|
||||||
disabled: 'inSchema'
|
disabled: 'notInSchema'
|
||||||
},{
|
},{
|
||||||
id: 'attoptions', label: 'Variables', type: 'collection',
|
id: 'attoptions', label: 'Variables', type: 'collection',
|
||||||
group: '{{ _('Variables') }}', control: 'unique-col-collection',
|
group: '{{ _('Variables') }}', control: 'unique-col-collection',
|
||||||
model: VariablesModel, uniqueCol : ['name'],
|
model: VariablesModel, uniqueCol : ['name'],
|
||||||
mode: ['edit', 'create'], canAdd: true, canEdit: false,
|
mode: ['edit', 'create'], canAdd: true, canEdit: false,
|
||||||
canDelete: true
|
canDelete: true
|
||||||
},{
|
}, pgBrowser.SecurityGroupUnderSchema, {
|
||||||
id: 'attacl', label: 'Privileges', type: 'collection',
|
id: 'attacl', label: 'Privileges', type: 'collection',
|
||||||
group: '{{ _('Security') }}', control: 'unique-col-collection',
|
group: 'security', control: 'unique-col-collection',
|
||||||
model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend({
|
model: pgBrowser.Node.PrivilegeRoleModel.extend({
|
||||||
privileges: ['a','r','w','x']}),
|
privileges: ['a','r','w','x']}),
|
||||||
mode: ['edit'], canAdd: true, canDelete: true,
|
mode: ['edit'], canAdd: true, canDelete: true,
|
||||||
uniqueCol : ['grantee']
|
uniqueCol : ['grantee']
|
||||||
},{
|
},{
|
||||||
id: 'seclabels', label: '{{ _('Security Labels') }}',
|
id: 'seclabels', label: '{{ _('Security Labels') }}', canAdd: true,
|
||||||
model: pgAdmin.Browser.SecurityModel,
|
model: pgBrowser.SecLabelModel, group: 'security',
|
||||||
editable: false, type: 'collection',
|
mode: ['edit', 'create'], editable: false, type: 'collection',
|
||||||
group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
min_version: 90100, canEdit: false, canDelete: true,
|
||||||
min_version: 90100, canAdd: true,
|
control: 'unique-col-collection'
|
||||||
canEdit: false, canDelete: true, control: 'unique-col-collection'
|
}],
|
||||||
}
|
|
||||||
],
|
|
||||||
validate: function(keys) {
|
validate: function(keys) {
|
||||||
var err = {},
|
var err = {},
|
||||||
changedAttrs = this.changed,
|
changedAttrs = this.changed,
|
||||||
@@ -463,10 +461,8 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
isInhertedColumn: function() {
|
|
||||||
},
|
|
||||||
// We will check if we are under schema node & in 'create' mode
|
// 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)
|
if(this.node_info && 'catalog' in this.node_info)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@@ -564,8 +560,8 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return pgBrowser.Nodes['column'];
|
return pgBrowser.Nodes['column'];
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ define(
|
|||||||
function($, _, S, pgAdmin, pgBrowser, alertify) {
|
function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||||
|
|
||||||
if (!pgBrowser.Nodes['coll-table']) {
|
if (!pgBrowser.Nodes['coll-table']) {
|
||||||
var databases = pgAdmin.Browser.Nodes['coll-table'] =
|
var databases = pgBrowser.Nodes['coll-table'] =
|
||||||
pgAdmin.Browser.Collection.extend({
|
pgBrowser.Collection.extend({
|
||||||
node: 'table',
|
node: 'table',
|
||||||
label: '{{ _('Tables') }}',
|
label: '{{ _('Tables') }}',
|
||||||
type: 'coll-table',
|
type: 'coll-table',
|
||||||
@@ -17,7 +17,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (!pgBrowser.Nodes['table']) {
|
if (!pgBrowser.Nodes['table']) {
|
||||||
pgAdmin.Browser.Nodes['table'] = pgBrowser.Node.extend({
|
pgBrowser.Nodes['table'] = pgBrowser.Node.extend({
|
||||||
type: 'table',
|
type: 'table',
|
||||||
label: '{{ _('Table') }}',
|
label: '{{ _('Table') }}',
|
||||||
collection_type: 'coll-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: {
|
defaults: {
|
||||||
name: undefined,
|
name: undefined,
|
||||||
oid: undefined,
|
oid: undefined,
|
||||||
@@ -270,7 +270,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
toast_autovacuum_enabled: false,
|
toast_autovacuum_enabled: false,
|
||||||
autovacuum_enabled: false,
|
autovacuum_enabled: false,
|
||||||
primary_key: []
|
primary_key: []
|
||||||
},
|
},
|
||||||
// Default values!
|
// Default values!
|
||||||
initialize: function(attrs, args) {
|
initialize: function(attrs, args) {
|
||||||
var self = this,
|
var self = this,
|
||||||
@@ -283,7 +283,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
this.set({'relowner': userInfo.name}, {silent: true});
|
this.set({'relowner': userInfo.name}, {silent: true});
|
||||||
this.set({'schema': schemaInfo.label}, {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: [{
|
schema: [{
|
||||||
@@ -337,40 +337,40 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
control: Backform.NodeAjaxOptionsControl.extend({
|
control: Backform.NodeAjaxOptionsControl.extend({
|
||||||
// When of_types changes we need to clear columns collection
|
// When of_types changes we need to clear columns collection
|
||||||
onChange: function() {
|
onChange: function() {
|
||||||
Backform.NodeAjaxOptionsControl.prototype.onChange.apply(this, arguments);
|
Backform.NodeAjaxOptionsControl.prototype.onChange.apply(this, arguments);
|
||||||
var self = this,
|
var self = this,
|
||||||
tbl_oid = undefined,
|
tbl_oid = undefined,
|
||||||
tbl_name = self.model.get('typname'),
|
tbl_name = self.model.get('typname'),
|
||||||
data = undefined,
|
data = undefined,
|
||||||
arg = undefined,
|
arg = undefined,
|
||||||
column_collection = self.model.get('columns');
|
column_collection = self.model.get('columns');
|
||||||
|
|
||||||
if (!_.isUndefined(tbl_name) &&
|
if (!_.isUndefined(tbl_name) &&
|
||||||
tbl_name !== '' && column_collection.length !== 0) {
|
tbl_name !== '' && column_collection.length !== 0) {
|
||||||
var msg = '{{ _('Changing of type table will clear columns collection') }}';
|
var msg = '{{ _('Changing of type table will clear columns collection') }}';
|
||||||
alertify.confirm(msg, function (e) {
|
alertify.confirm(msg, function (e) {
|
||||||
if (e) {
|
if (e) {
|
||||||
// User clicks Ok, lets clear columns collection
|
// User clicks Ok, lets clear columns collection
|
||||||
column_collection.reset();
|
column_collection.reset();
|
||||||
} else {
|
} else {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (!_.isUndefined(tbl_name) && tbl_name === '') {
|
} else if (!_.isUndefined(tbl_name) && tbl_name === '') {
|
||||||
column_collection.reset();
|
column_collection.reset();
|
||||||
}
|
|
||||||
|
|
||||||
// Run Ajax now to fetch columns
|
|
||||||
if (!_.isUndefined(tbl_name) && tbl_name !== '') {
|
|
||||||
arg = { 'tname': tbl_name }
|
|
||||||
data = self.model.fetch_columns_ajax.apply(self, [arg]);
|
|
||||||
// Add into column collection
|
|
||||||
column_collection.set(data, { merge:false,remove:false });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
|
||||||
|
// Run Ajax now to fetch columns
|
||||||
|
if (!_.isUndefined(tbl_name) && tbl_name !== '') {
|
||||||
|
arg = { 'tname': tbl_name }
|
||||||
|
data = self.model.fetch_columns_ajax.apply(self, [arg]);
|
||||||
|
// Add into column collection
|
||||||
|
column_collection.set(data, { merge:false,remove:false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
},{
|
},{
|
||||||
id: 'fillfactor', label:'{{ _('Fill factor') }}', cell: 'integer',
|
id: 'fillfactor', label:'{{ _('Fill factor') }}', cell: 'integer',
|
||||||
type: 'int', mode: ['create', 'edit'], min: 10, max: 100,
|
type: 'int', mode: ['create', 'edit'], min: 10, max: 100,
|
||||||
@@ -418,78 +418,78 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
control: Backform.MultiSelectAjaxControl.extend({
|
control: Backform.MultiSelectAjaxControl.extend({
|
||||||
// When changes we need to add/clear columns collection
|
// When changes we need to add/clear columns collection
|
||||||
onChange: function() {
|
onChange: function() {
|
||||||
Backform.MultiSelectAjaxControl.prototype.onChange.apply(this, arguments);
|
Backform.MultiSelectAjaxControl.prototype.onChange.apply(this, arguments);
|
||||||
var self = this,
|
var self = this,
|
||||||
// current table list and previous table list
|
// current table list and previous table list
|
||||||
cTbl_list = self.model.get('coll_inherits') || [],
|
cTbl_list = self.model.get('coll_inherits') || [],
|
||||||
pTbl_list = self.model.previous('coll_inherits') || [];
|
pTbl_list = self.model.previous('coll_inherits') || [];
|
||||||
|
|
||||||
if (!_.isUndefined(cTbl_list)) {
|
if (!_.isUndefined(cTbl_list)) {
|
||||||
var tbl_name = undefined,
|
var tbl_name = undefined,
|
||||||
tid = undefined;
|
tid = undefined;
|
||||||
|
|
||||||
// Add columns logic
|
|
||||||
// If new table is added in list
|
|
||||||
if(cTbl_list.length > 1 && cTbl_list.length > pTbl_list.length) {
|
|
||||||
// Find newly added table from current list
|
|
||||||
tbl_name = _.difference(cTbl_list, pTbl_list);
|
|
||||||
tid = this.get_table_oid(tbl_name[0]);
|
|
||||||
this.add_columns(tid);
|
|
||||||
} else if (cTbl_list.length == 1) {
|
|
||||||
// First table added
|
|
||||||
tid = this.get_table_oid(cTbl_list[0]);
|
|
||||||
this.add_columns(tid);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove columns logic
|
|
||||||
if(cTbl_list.length > 0 && cTbl_list.length < pTbl_list.length) {
|
|
||||||
// Find deleted table from previous list
|
|
||||||
tbl_name = _.difference(pTbl_list, cTbl_list);
|
|
||||||
this.remove_columns(tbl_name[0]);
|
|
||||||
} else if (pTbl_list.length === 1 && cTbl_list.length < 1) {
|
|
||||||
// We got last table from list
|
|
||||||
tbl_name = pTbl_list[0];
|
|
||||||
this.remove_columns(tbl_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Add columns logic
|
||||||
|
// If new table is added in list
|
||||||
|
if(cTbl_list.length > 1 && cTbl_list.length > pTbl_list.length) {
|
||||||
|
// Find newly added table from current list
|
||||||
|
tbl_name = _.difference(cTbl_list, pTbl_list);
|
||||||
|
tid = this.get_table_oid(tbl_name[0]);
|
||||||
|
this.add_columns(tid);
|
||||||
|
} else if (cTbl_list.length == 1) {
|
||||||
|
// First table added
|
||||||
|
tid = this.get_table_oid(cTbl_list[0]);
|
||||||
|
this.add_columns(tid);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
add_columns: function(tid) {
|
|
||||||
// Create copy of old model if anything goes wrong at-least we have backup
|
|
||||||
// Then send AJAX request to fetch table specific columns
|
|
||||||
var self = this,
|
|
||||||
url = 'get_columns',
|
|
||||||
m = self.model.top || self.model,
|
|
||||||
data = undefined,
|
|
||||||
old_columns = _.clone(m.get('columns')),
|
|
||||||
column_collection = m.get('columns');
|
|
||||||
|
|
||||||
var arg = {'tid': tid}
|
// Remove columns logic
|
||||||
data = self.model.fetch_columns_ajax.apply(self, [arg]);
|
if(cTbl_list.length > 0 && cTbl_list.length < pTbl_list.length) {
|
||||||
|
// Find deleted table from previous list
|
||||||
|
tbl_name = _.difference(pTbl_list, cTbl_list);
|
||||||
|
this.remove_columns(tbl_name[0]);
|
||||||
|
} else if (pTbl_list.length === 1 && cTbl_list.length < 1) {
|
||||||
|
// We got last table from list
|
||||||
|
tbl_name = pTbl_list[0];
|
||||||
|
this.remove_columns(tbl_name);
|
||||||
|
}
|
||||||
|
|
||||||
// Update existing column collection
|
|
||||||
column_collection.set(data, { merge:false,remove:false });
|
|
||||||
},
|
|
||||||
remove_columns: function(tblname) {
|
|
||||||
// Remove all the column models for deleted table
|
|
||||||
var tid = this.get_table_oid(tblname),
|
|
||||||
column_collection = this.model.get('columns');
|
|
||||||
column_collection.remove(column_collection.where({'inheritedid': tid }));
|
|
||||||
},
|
|
||||||
get_table_oid: function(tblname) {
|
|
||||||
// Here we will fetch the table oid from table name
|
|
||||||
var tbl_oid = undefined;
|
|
||||||
// iterate over list to find table oid
|
|
||||||
_.each(this.model.inherited_tables_list, function(obj) {
|
|
||||||
if(obj.label === tblname) {
|
|
||||||
tbl_oid = obj.tid;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return tbl_oid;
|
|
||||||
}
|
}
|
||||||
})
|
},
|
||||||
|
add_columns: function(tid) {
|
||||||
|
// Create copy of old model if anything goes wrong at-least we have backup
|
||||||
|
// Then send AJAX request to fetch table specific columns
|
||||||
|
var self = this,
|
||||||
|
url = 'get_columns',
|
||||||
|
m = self.model.top || self.model,
|
||||||
|
data = undefined,
|
||||||
|
old_columns = _.clone(m.get('columns')),
|
||||||
|
column_collection = m.get('columns');
|
||||||
|
|
||||||
|
var arg = {'tid': tid}
|
||||||
|
data = self.model.fetch_columns_ajax.apply(self, [arg]);
|
||||||
|
|
||||||
|
// Update existing column collection
|
||||||
|
column_collection.set(data, { merge:false,remove:false });
|
||||||
|
},
|
||||||
|
remove_columns: function(tblname) {
|
||||||
|
// Remove all the column models for deleted table
|
||||||
|
var tid = this.get_table_oid(tblname),
|
||||||
|
column_collection = this.model.get('columns');
|
||||||
|
column_collection.remove(column_collection.where({'inheritedid': tid }));
|
||||||
|
},
|
||||||
|
get_table_oid: function(tblname) {
|
||||||
|
// Here we will fetch the table oid from table name
|
||||||
|
var tbl_oid = undefined;
|
||||||
|
// iterate over list to find table oid
|
||||||
|
_.each(this.model.inherited_tables_list, function(obj) {
|
||||||
|
if(obj.label === tblname) {
|
||||||
|
tbl_oid = obj.tid;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return tbl_oid;
|
||||||
|
}
|
||||||
|
})
|
||||||
},{
|
},{
|
||||||
id: 'coll_inherits', label: '{{ _('Inherited from table(s)') }}',
|
id: 'coll_inherits', label: '{{ _('Inherited from table(s)') }}',
|
||||||
url: 'get_inherits', type: 'text', group: '{{ _('Advanced') }}',
|
url: 'get_inherits', type: 'text', group: '{{ _('Advanced') }}',
|
||||||
@@ -500,7 +500,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
type: 'text', mode: ['properties'], group: '{{ _('Advanced') }}',
|
type: 'text', mode: ['properties'], group: '{{ _('Advanced') }}',
|
||||||
disabled: 'inSchema'
|
disabled: 'inSchema'
|
||||||
},{
|
},{
|
||||||
// Here we will create tab control for columns
|
// Tab control for columns
|
||||||
id: 'columns', label:'{{ _('Columns') }}', type: 'collection',
|
id: 'columns', label:'{{ _('Columns') }}', type: 'collection',
|
||||||
group: '{{ _('Columns') }}',
|
group: '{{ _('Columns') }}',
|
||||||
model: pgBrowser.Nodes['column'].model,
|
model: pgBrowser.Nodes['column'].model,
|
||||||
@@ -676,7 +676,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
var columns = m.get('columns');
|
var columns = m.get('columns');
|
||||||
return _.some(columns.pluck('name'));
|
return _.some(columns.pluck('name'));
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
},{
|
},{
|
||||||
type: 'nested', control: 'fieldset', label: '{{ _('Like') }}',
|
type: 'nested', control: 'fieldset', label: '{{ _('Like') }}',
|
||||||
group: '{{ _('Advanced') }}',
|
group: '{{ _('Advanced') }}',
|
||||||
@@ -715,24 +715,22 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
id: 'relacl_str', label:'{{ _('Privileges') }}', cell: 'string',
|
id: 'relacl_str', label:'{{ _('Privileges') }}', cell: 'string',
|
||||||
type: 'text', mode: ['properties'], group: '{{ _('Security') }}',
|
type: 'text', mode: ['properties'], group: '{{ _('Security') }}',
|
||||||
disabled: 'inSchema'
|
disabled: 'inSchema'
|
||||||
},{
|
}, pgBrowser.SecurityGroupUnderSchema,{
|
||||||
id: 'relacl', label: 'Privileges', type: 'collection',
|
id: 'relacl', label: '{{ _('Privileges') }}', type: 'collection',
|
||||||
group: '{{ _('Security') }}', control: 'unique-col-collection',
|
group: 'security', control: 'unique-col-collection',
|
||||||
model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend({
|
model: pgBrowser.Node.PrivilegeRoleModel.extend({
|
||||||
privileges: ['a','r','w','d','D','x','t']}),
|
privileges: ['a','r','w','d','D','x','t']}),
|
||||||
mode: ['edit', 'create'], canAdd: true, canDelete: true,
|
mode: ['edit', 'create'], canAdd: true, canDelete: true,
|
||||||
uniqueCol : ['grantee']
|
uniqueCol : ['grantee']
|
||||||
},{
|
},{
|
||||||
id: 'seclabels', label: '{{ _('Security labels') }}',
|
id: 'seclabels', label: '{{ _('Security labels') }}', canEdit: false,
|
||||||
model: pgAdmin.Browser.SecurityModel, editable: false, type: 'collection',
|
model: pgBrowser.SecLabelModel, editable: false, canAdd: true,
|
||||||
group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
type: 'collection', min_version: 90100, mode: ['edit', 'create'],
|
||||||
min_version: 90100, canAdd: true,
|
group: 'security', canDelete: true, control: 'unique-col-collection'
|
||||||
canEdit: false, canDelete: true, control: 'unique-col-collection'
|
|
||||||
},{
|
},{
|
||||||
id: 'vacuum_settings_str', label: '{{ _('Storage settings') }}',
|
id: 'vacuum_settings_str', label: '{{ _('Storage settings') }}',
|
||||||
type: 'multiline', group: '{{ _('Advanced') }}', mode: ['properties']
|
type: 'multiline', group: '{{ _('Advanced') }}', mode: ['properties']
|
||||||
}
|
}],
|
||||||
],
|
|
||||||
validate: function(keys) {
|
validate: function(keys) {
|
||||||
var err = {},
|
var err = {},
|
||||||
changedAttrs = this.changed,
|
changedAttrs = this.changed,
|
||||||
@@ -777,25 +775,24 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
isInheritedTable: function(m) {
|
isInheritedTable: function(m) {
|
||||||
if(!m.inSchema.apply(this, [m])) {
|
if(!m.inSchema.apply(this, [m])) {
|
||||||
if(
|
if(
|
||||||
(!_.isUndefined(m.get('coll_inherits')) && m.get('coll_inherits').length != 0)
|
(!_.isUndefined(m.get('coll_inherits')) && m.get('coll_inherits').length != 0)
|
||||||
||
|
||
|
||||||
(!_.isUndefined(m.get('typname')) && String(m.get('typname')).replace(/^\s+|\s+$/g, '') !== '')
|
(!_.isUndefined(m.get('typname')) && String(m.get('typname')).replace(/^\s+|\s+$/g, '') !== '')
|
||||||
) {
|
) {
|
||||||
// Either of_types or coll_inherits has value
|
// Either of_types or coll_inherits has value
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
// We will disable it if Oftype is defined
|
// Oftype is defined?
|
||||||
checkInheritance: function(m) {
|
checkInheritance: function(m) {
|
||||||
//coll_inherits || typname
|
// coll_inherits || typname
|
||||||
if(!m.inSchema.apply(this, [m]) &&
|
if(!m.inSchema.apply(this, [m]) &&
|
||||||
( _.isUndefined(m.get('typname')) ||
|
( _.isUndefined(m.get('typname')) ||
|
||||||
_.isNull(m.get('typname')) ||
|
_.isNull(m.get('typname')) ||
|
||||||
@@ -868,42 +865,40 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
fetch_columns_ajax: function(arg) {
|
fetch_columns_ajax: function(arg) {
|
||||||
var self = this,
|
var self = this,
|
||||||
url = 'get_columns',
|
url = 'get_columns',
|
||||||
m = self.model.top || self.model,
|
m = self.model.top || self.model,
|
||||||
old_columns = _.clone(m.get('columns'))
|
old_columns = _.clone(m.get('columns'))
|
||||||
data = undefined;
|
data = undefined,
|
||||||
|
node = this.field.get('schema_node'),
|
||||||
if (url) {
|
|
||||||
var node = this.field.get('schema_node'),
|
|
||||||
node_info = this.field.get('node_info'),
|
node_info = this.field.get('node_info'),
|
||||||
full_url = node.generate_url.apply(
|
full_url = node.generate_url.apply(
|
||||||
node, [
|
node, [
|
||||||
null, url, this.field.get('node_data'),
|
null, url, this.field.get('node_data'),
|
||||||
this.field.get('url_with_id') || false, node_info
|
this.field.get('url_with_id') || false, node_info
|
||||||
]),
|
]
|
||||||
|
),
|
||||||
cache_level = this.field.get('cache_level') || node.type,
|
cache_level = this.field.get('cache_level') || node.type,
|
||||||
cache_node = this.field.get('cache_node');
|
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);
|
m.trigger('pgadmin:view:fetching', m, self.field);
|
||||||
// Fetching Columns data for the selected table.
|
// Fetching Columns data for the selected table.
|
||||||
$.ajax({
|
$.ajax({
|
||||||
async: false,
|
async: false,
|
||||||
url: full_url,
|
url: full_url,
|
||||||
data: arg,
|
data: arg,
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
data = cache_node.cache(url, node_info, cache_level, res.data);
|
data = cache_node.cache(url, node_info, cache_level, res.data);
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
m.trigger('pgadmin:view:fetch:error', m, self.field);
|
m.trigger('pgadmin:view:fetch:error', m, self.field);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
m.trigger('pgadmin:view:fetched', m, self.field);
|
m.trigger('pgadmin:view:fetched', m, self.field);
|
||||||
data = (data && data.data) || [];
|
data = (data && data.data) || [];
|
||||||
return data;
|
return data;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
canCreate: function(itemData, item, data) {
|
canCreate: function(itemData, item, data) {
|
||||||
@@ -956,8 +951,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return pgBrowser.Nodes['table'];
|
return pgBrowser.Nodes['table'];
|
||||||
|
|||||||
@@ -2,42 +2,11 @@
|
|||||||
['jquery', 'underscore', 'underscore.string', 'pgadmin',
|
['jquery', 'underscore', 'underscore.string', 'pgadmin',
|
||||||
'pgadmin.browser', 'backform', 'alertify', 'pgadmin.browser.collection'],
|
'pgadmin.browser', 'backform', 'alertify', 'pgadmin.browser.collection'],
|
||||||
function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
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
|
// Extend the browser's collection class for catalog collection
|
||||||
if (!pgBrowser.Nodes['coll-catalog']) {
|
if (!pgBrowser.Nodes['coll-catalog']) {
|
||||||
var databases = pgAdmin.Browser.Nodes['coll-catalog'] =
|
var databases = pgBrowser.Nodes['coll-catalog'] =
|
||||||
pgAdmin.Browser.Collection.extend({
|
pgBrowser.Collection.extend({
|
||||||
node: 'catalog',
|
node: 'catalog',
|
||||||
label: '{{ _('Catalogs') }}',
|
label: '{{ _('Catalogs') }}',
|
||||||
type: 'coll-catalog',
|
type: 'coll-catalog',
|
||||||
@@ -46,7 +15,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
|||||||
};
|
};
|
||||||
// Extend the browser's node class for catalog node
|
// Extend the browser's node class for catalog node
|
||||||
if (!pgBrowser.Nodes['catalog']) {
|
if (!pgBrowser.Nodes['catalog']) {
|
||||||
pgAdmin.Browser.Nodes['catalog'] = pgAdmin.Browser.Node.extend({
|
pgBrowser.Nodes['catalog'] = pgBrowser.Node.extend({
|
||||||
parent_type: 'database',
|
parent_type: 'database',
|
||||||
type: 'catalog',
|
type: 'catalog',
|
||||||
label: '{{ _('Catalog') }}',
|
label: '{{ _('Catalog') }}',
|
||||||
@@ -60,7 +29,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
|||||||
this.initialized = true;
|
this.initialized = true;
|
||||||
|
|
||||||
},
|
},
|
||||||
model: pgAdmin.Browser.Node.Model.extend({
|
model: pgBrowser.Node.Model.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
name: undefined,
|
name: undefined,
|
||||||
namespaceowner: undefined,
|
namespaceowner: undefined,
|
||||||
@@ -76,7 +45,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
|||||||
|
|
||||||
this.set({'namespaceowner': userInfo.name}, {silent: true});
|
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: [{
|
schema: [{
|
||||||
id: 'name', label: '{{ _('Name') }}', cell: 'string',
|
id: 'name', label: '{{ _('Name') }}', cell: 'string',
|
||||||
@@ -95,7 +64,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
|||||||
type: 'multiline'
|
type: 'multiline'
|
||||||
},{
|
},{
|
||||||
id: 'seclabels', label: '{{ _('Security Labels') }}',
|
id: 'seclabels', label: '{{ _('Security Labels') }}',
|
||||||
model: SecurityModel, editable: false, type: 'collection',
|
model: pgBrowser.SecLabelModel, editable: false, type: 'collection',
|
||||||
group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
||||||
min_version: 90200, canAdd: true,
|
min_version: 90200, canAdd: true,
|
||||||
canEdit: false, canDelete: true, control: 'unique-col-collection'
|
canEdit: false, canDelete: true, control: 'unique-col-collection'
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ COMMENT ON SCHEMA {{ conn|qtIdent(o_data.name) }}
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ COMMENT ON SCHEMA {{ conn|qtIdent(o_data.name) }}
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ COMMENT ON SCHEMA {{ conn|qtIdent(o_data.name) }}
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ COMMENT ON SCHEMA {{ conn|qtIdent(o_data.name) }}
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
@@ -6,84 +6,84 @@ define(
|
|||||||
function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
||||||
|
|
||||||
|
|
||||||
// VaccumSettings Collection to display all settings parameters as Grid
|
// VaccumSettings Collection to display all settings parameters as Grid
|
||||||
var VacuumCollectionControl = Backform.VacuumCollectionControl =
|
var VacuumCollectionControl = Backform.VacuumCollectionControl =
|
||||||
Backform.Control.extend({
|
Backform.Control.extend({
|
||||||
|
|
||||||
grid_columns:undefined,
|
grid_columns:undefined,
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
Backform.Control.prototype.initialize.apply(this, arguments);
|
Backform.Control.prototype.initialize.apply(this, arguments);
|
||||||
var self = this,
|
var self = this,
|
||||||
m = this.model;
|
m = this.model;
|
||||||
url = self.field.get('url');
|
url = self.field.get('url');
|
||||||
|
|
||||||
if (url && m.isNew()) {
|
if (url && m.isNew()) {
|
||||||
var node = self.field.get('node'),
|
var node = self.field.get('node'),
|
||||||
node_data = self.field.get('node_data'),
|
node_data = self.field.get('node_data'),
|
||||||
node_info = self.field.get('node_info'),
|
node_info = self.field.get('node_info'),
|
||||||
full_url = node.generate_url.apply(
|
full_url = node.generate_url.apply(
|
||||||
node, [
|
node, [
|
||||||
null, url, node_data, false, node_info
|
null, url, node_data, false, node_info
|
||||||
]),
|
]),
|
||||||
data;
|
data;
|
||||||
m.trigger('pgadmin-view:fetching', m, self.field);
|
m.trigger('pgadmin-view:fetching', m, self.field);
|
||||||
|
|
||||||
// fetch default values for autovacuum fields
|
// fetch default values for autovacuum fields
|
||||||
$.ajax({
|
$.ajax({
|
||||||
async: false,
|
async: false,
|
||||||
url: full_url,
|
url: full_url,
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
data = res;
|
data = res;
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
m.trigger('pgadmin-view:fetch:error', m, self.field);
|
m.trigger('pgadmin-view:fetch:error', m, self.field);
|
||||||
}
|
|
||||||
});
|
|
||||||
m.trigger('pgadmin-view:fetched', m, self.field);
|
|
||||||
|
|
||||||
// Add fetched models into collection
|
|
||||||
if (data && _.isArray(data)) {
|
|
||||||
m.get(self.field.get('name')).reset(data, {silent: true});
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
render: function() {
|
|
||||||
var self = this,
|
|
||||||
m = this.model,
|
|
||||||
attributes = self.field.attributes;
|
|
||||||
|
|
||||||
// remove grid
|
|
||||||
if(self.grid) {
|
|
||||||
self.grid.remove();
|
|
||||||
delete self.grid;
|
|
||||||
self.grid = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.$el.empty();
|
|
||||||
|
|
||||||
var gridHeader = _.template([
|
|
||||||
'<div class="subnode-header">',
|
|
||||||
' <label class="control-label col-sm-4"><%-label%></label>',
|
|
||||||
'</div>'].join("\n")),
|
|
||||||
gridBody = $('<div class="pgadmin-control-group backgrid form-group col-xs-12 object subnode"></div>').append(
|
|
||||||
gridHeader(attributes)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Initialize a new Grid instance
|
|
||||||
var grid = self.grid = new Backgrid.Grid({
|
|
||||||
columns: self.grid_columns,
|
|
||||||
collection: self.model.get(self.field.get('name')),
|
|
||||||
className: "backgrid table-bordered"
|
|
||||||
});
|
});
|
||||||
|
m.trigger('pgadmin-view:fetched', m, self.field);
|
||||||
|
|
||||||
// render grid
|
// Add fetched models into collection
|
||||||
self.$el.append($(gridBody).append(grid.render().$el));
|
if (data && _.isArray(data)) {
|
||||||
|
m.get(self.field.get('name')).reset(data, {silent: true});
|
||||||
return self;
|
}
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
|
||||||
|
render: function() {
|
||||||
|
var self = this,
|
||||||
|
m = this.model,
|
||||||
|
attributes = self.field.attributes;
|
||||||
|
|
||||||
|
// remove grid
|
||||||
|
if(self.grid) {
|
||||||
|
self.grid.remove();
|
||||||
|
delete self.grid;
|
||||||
|
self.grid = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.$el.empty();
|
||||||
|
|
||||||
|
var gridHeader = _.template([
|
||||||
|
'<div class="subnode-header">',
|
||||||
|
' <label class="control-label col-sm-4"><%-label%></label>',
|
||||||
|
'</div>'].join("\n")),
|
||||||
|
gridBody = $('<div class="pgadmin-control-group backgrid form-group col-xs-12 object subnode"></div>').append(
|
||||||
|
gridHeader(attributes)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Initialize a new Grid instance
|
||||||
|
var grid = self.grid = new Backgrid.Grid({
|
||||||
|
columns: self.grid_columns,
|
||||||
|
collection: self.model.get(self.field.get('name')),
|
||||||
|
className: "backgrid table-bordered"
|
||||||
|
});
|
||||||
|
|
||||||
|
// render grid
|
||||||
|
self.$el.append($(gridBody).append(grid.render().$el));
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// We will use this function in VacuumSettings Control
|
// We will use this function in VacuumSettings Control
|
||||||
// to convert data type on the fly
|
// to convert data type on the fly
|
||||||
@@ -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
|
// 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: {
|
defaults: {
|
||||||
name: undefined,
|
name: undefined,
|
||||||
setting: undefined,
|
setting: undefined,
|
||||||
@@ -119,7 +130,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
toJSON: function(){
|
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.label;
|
||||||
delete d.setting;
|
delete d.setting;
|
||||||
delete d.column_type;
|
delete d.column_type;
|
||||||
@@ -128,168 +139,134 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Extend the browser's collection class for VacuumSettingsModel
|
// Extend the browser's collection class for VacuumSettingsModel
|
||||||
var VacuumSettingsSchema = Backform.VacuumSettingsSchema =
|
var VacuumSettingsSchema = Backform.VacuumSettingsSchema = [{
|
||||||
[{
|
id: 'autovacuum_custom', label: '{{ _("Custom auto-vacuum?") }}',
|
||||||
id: 'autovacuum_custom', label: '{{ _("Custom auto-vacuum?") }}',
|
group: '{{ _("Table") }}', mode: ['edit', 'create'],
|
||||||
group: '{{ _("Table") }}', mode: ['edit', 'create'],
|
type: 'switch',
|
||||||
type: 'switch',
|
disabled: function(m) {
|
||||||
disabled: function(m) {
|
if(!m.top.inSchema.apply(this, [m])) {
|
||||||
if(!m.top.inSchema.apply(this, [m])) {
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},{
|
|
||||||
id: 'autovacuum_enabled', label: '{{ _("Enabled?") }}',
|
|
||||||
group: '{{ _("Table") }}', mode: ['edit', 'create'],
|
|
||||||
type: 'switch',
|
|
||||||
deps: ['autovacuum_custom'],
|
|
||||||
disabled: function(m) {
|
|
||||||
if(!m.top.inSchema.apply(this, [m]) &&
|
|
||||||
m.get('autovacuum_custom') == true) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We also need to unset rest of all
|
|
||||||
setTimeout(function() {
|
|
||||||
m.set('autovacuum_enabled', false);
|
|
||||||
}, 10);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},{
|
|
||||||
id: 'vacuum_table', label: '{{ _("Vacuum Table") }}',
|
|
||||||
model: Backform.VacuumTableModel, editable: false, type: 'collection',
|
|
||||||
canEdit: true, group: '{{ _("Table") }}',
|
|
||||||
mode: ['edit', 'create'], url: 'get_table_vacuum',
|
|
||||||
control: Backform.VacuumCollectionControl.extend({
|
|
||||||
grid_columns :[
|
|
||||||
{
|
|
||||||
name: 'label', label: '{{ _("Label") }}',
|
|
||||||
headerCell: Backgrid.Extension.CustomHeaderCell,
|
|
||||||
cell: 'string', editable: false, cellHeaderClasses:'width_percent_40'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'value', label: '{{ _("Value") }}',
|
|
||||||
cellHeaderClasses:'width_percent_30',
|
|
||||||
cellFunction: Backform.cellFunction, editable: function(m) {
|
|
||||||
return m.handler.get('autovacuum_enabled');
|
|
||||||
}, headerCell: Backgrid.Extension.CustomHeaderCell
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'setting', label: '{{ _("Default value") }}',
|
|
||||||
cellHeaderClasses:'width_percent_30',
|
|
||||||
headerCell: Backgrid.Extension.CustomHeaderCell,
|
|
||||||
cellFunction: Backform.cellFunction, editable: false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}),
|
|
||||||
deps: ['autovacuum_enabled']
|
|
||||||
},{
|
|
||||||
id: 'toast_autovacuum', label: '{{ _("Custom auto-vaccum?") }}',
|
|
||||||
group: '{{ _("Toast Table") }}', mode: ['edit', 'create'],
|
|
||||||
type: 'switch',
|
|
||||||
disabled: function(m) {
|
|
||||||
// We need to check additional condition to toggle enable/disable
|
|
||||||
// for table auto-vacuum
|
|
||||||
if(!m.top.inSchema.apply(this, [m]) && m.isNew()) {
|
|
||||||
return false;
|
|
||||||
} else if(!m.top.inSchema.apply(this, [m]) &&
|
|
||||||
(m.get('toast_autovacuum_enabled') === true ||
|
|
||||||
m.top.get('hastoasttable') === true)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},{
|
|
||||||
id: 'toast_autovacuum_enabled', label: '{{ _("Enabled?") }}',
|
|
||||||
group: '{{ _("Toast Table") }}', mode: ['edit', 'create'],
|
|
||||||
type: 'switch',
|
|
||||||
deps:['toast_autovacuum'],
|
|
||||||
disabled: function(m) {
|
|
||||||
// If in schema & in create mode then enable it
|
|
||||||
if(!m.top.inSchema.apply(this, [m]) &&
|
|
||||||
m.get('toast_autovacuum') === true) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m.isNew() || m.get('hastoasttable')) {
|
|
||||||
// we also need to unset rest of all
|
|
||||||
setTimeout(function() {
|
|
||||||
m.set('toast_autovacuum_enabled', false);
|
|
||||||
}, 10);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},{
|
|
||||||
id: 'vacuum_toast', label: '{{ _("Vacuum Toast Table") }}',
|
|
||||||
model: Backform.VacuumTableModel, type: 'collection', editable: function(m) {
|
|
||||||
return m.isNew();
|
|
||||||
},
|
|
||||||
canEdit: true, group: '{{ _("Toast Table") }}',
|
|
||||||
mode: ['properties', 'edit', 'create'], url: 'get_toast_table_vacuum',
|
|
||||||
control: Backform.VacuumCollectionControl.extend({
|
|
||||||
grid_columns :[
|
|
||||||
{
|
|
||||||
name: 'label', label: '{{ _("Label") }}',
|
|
||||||
headerCell: Backgrid.Extension.CustomHeaderCell,
|
|
||||||
cell: 'string', editable: false, cellHeaderClasses:'width_percent_40'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'value', label: '{{ _("Value") }}',
|
|
||||||
cellHeaderClasses:'width_percent_30',
|
|
||||||
headerCell: Backgrid.Extension.CustomHeaderCell,
|
|
||||||
cellFunction: Backform.cellFunction, editable: function(m) {
|
|
||||||
return m.handler.get('toast_autovacuum_enabled');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'setting', label: '{{ _("Default value") }}',
|
|
||||||
cellHeaderClasses:'width_percent_30',
|
|
||||||
headerCell: Backgrid.Extension.CustomHeaderCell,
|
|
||||||
cellFunction: Backform.cellFunction, editable: false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}),
|
|
||||||
deps: ['toast_autovacuum_enabled']
|
|
||||||
}
|
}
|
||||||
];
|
return true;
|
||||||
|
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
});
|
},{
|
||||||
|
id: 'autovacuum_enabled', label: '{{ _("Enabled?") }}',
|
||||||
|
group: '{{ _("Table") }}', mode: ['edit', 'create'],
|
||||||
|
type: 'switch',
|
||||||
|
deps: ['autovacuum_custom'],
|
||||||
|
disabled: function(m) {
|
||||||
|
if(!m.top.inSchema.apply(this, [m]) &&
|
||||||
|
m.get('autovacuum_custom') == true) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We also need to unset rest of all
|
||||||
|
setTimeout(function() {
|
||||||
|
m.set('autovacuum_enabled', false);
|
||||||
|
}, 10);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
id: 'vacuum_table', label: '{{ _("Vacuum Table") }}',
|
||||||
|
model: Backform.VacuumTableModel, editable: false, type: 'collection',
|
||||||
|
canEdit: true, group: '{{ _("Table") }}',
|
||||||
|
mode: ['edit', 'create'], url: 'get_table_vacuum',
|
||||||
|
control: Backform.VacuumCollectionControl.extend({
|
||||||
|
grid_columns :[
|
||||||
|
{
|
||||||
|
name: 'label', label: '{{ _("Label") }}',
|
||||||
|
headerCell: Backgrid.Extension.CustomHeaderCell,
|
||||||
|
cell: 'string', editable: false, cellHeaderClasses:'width_percent_40'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'value', label: '{{ _("Value") }}',
|
||||||
|
cellHeaderClasses:'width_percent_30',
|
||||||
|
cellFunction: Backform.cellFunction, editable: function(m) {
|
||||||
|
return m.handler.get('autovacuum_enabled');
|
||||||
|
}, headerCell: Backgrid.Extension.CustomHeaderCell
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'setting', label: '{{ _("Default value") }}',
|
||||||
|
cellHeaderClasses:'width_percent_30',
|
||||||
|
headerCell: Backgrid.Extension.CustomHeaderCell,
|
||||||
|
cellFunction: Backform.cellFunction, editable: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}),
|
||||||
|
deps: ['autovacuum_enabled']
|
||||||
|
},{
|
||||||
|
id: 'toast_autovacuum', label: '{{ _("Custom auto-vaccum?") }}',
|
||||||
|
group: '{{ _("Toast Table") }}', mode: ['edit', 'create'],
|
||||||
|
type: 'switch',
|
||||||
|
disabled: function(m) {
|
||||||
|
// We need to check additional condition to toggle enable/disable
|
||||||
|
// for table auto-vacuum
|
||||||
|
if(!m.top.inSchema.apply(this, [m]) && m.isNew()) {
|
||||||
|
return false;
|
||||||
|
} else if(!m.top.inSchema.apply(this, [m]) &&
|
||||||
|
(m.get('toast_autovacuum_enabled') === true ||
|
||||||
|
m.top.get('hastoasttable') === true)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
id: 'toast_autovacuum_enabled', label: '{{ _("Enabled?") }}',
|
||||||
|
group: '{{ _("Toast Table") }}', mode: ['edit', 'create'],
|
||||||
|
type: 'switch',
|
||||||
|
deps:['toast_autovacuum'],
|
||||||
|
disabled: function(m) {
|
||||||
|
// If in schema & in create mode then enable it
|
||||||
|
if(!m.top.inSchema.apply(this, [m]) &&
|
||||||
|
m.get('toast_autovacuum') === true) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m.isNew() || m.get('hastoasttable')) {
|
||||||
|
// we also need to unset rest of all
|
||||||
|
setTimeout(function() {
|
||||||
|
m.set('toast_autovacuum_enabled', false);
|
||||||
|
}, 10);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
id: 'vacuum_toast', label: '{{ _("Vacuum Toast Table") }}',
|
||||||
|
model: Backform.VacuumTableModel, type: 'collection', editable: function(m) {
|
||||||
|
return m.isNew();
|
||||||
|
},
|
||||||
|
canEdit: true, group: '{{ _("Toast Table") }}',
|
||||||
|
mode: ['properties', 'edit', 'create'], url: 'get_toast_table_vacuum',
|
||||||
|
control: Backform.VacuumCollectionControl.extend({
|
||||||
|
grid_columns :[
|
||||||
|
{
|
||||||
|
name: 'label', label: '{{ _("Label") }}',
|
||||||
|
headerCell: Backgrid.Extension.CustomHeaderCell,
|
||||||
|
cell: 'string', editable: false, cellHeaderClasses:'width_percent_40'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'value', label: '{{ _("Value") }}',
|
||||||
|
cellHeaderClasses:'width_percent_30',
|
||||||
|
headerCell: Backgrid.Extension.CustomHeaderCell,
|
||||||
|
cellFunction: Backform.cellFunction, editable: function(m) {
|
||||||
|
return m.handler.get('toast_autovacuum_enabled');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'setting', label: '{{ _("Default value") }}',
|
||||||
|
cellHeaderClasses:'width_percent_30',
|
||||||
|
headerCell: Backgrid.Extension.CustomHeaderCell,
|
||||||
|
cellFunction: Backform.cellFunction, editable: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}),
|
||||||
|
deps: ['toast_autovacuum_enabled']
|
||||||
|
}];
|
||||||
|
|
||||||
// Extend the browser's collection class for schema collection
|
// Extend the browser's collection class for schema collection
|
||||||
if (!pgBrowser.Nodes['coll-schema']) {
|
if (!pgBrowser.Nodes['coll-schema']) {
|
||||||
var databases = pgAdmin.Browser.Nodes['coll-schema'] =
|
var databases = pgBrowser.Nodes['coll-schema'] =
|
||||||
pgAdmin.Browser.Collection.extend({
|
pgBrowser.Collection.extend({
|
||||||
node: 'schema',
|
node: 'schema',
|
||||||
label: '{{ _('Schemas') }}',
|
label: '{{ _('Schemas') }}',
|
||||||
type: 'coll-schema',
|
type: 'coll-schema',
|
||||||
@@ -298,7 +275,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
|||||||
};
|
};
|
||||||
// Extend the browser's node class for schema node
|
// Extend the browser's node class for schema node
|
||||||
if (!pgBrowser.Nodes['schema']) {
|
if (!pgBrowser.Nodes['schema']) {
|
||||||
pgAdmin.Browser.Nodes['schema'] = pgAdmin.Browser.Node.extend({
|
pgBrowser.Nodes['schema'] = pgBrowser.Node.extend({
|
||||||
parent_type: 'database',
|
parent_type: 'database',
|
||||||
type: 'schema',
|
type: 'schema',
|
||||||
sqlAlterHelp: 'sql-alterschema.html',
|
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: {
|
defaults: {
|
||||||
name: undefined,
|
name: undefined,
|
||||||
namespaceowner: undefined,
|
namespaceowner: undefined,
|
||||||
@@ -349,7 +326,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
|||||||
|
|
||||||
this.set({'namespaceowner': userInfo.name}, {silent: true});
|
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: [{
|
schema: [{
|
||||||
id: 'name', label: '{{ _('Name') }}', cell: 'string',
|
id: 'name', label: '{{ _('Name') }}', cell: 'string',
|
||||||
@@ -387,14 +364,14 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
|||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
id: 'nspacl', label: '{{ _('Privileges') }}',
|
id: 'nspacl', label: '{{ _('Privileges') }}',
|
||||||
model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend(
|
model: pgBrowser.Node.PrivilegeRoleModel.extend(
|
||||||
{privileges: ['C', 'U']}), uniqueCol : ['grantee', 'grantor'],
|
{privileges: ['C', 'U']}), uniqueCol : ['grantee', 'grantor'],
|
||||||
editable: false, type: 'collection', group: '{{ _('Security') }}',
|
editable: false, type: 'collection', group: '{{ _('Security') }}',
|
||||||
mode: ['edit', 'create'],
|
mode: ['edit', 'create'],
|
||||||
canAdd: true, canDelete: true, control: 'unique-col-collection',
|
canAdd: true, canDelete: true, control: 'unique-col-collection',
|
||||||
},{
|
},{
|
||||||
id: 'seclabels', label: '{{ _('Security Labels') }}',
|
id: 'seclabels', label: '{{ _('Security Labels') }}',
|
||||||
model: SecurityModel, editable: false, type: 'collection',
|
model: pgBrowser.SecLabelModel, editable: false, type: 'collection',
|
||||||
group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
||||||
min_version: 90200, canAdd: true,
|
min_version: 90200, canAdd: true,
|
||||||
canEdit: false, canDelete: true, control: 'unique-col-collection'
|
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') }}',
|
type: 'nested', control: 'tab', group: '{{ _('Default Privileges') }}',
|
||||||
mode: ['edit'],
|
mode: ['edit'],
|
||||||
schema:[{
|
schema:[{
|
||||||
id: 'deftblacl', model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend(
|
id: 'deftblacl', model: pgBrowser.Node.PrivilegeRoleModel.extend(
|
||||||
{privileges: ['a', 'r', 'w', 'd', 'D', 'x', 't']}),
|
{privileges: ['a', 'r', 'w', 'd', 'D', 'x', 't']}),
|
||||||
label: '{{ _('Default Privileges: Tables') }}',
|
label: '{{ _('Default Privileges: Tables') }}',
|
||||||
editable: false, type: 'collection', group: '{{ _('Tables') }}',
|
editable: false, type: 'collection', group: '{{ _('Tables') }}',
|
||||||
mode: ['edit', 'create'], control: 'unique-col-collection',
|
mode: ['edit', 'create'], control: 'unique-col-collection',
|
||||||
canAdd: true, canDelete: true, uniqueCol : ['grantee', 'grantor']
|
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']}),
|
{privileges: ['r', 'w', 'U']}),
|
||||||
label: '{{ _('Default Privileges: Sequences') }}',
|
label: '{{ _('Default Privileges: Sequences') }}',
|
||||||
editable: false, type: 'collection', group: '{{ _('Sequences') }}',
|
editable: false, type: 'collection', group: '{{ _('Sequences') }}',
|
||||||
mode: ['edit', 'create'], control: 'unique-col-collection',
|
mode: ['edit', 'create'], control: 'unique-col-collection',
|
||||||
canAdd: true, canDelete: true, uniqueCol : ['grantee', 'grantor']
|
canAdd: true, canDelete: true, uniqueCol : ['grantee', 'grantor']
|
||||||
},{
|
},{
|
||||||
id: 'deffuncacl', model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend(
|
id: 'deffuncacl', model: pgBrowser.Node.PrivilegeRoleModel.extend(
|
||||||
{privileges: ['X']}),
|
{privileges: ['X']}),
|
||||||
label: '{{ _('Default Privileges: Functions') }}',
|
label: '{{ _('Default Privileges: Functions') }}',
|
||||||
editable: false, type: 'collection', group: '{{ _('Functions') }}',
|
editable: false, type: 'collection', group: '{{ _('Functions') }}',
|
||||||
mode: ['edit', 'create'], control: 'unique-col-collection',
|
mode: ['edit', 'create'], control: 'unique-col-collection',
|
||||||
canAdd: true, canDelete: true, uniqueCol : ['grantee', 'grantor']
|
canAdd: true, canDelete: true, uniqueCol : ['grantee', 'grantor']
|
||||||
},{
|
},{
|
||||||
id: 'deftypeacl', model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend(
|
id: 'deftypeacl', model: pgBrowser.Node.PrivilegeRoleModel.extend(
|
||||||
{privileges: ['U']}),
|
{privileges: ['U']}),
|
||||||
label: '{{ _('Default Privileges: Types') }}',
|
label: '{{ _('Default Privileges: Types') }}',
|
||||||
editable: false, type: 'collection', group: '{{ _('Types') }}',
|
editable: false, type: 'collection', group: '{{ _('Types') }}',
|
||||||
@@ -504,8 +481,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
|
|||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
remove: Backgrid.Extension.DependentCell.prototype.remove
|
remove: Backgrid.Extension.DependentCell.prototype.remove
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
return pgBrowser.Nodes['schema'];
|
return pgBrowser.Nodes['schema'];
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -30,6 +30,6 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
|
|||||||
{# Security Labels on schema #}
|
{# Security Labels on schema #}
|
||||||
{% if data.seclabels and data.seclabels|length > 0 %}
|
{% if data.seclabels and data.seclabels|length > 0 %}
|
||||||
{% for r in data.seclabels %}
|
{% for r in data.seclabels %}
|
||||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -72,12 +72,12 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -30,6 +30,6 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
|
|||||||
{# Security Labels on schema #}
|
{# Security Labels on schema #}
|
||||||
{% if data.seclabels and data.seclabels|length > 0 %}
|
{% if data.seclabels and data.seclabels|length > 0 %}
|
||||||
{% for r in data.seclabels %}
|
{% for r in data.seclabels %}
|
||||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -72,12 +72,12 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -30,6 +30,6 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
|
|||||||
{# Security Labels on schema #}
|
{# Security Labels on schema #}
|
||||||
{% if data.seclabels and data.seclabels|length > 0 %}
|
{% if data.seclabels and data.seclabels|length > 0 %}
|
||||||
{% for r in data.seclabels %}
|
{% for r in data.seclabels %}
|
||||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -31,12 +31,12 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,6 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
|
|||||||
{# Security Labels on schema #}
|
{# Security Labels on schema #}
|
||||||
{% if data.seclabels and data.seclabels|length > 0 %}
|
{% if data.seclabels and data.seclabels|length > 0 %}
|
||||||
{% for r in data.seclabels %}
|
{% for r in data.seclabels %}
|
||||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
{{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -31,12 +31,12 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ define(
|
|||||||
function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
||||||
|
|
||||||
if (!pgBrowser.Nodes['coll-type']) {
|
if (!pgBrowser.Nodes['coll-type']) {
|
||||||
var databases = pgAdmin.Browser.Nodes['coll-type'] =
|
var databases = pgBrowser.Nodes['coll-type'] =
|
||||||
pgAdmin.Browser.Collection.extend({
|
pgBrowser.Collection.extend({
|
||||||
node: 'type',
|
node: 'type',
|
||||||
label: '{{ _('Types') }}',
|
label: '{{ _('Types') }}',
|
||||||
type: 'coll-type',
|
type: 'coll-type',
|
||||||
@@ -63,39 +63,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
|||||||
remove: Backgrid.Extension.DependentCell.prototype.remove
|
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
|
// Composite type model declaration
|
||||||
var CompositeModel = Backform.CompositeModel = pgAdmin.Browser.Node.Model.extend({
|
var CompositeModel = Backform.CompositeModel = pgBrowser.Node.Model.extend({
|
||||||
idAttribute: 'attnum',
|
idAttribute: 'attnum',
|
||||||
defaults: {
|
defaults: {
|
||||||
attnum: undefined,
|
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: {
|
defaults: {
|
||||||
label: undefined,
|
label: undefined,
|
||||||
},
|
},
|
||||||
@@ -275,7 +244,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!pgBrowser.Nodes['type']) {
|
if (!pgBrowser.Nodes['type']) {
|
||||||
pgAdmin.Browser.Nodes['type'] = pgBrowser.Node.extend({
|
pgBrowser.Nodes['type'] = pgBrowser.Node.extend({
|
||||||
type: 'type',
|
type: 'type',
|
||||||
sqlAlterHelp: 'sql-altertype.html',
|
sqlAlterHelp: 'sql-altertype.html',
|
||||||
sqlCreateHelp: 'sql-createtype.html',
|
sqlCreateHelp: 'sql-createtype.html',
|
||||||
@@ -317,7 +286,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
|||||||
canDrop: pgBrowser.Nodes['schema'].canChildDrop,
|
canDrop: pgBrowser.Nodes['schema'].canChildDrop,
|
||||||
canDropCascade: pgBrowser.Nodes['schema'].canChildDrop,
|
canDropCascade: pgBrowser.Nodes['schema'].canChildDrop,
|
||||||
ext_funcs: undefined,
|
ext_funcs: undefined,
|
||||||
model: pgAdmin.Browser.Node.Model.extend({
|
model: pgBrowser.Node.Model.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
name: undefined,
|
name: undefined,
|
||||||
oid: undefined,
|
oid: undefined,
|
||||||
@@ -336,7 +305,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
|||||||
this.set({'typeowner': userInfo.name}, {silent: true});
|
this.set({'typeowner': userInfo.name}, {silent: true});
|
||||||
this.set({'schema': schemaInfo.label}, {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: [{
|
schema: [{
|
||||||
@@ -747,9 +716,9 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
|||||||
id: 'alias', label:'{{ _('Alias') }}', cell: 'string',
|
id: 'alias', label:'{{ _('Alias') }}', cell: 'string',
|
||||||
type: 'text', mode: ['properties'],
|
type: 'text', mode: ['properties'],
|
||||||
disabled: 'inSchema'
|
disabled: 'inSchema'
|
||||||
},{
|
}, pgBrowser.SecurityGroupUnderSchema,{
|
||||||
id: 'type_acl', label:'{{ _('Privileges') }}', cell: 'string',
|
id: 'type_acl', label:'{{ _('Privileges') }}', cell: 'string',
|
||||||
type: 'text', mode: ['properties'], group: '{{ _('Security') }}',
|
type: 'text', mode: ['properties'], group: 'security',
|
||||||
disabled: 'inSchema'
|
disabled: 'inSchema'
|
||||||
},{
|
},{
|
||||||
id: 'member_list', label:'{{ _('Members') }}', cell: 'string',
|
id: 'member_list', label:'{{ _('Members') }}', cell: 'string',
|
||||||
@@ -778,9 +747,11 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
|||||||
type: 'multiline', mode: ['properties', 'create', 'edit'],
|
type: 'multiline', mode: ['properties', 'create', 'edit'],
|
||||||
disabled: 'inSchema'
|
disabled: 'inSchema'
|
||||||
},{
|
},{
|
||||||
id: 'typacl', label: 'Privileges', type: 'collection',
|
id: 'typacl', label:'{{ _('Privileges') }}', type: 'collection',
|
||||||
group: '{{ _('Security') }}', control: 'unique-col-collection',
|
group: 'security', control: 'unique-col-collection',
|
||||||
model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend({privileges: ['U']}),
|
model: pgBrowser.Node.PrivilegeRoleModel.extend({
|
||||||
|
privileges: ['U']
|
||||||
|
}),
|
||||||
mode: ['edit', 'create'], canDelete: true,
|
mode: ['edit', 'create'], canDelete: true,
|
||||||
uniqueCol : ['grantee'], deps: ['typtype'],
|
uniqueCol : ['grantee'], deps: ['typtype'],
|
||||||
canAdd: function(m) {
|
canAdd: function(m) {
|
||||||
@@ -789,15 +760,14 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
|||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
id: 'seclabels', label: '{{ _('Security Labels') }}',
|
id: 'seclabels', label: '{{ _('Security Labels') }}',
|
||||||
model: SecurityModel, editable: false, type: 'collection',
|
model: pgBrowser.SecLabglModel, editable: false, type: 'collection',
|
||||||
group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
group: 'security', mode: ['edit', 'create'],
|
||||||
min_version: 90100, canEdit: false, canDelete: true,
|
min_version: 90100, canEdit: false, canDelete: true,
|
||||||
control: 'unique-col-collection', deps: ['typtype'],
|
control: 'unique-col-collection', deps: ['typtype'],
|
||||||
canAdd: function(m) {
|
canAdd: function(m) {
|
||||||
// Do not allow to add when shell type is selected
|
// Do not allow to add when shell type is selected
|
||||||
return !(m.get('typtype') === 'p');
|
return !(m.get('typtype') === 'p');
|
||||||
}
|
}
|
||||||
|
|
||||||
}],
|
}],
|
||||||
validate: function() {
|
validate: function() {
|
||||||
// Validation code for required fields
|
// Validation code for required fields
|
||||||
|
|||||||
@@ -76,8 +76,8 @@ COMMENT ON TYPE {% if data.schema %}{{ conn|qtIdent(data.schema, data.name) }}{%
|
|||||||
{% if data.seclabels %}
|
{% if data.seclabels %}
|
||||||
|
|
||||||
{% for r in data.seclabels %}
|
{% for r in data.seclabels %}
|
||||||
{% if r.provider and r.security_label %}
|
{% if r.provider and r.label %}
|
||||||
{{ SECLABLE.SET(conn, 'TYPE', data.name, r.provider, r.security_label, data.schema) }}
|
{{ SECLABLE.SET(conn, 'TYPE', data.name, r.provider, r.label, data.schema) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -90,12 +90,12 @@ ALTER TYPE {{ conn|qtIdent(o_data.schema, o_data.name) }}
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABLE.SET(conn, '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 %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABLE.SET(conn, 'TYPE', o_data.name, r.provider, r.security_label, o_data.schema) }}
|
{{ SECLABLE.SET(conn, 'TYPE', o_data.name, r.provider, r.label, o_data.schema) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@@ -136,4 +136,4 @@ ALTER TYPE {% if data.name and data.name != o_data.name %}{{ conn|qtIdent(o_data
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
SET SCHEMA {{ conn|qtIdent(data.schema) }};
|
SET SCHEMA {{ conn|qtIdent(data.schema) }};
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -451,7 +451,7 @@ class ViewNode(PGChildNodeView, VacuumSettings):
|
|||||||
sec = re.search(r'([^=]+)=(.*$)', sec)
|
sec = re.search(r'([^=]+)=(.*$)', sec)
|
||||||
sec_lbls.append({
|
sec_lbls.append({
|
||||||
'provider': sec.group(1),
|
'provider': sec.group(1),
|
||||||
'security_label': sec.group(2)
|
'label': sec.group(2)
|
||||||
})
|
})
|
||||||
|
|
||||||
frmtd_result.update({"seclabels": sec_lbls})
|
frmtd_result.update({"seclabels": sec_lbls})
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) {
|
|||||||
display under under properties.
|
display under under properties.
|
||||||
*/
|
*/
|
||||||
if (!pgBrowser.Nodes['coll-mview']) {
|
if (!pgBrowser.Nodes['coll-mview']) {
|
||||||
var mviews= pgAdmin.Browser.Nodes['coll-mview'] =
|
var mviews= pgBrowser.Nodes['coll-mview'] =
|
||||||
pgAdmin.Browser.Collection.extend({
|
pgBrowser.Collection.extend({
|
||||||
node: 'mview',
|
node: 'mview',
|
||||||
label: '{{ _("Materialized Views") }}',
|
label: '{{ _("Materialized Views") }}',
|
||||||
type: 'coll-mview',
|
type: 'coll-mview',
|
||||||
@@ -33,7 +33,7 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) {
|
|||||||
view option in the context menu
|
view option in the context menu
|
||||||
*/
|
*/
|
||||||
if (!pgBrowser.Nodes['mview']) {
|
if (!pgBrowser.Nodes['mview']) {
|
||||||
pgAdmin.Browser.Nodes['mview'] = pgAdmin.Browser.Node.extend({
|
pgBrowser.Nodes['mview'] = pgBrowser.Node.extend({
|
||||||
parent_type: ['schema', 'catalog'],
|
parent_type: ['schema', 'catalog'],
|
||||||
type: 'mview',
|
type: 'mview',
|
||||||
sqlAlterHelp: 'sql-altermaterializedview.html',
|
sqlAlterHelp: 'sql-altermaterializedview.html',
|
||||||
@@ -96,7 +96,7 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) {
|
|||||||
Define model for the view node and specify the
|
Define model for the view node and specify the
|
||||||
properties of the model in schema.
|
properties of the model in schema.
|
||||||
*/
|
*/
|
||||||
model: pgAdmin.Browser.Node.Model.extend({
|
model: pgBrowser.Node.Model.extend({
|
||||||
initialize: function(attrs, args) {
|
initialize: function(attrs, args) {
|
||||||
var isNew = (_.size(attrs) === 0);
|
var isNew = (_.size(attrs) === 0);
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
@@ -108,7 +108,7 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) {
|
|||||||
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
||||||
this.set({'owner': userInfo.name}, {silent: true});
|
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: {
|
defaults: {
|
||||||
spcname: 'pg_default',
|
spcname: 'pg_default',
|
||||||
@@ -118,44 +118,35 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) {
|
|||||||
schema: [{
|
schema: [{
|
||||||
id: 'name', label: '{{ _("Name") }}', cell: 'string',
|
id: 'name', label: '{{ _("Name") }}', cell: 'string',
|
||||||
type: 'text', disabled: 'inSchema'
|
type: 'text', disabled: 'inSchema'
|
||||||
},
|
},{
|
||||||
{
|
|
||||||
id: 'oid', label:'{{ _("OID") }}', cell: 'string',
|
id: 'oid', label:'{{ _("OID") }}', cell: 'string',
|
||||||
type: 'text', disabled: true, mode: ['properties']
|
type: 'text', disabled: true, mode: ['properties']
|
||||||
},
|
},{
|
||||||
{
|
|
||||||
id: 'owner', label:'{{ _("Owner") }}', cell: 'string',
|
id: 'owner', label:'{{ _("Owner") }}', cell: 'string',
|
||||||
control: 'node-list-by-name', select2: { allowClear: false },
|
control: 'node-list-by-name', select2: { allowClear: false },
|
||||||
node: 'role', disabled: 'inSchema'
|
node: 'role', disabled: 'inSchema'
|
||||||
},
|
},{
|
||||||
{
|
|
||||||
id: 'schema', label:'{{ _("Schema") }}', cell: 'string', first_empty: false,
|
id: 'schema', label:'{{ _("Schema") }}', cell: 'string', first_empty: false,
|
||||||
control: 'node-list-by-name', type: 'text', cache_level: 'database',
|
control: 'node-list-by-name', type: 'text', cache_level: 'database',
|
||||||
node: 'schema', mode: ['create', 'edit'], disabled: 'inSchema', select2: { allowClear: false }
|
node: 'schema', mode: ['create', 'edit'], disabled: 'inSchema', select2: { allowClear: false }
|
||||||
},
|
},{
|
||||||
{
|
|
||||||
id: 'system_view', label:'{{ _("System view?") }}', cell: 'string',
|
id: 'system_view', label:'{{ _("System view?") }}', cell: 'string',
|
||||||
type: 'switch', disabled: true, mode: ['properties'],
|
type: 'switch', disabled: true, mode: ['properties'],
|
||||||
},
|
}, pgBrowser.SecurityGroupUnderSchema, {
|
||||||
{
|
id: 'acl', label: '{{ _("Privileges") }}',
|
||||||
id: 'acl', label: '{{ _("ACL") }}',
|
mode: ['properties'], type: 'text', group: '{{ _("Security") }}'
|
||||||
mode: ['properties'], type: 'text'
|
},{
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'comment', label:'{{ _("Comment") }}', cell: 'string',
|
id: 'comment', label:'{{ _("Comment") }}', cell: 'string',
|
||||||
type: 'multiline'
|
type: 'multiline'
|
||||||
},
|
},{
|
||||||
{
|
|
||||||
id: 'definition', label:'{{ _("") }}', cell: 'string',
|
id: 'definition', label:'{{ _("") }}', cell: 'string',
|
||||||
type: 'text', mode: ['create', 'edit'], group: 'Definition',
|
type: 'text', mode: ['create', 'edit'], group: 'Definition',
|
||||||
control: Backform.SqlFieldControl, extraClasses:['sql_field_width_full']
|
control: Backform.SqlFieldControl, extraClasses:['sql_field_width_full']
|
||||||
},
|
},{
|
||||||
{
|
|
||||||
id: 'with_data', label: '{{ _("With Data") }}',
|
id: 'with_data', label: '{{ _("With Data") }}',
|
||||||
group: '{{ _("Storage") }}', mode: ['edit', 'create'],
|
group: '{{ _("Storage") }}', mode: ['edit', 'create'],
|
||||||
type: 'switch',
|
type: 'switch',
|
||||||
},
|
},{
|
||||||
{
|
|
||||||
id: 'spcname', label: '{{ _("Tablespace") }}', cell: 'string',
|
id: 'spcname', label: '{{ _("Tablespace") }}', cell: 'string',
|
||||||
type: 'text', group: '{{ _("Storage") }}', first_empty: false,
|
type: 'text', group: '{{ _("Storage") }}', first_empty: false,
|
||||||
control: 'node-list-by-name', node: 'tablespace', select2: { allowClear: 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;
|
if (m.label == "pg_global") return false;
|
||||||
else return true;
|
else return true;
|
||||||
}
|
}
|
||||||
},
|
},{
|
||||||
{
|
|
||||||
id: 'fillfactor', label: '{{ _("Fill Factor") }}',
|
id: 'fillfactor', label: '{{ _("Fill Factor") }}',
|
||||||
group: '{{ _("Storage") }}', mode: ['edit', 'create'],
|
group: '{{ _("Storage") }}', mode: ['edit', 'create'],
|
||||||
type: 'integer'
|
type: 'integer'
|
||||||
},
|
},{
|
||||||
{
|
|
||||||
type: 'nested', control: 'tab', id: 'materialization',
|
type: 'nested', control: 'tab', id: 'materialization',
|
||||||
label: '{{ _("Auto vacuum") }}', mode: ['edit', 'create'],
|
label: '{{ _("Auto vacuum") }}', mode: ['edit', 'create'],
|
||||||
group: '{{ _("Auto vacuum") }}',
|
group: '{{ _("Auto vacuum") }}',
|
||||||
schema: Backform.VacuumSettingsSchema
|
schema: Backform.VacuumSettingsSchema
|
||||||
},
|
},{
|
||||||
// Add Privilege Control
|
// Add Privilege Control
|
||||||
{
|
id: 'datacl', label: '{{ _("Privileges") }}', type: 'collection',
|
||||||
id: 'datacl', label: '{{ _("Privileges") }}',
|
model: pgBrowser.Node.PrivilegeRoleModel.extend({
|
||||||
model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend(
|
privileges: ['a', 'r', 'w', 'd', 'D', 'x', 't']
|
||||||
{privileges: ['a', 'r', 'w', 'd', 'D', 'x', 't']}), uniqueCol : ['grantee'],
|
}), uniqueCol : ['grantee'], editable: false,
|
||||||
editable: false, type: 'collection', group: '{{ _("Security") }}',
|
group: "security", canAdd: true, canDelete: true,
|
||||||
mode: ['edit', 'create'], canAdd: true, canDelete: true,
|
mode: ['edit', 'create'], control: 'unique-col-collection'
|
||||||
control: 'unique-col-collection', priority: 3
|
},{
|
||||||
},
|
|
||||||
|
|
||||||
// Add Security Labels Control
|
// Add Security Labels Control
|
||||||
{
|
|
||||||
id: 'seclabels', label: '{{ _("Security Labels") }}',
|
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,
|
canEdit: false, group: "security", canDelete: true,
|
||||||
mode: ['edit', 'create'], canAdd: true,
|
mode: ['edit', 'create'], canAdd: true,
|
||||||
control: 'unique-col-collection', uniqueCol : ['provider']
|
control: 'unique-col-collection', uniqueCol : ['provider']
|
||||||
}
|
}],
|
||||||
],
|
|
||||||
validate: function(keys) {
|
validate: function(keys) {
|
||||||
|
|
||||||
// Triggers specific error messages for fields
|
// Triggers specific error messages for fields
|
||||||
@@ -308,8 +293,8 @@ 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/security.macros' as SECLABLE %}
|
||||||
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
||||||
{# We will generate Security Label SQL using macro #}
|
{# We will generate Security Label SQL using macro #}
|
||||||
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.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 %}
|
{% 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 %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
{% import 'macros/security.macros' as SECLABLE %}
|
{% import 'macros/security.macros' as SECLABLE %}
|
||||||
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
||||||
{# We will generate Security Label SQL using macro #}
|
{# We will generate Security Label SQL using macro #}
|
||||||
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.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 %}
|
{% 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 %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) {
|
|||||||
display under under properties.
|
display under under properties.
|
||||||
*/
|
*/
|
||||||
if (!pgBrowser.Nodes['coll-view']) {
|
if (!pgBrowser.Nodes['coll-view']) {
|
||||||
var views= pgAdmin.Browser.Nodes['coll-view'] =
|
var views= pgBrowser.Nodes['coll-view'] =
|
||||||
pgAdmin.Browser.Collection.extend({
|
pgBrowser.Collection.extend({
|
||||||
node: 'view',
|
node: 'view',
|
||||||
label: '{{ _("Views") }}',
|
label: '{{ _("Views") }}',
|
||||||
type: 'coll-view',
|
type: 'coll-view',
|
||||||
@@ -33,7 +33,7 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) {
|
|||||||
view option in the context menu
|
view option in the context menu
|
||||||
*/
|
*/
|
||||||
if (!pgBrowser.Nodes['view']) {
|
if (!pgBrowser.Nodes['view']) {
|
||||||
pgAdmin.Browser.Nodes['view'] = pgAdmin.Browser.Node.extend({
|
pgBrowser.Nodes['view'] = pgBrowser.Node.extend({
|
||||||
parent_type: ['schema', 'catalog'],
|
parent_type: ['schema', 'catalog'],
|
||||||
type: 'view',
|
type: 'view',
|
||||||
sqlAlterHelp: 'sql-alterview.html',
|
sqlAlterHelp: 'sql-alterview.html',
|
||||||
@@ -87,7 +87,7 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) {
|
|||||||
Define model for the view node and specify the
|
Define model for the view node and specify the
|
||||||
properties of the model in schema.
|
properties of the model in schema.
|
||||||
*/
|
*/
|
||||||
model: pgAdmin.Browser.Node.Model.extend({
|
model: pgBrowser.Node.Model.extend({
|
||||||
initialize: function(attrs, args) {
|
initialize: function(attrs, args) {
|
||||||
var isNew = (_.size(attrs) === 0);
|
var isNew = (_.size(attrs) === 0);
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
@@ -99,96 +99,71 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) {
|
|||||||
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
||||||
this.set({'owner': userInfo.name}, {silent: true});
|
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: [{
|
schema: [{
|
||||||
id: 'name', label: '{{ _("Name") }}', cell: 'string',
|
id: 'name', label: '{{ _("Name") }}', cell: 'string',
|
||||||
type: 'text', disabled: 'inSchema'
|
type: 'text', disabled: 'notInSchema'
|
||||||
},
|
},{
|
||||||
{
|
|
||||||
id: 'oid', label:'{{ _("OID") }}', cell: 'string',
|
id: 'oid', label:'{{ _("OID") }}', cell: 'string',
|
||||||
type: 'text', disabled: true, mode: ['properties']
|
type: 'text', disabled: true, mode: ['properties']
|
||||||
},
|
},{
|
||||||
{
|
|
||||||
id: 'owner', label:'{{ _("Owner") }}', cell: 'string', control: 'node-list-by-name',
|
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,
|
id: 'schema', label:'{{ _("Schema") }}', cell: 'string', first_empty: false,
|
||||||
control: 'node-list-by-name', type: 'text', cache_level: 'database',
|
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',
|
id: 'system_view', label:'{{ _("System view?") }}', cell: 'string',
|
||||||
type: 'switch', disabled: true, mode: ['properties']
|
type: 'switch', disabled: true, mode: ['properties']
|
||||||
},
|
},{
|
||||||
{
|
|
||||||
id: 'acl', label: '{{ _("Privileges") }}',
|
id: 'acl', label: '{{ _("Privileges") }}',
|
||||||
mode: ['properties'], type: 'text'
|
mode: ['properties'], type: 'text', group: '{{ _("Security") }}'
|
||||||
},
|
},{
|
||||||
{
|
|
||||||
id: 'comment', label:'{{ _("Comment") }}', cell: 'string',
|
id: 'comment', label:'{{ _("Comment") }}', cell: 'string',
|
||||||
type: 'multiline', disabled: 'inSchema'
|
type: 'multiline', disabled: 'notInSchema'
|
||||||
},
|
},{
|
||||||
{
|
id: 'security_barrier', label:'{{ _("Security barrier") }}',
|
||||||
id: 'security_barrier', label:'{{ _("Security barrier") }}', cell: 'string',
|
type: 'switch', min_version: '90200', group: 'Definition',
|
||||||
type: 'switch', min_version: '90200',
|
disabled: 'notInSchema'
|
||||||
group: 'Definition', disabled: 'inSchema'
|
},{
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'check_option', label:'{{ _("Check options") }}',
|
id: 'check_option', label:'{{ _("Check options") }}',
|
||||||
control: 'select2', group: 'Definition', type: 'text',
|
control: 'select2', group: 'Definition', type: 'text',
|
||||||
min_version: '90400', mode:['properties', 'create', 'edit'],
|
min_version: '90400', mode:['properties', 'create', 'edit'],
|
||||||
select2: {
|
select2: {
|
||||||
|
// Set select2 option width to 100%
|
||||||
// set select2 option width to 100%
|
|
||||||
allowClear: false,
|
allowClear: false,
|
||||||
width: '100%'
|
}, disabled: 'notInSchema',
|
||||||
},
|
options:[{
|
||||||
options:[
|
label: "{{ _('No') }}", value: "no"
|
||||||
{label: "No", value: "no"},
|
},{
|
||||||
{label: "Local", value: "local"},
|
label: "{{ _('Local') }}", value: "local"
|
||||||
{label: "Cascaded", value: "cascaded"}
|
},{
|
||||||
], disabled: 'inSchema'
|
label: "{{ _('Cascaded') }}", value: "cascaded"
|
||||||
},
|
}]
|
||||||
{
|
},{
|
||||||
id: 'definition', label:'{{ _("Definition") }}', cell: 'string',
|
id: 'definition', label:'{{ _("Definition") }}', cell: 'string',
|
||||||
type: 'text', mode: ['create', 'edit'], group: 'Definition',
|
type: 'text', mode: ['create', 'edit'], group: 'Definition',
|
||||||
control: Backform.SqlFieldControl,
|
control: Backform.SqlFieldControl,
|
||||||
disabled: 'inSchema'
|
disabled: 'notInSchema'
|
||||||
},
|
}, pgBrowser.SecurityGroupUnderSchema, {
|
||||||
{
|
// Add Privilege Control
|
||||||
id: 'security', label: '{{ _("Security") }}',
|
id: 'datacl', label: '{{ _("Privileges") }}', type: 'collection',
|
||||||
type: 'group',
|
model: pgBrowser.Node.PrivilegeRoleModel.extend({
|
||||||
visible: function(m) {
|
privileges: ['a', 'r', 'w', 'd', 'D', 'x', 't']
|
||||||
if (m.top && 'catalog' in m.top.node_info) {
|
}), uniqueCol : ['grantee'], editable: false, group: 'security',
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 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,
|
mode: ['edit', 'create'], canAdd: true, canDelete: true,
|
||||||
control: 'unique-col-collection', disabled: 'inSchema'
|
control: 'unique-col-collection', disabled: 'notInSchema'
|
||||||
},
|
},{
|
||||||
|
// Add Security Labels Control
|
||||||
// Add Security Labels Control
|
|
||||||
{
|
|
||||||
id: 'seclabels', label: '{{ _("Security labels") }}',
|
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,
|
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']
|
control: 'unique-col-collection', uniqueCol : ['provider']
|
||||||
},
|
}],
|
||||||
],
|
|
||||||
validate: function() {
|
validate: function() {
|
||||||
|
|
||||||
// Triggers specific error messages for fields
|
// Triggers specific error messages for fields
|
||||||
var err = {},
|
var err = {},
|
||||||
errmsg,
|
errmsg,
|
||||||
@@ -215,9 +190,8 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) {
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
// We will disable everything if we are under catalog node
|
// We will disable everything if we are under catalog node
|
||||||
inSchema: function() {
|
notInSchema: function() {
|
||||||
if(this.node_info && 'catalog' in this.node_info)
|
if(this.node_info && 'catalog' in this.node_info) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
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/security.macros' as SECLABLE %}
|
||||||
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
||||||
{# ===== We will generate Security Label SQL using macro ===== #}
|
{# ===== We will generate Security Label SQL using macro ===== #}
|
||||||
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.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 %}
|
{% 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 %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
{% import 'macros/security.macros' as SECLABLE %}
|
{% import 'macros/security.macros' as SECLABLE %}
|
||||||
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
||||||
{# ===== We will generate Security Label SQL using macro ===== #}
|
{# ===== We will generate Security Label SQL using macro ===== #}
|
||||||
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.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 %}
|
{% 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 %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
{% import 'macros/security.macros' as SECLABLE %}
|
{% import 'macros/security.macros' as SECLABLE %}
|
||||||
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
||||||
{# ===== We will generate Security Label SQL using macro ===== #}
|
{# ===== We will generate Security Label SQL using macro ===== #}
|
||||||
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.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 %}
|
{% 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 %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
{% import 'macros/security.macros' as SECLABLE %}
|
{% import 'macros/security.macros' as SECLABLE %}
|
||||||
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
||||||
{# ===== We will generate Security Label SQL using macro ===== #}
|
{# ===== We will generate Security Label SQL using macro ===== #}
|
||||||
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.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 %}
|
{% 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 %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
{% import 'macros/security.macros' as SECLABLE %}
|
{% import 'macros/security.macros' as SECLABLE %}
|
||||||
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
||||||
{# ===== We will generate Security Label SQL using macro ===== #}
|
{# ===== We will generate Security Label SQL using macro ===== #}
|
||||||
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.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 %}
|
{% 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 %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
{% import 'macros/security.macros' as SECLABLE %}
|
{% import 'macros/security.macros' as SECLABLE %}
|
||||||
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
||||||
{# ===== We will generate Security Label SQL using macro ===== #}
|
{# ===== We will generate Security Label SQL using macro ===== #}
|
||||||
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.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 %}
|
{% 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 %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
{% import 'macros/security.macros' as SECLABLE %}
|
{% import 'macros/security.macros' as SECLABLE %}
|
||||||
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
||||||
{# ===== We will generate Security Label SQL using macro ===== #}
|
{# ===== We will generate Security Label SQL using macro ===== #}
|
||||||
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.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 %}
|
{% 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 %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
{% import 'macros/security.macros' as SECLABLE %}
|
{% import 'macros/security.macros' as SECLABLE %}
|
||||||
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
|
||||||
{# ===== We will generate Security Label SQL using macro ===== #}
|
{# ===== We will generate Security Label SQL using macro ===== #}
|
||||||
{% if data.seclabels %}{% for r in data.seclabels %}{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.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 %}
|
{% 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 %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.security_label) }}
|
{{ SECLABLE.APPLY(conn, 'VIEW', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ define([
|
|||||||
function($, _, S, pgAdmin, pgBrowser, Alertify) {
|
function($, _, S, pgAdmin, pgBrowser, Alertify) {
|
||||||
|
|
||||||
if (!pgBrowser.Nodes['coll-database']) {
|
if (!pgBrowser.Nodes['coll-database']) {
|
||||||
var databases = pgAdmin.Browser.Nodes['coll-database'] =
|
var databases = pgBrowser.Nodes['coll-database'] =
|
||||||
pgAdmin.Browser.Collection.extend({
|
pgBrowser.Collection.extend({
|
||||||
node: 'database',
|
node: 'database',
|
||||||
label: '{{ _('Databases') }}',
|
label: '{{ _('Databases') }}',
|
||||||
type: 'coll-database',
|
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']) {
|
if (!pgBrowser.Nodes['database']) {
|
||||||
pgAdmin.Browser.Nodes['database'] = pgAdmin.Browser.Node.extend({
|
pgBrowser.Nodes['database'] = pgBrowser.Node.extend({
|
||||||
parent_type: 'server',
|
parent_type: 'server',
|
||||||
type: 'database',
|
type: 'database',
|
||||||
sqlAlterHelp: 'sql-alterdatabase.html',
|
sqlAlterHelp: 'sql-alterdatabase.html',
|
||||||
@@ -210,7 +182,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
|
|||||||
return pgBrowser.Node.callbacks.selected.apply(this, arguments);
|
return pgBrowser.Node.callbacks.selected.apply(this, arguments);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
model: pgAdmin.Browser.Node.Model.extend({
|
model: pgBrowser.Node.Model.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
name: undefined,
|
name: undefined,
|
||||||
owner: undefined,
|
owner: undefined,
|
||||||
@@ -240,7 +212,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
|
|||||||
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
||||||
this.set({'datowner': userInfo.name}, {silent: true});
|
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: [{
|
schema: [{
|
||||||
@@ -300,18 +272,21 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
|
|||||||
'size': 'small'
|
'size': 'small'
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
id: 'datacl', label: '{{ _('Privileges') }}', model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend(
|
id: 'datacl', label: '{{ _('Privileges') }}', type: 'collection',
|
||||||
{privileges: ['C', 'T', 'c']}), uniqueCol : ['grantee', 'grantor'],
|
model: pgBrowser.Node.PrivilegeRoleModel.extend({
|
||||||
editable: false, type: 'collection', group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
privileges: ['C', 'T', 'c']
|
||||||
|
}), uniqueCol : ['grantee', 'grantor'], editable: false,
|
||||||
|
group: '{{ _('Security') }}', mode: ['edit', 'create'],
|
||||||
canAdd: true, canDelete: true, control: 'unique-col-collection',
|
canAdd: true, canDelete: true, control: 'unique-col-collection',
|
||||||
},{
|
},{
|
||||||
id: 'variables', label: '{{ _('Parameters') }}', type: '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'],
|
group: '{{ _('Parameters') }}', mode: ['edit', 'create'],
|
||||||
canAdd: true, canEdit: false, canDelete: true, hasRole: true,
|
canAdd: true, canEdit: false, canDelete: true, hasRole: true,
|
||||||
control: Backform.VariableCollectionControl, node: 'role'
|
control: Backform.VariableCollectionControl, node: 'role'
|
||||||
},{
|
},{
|
||||||
id: 'securities', label: '{{ _('Security Labels') }}', model: SecurityModel,
|
id: 'securities', label: '{{ _('Security Labels') }}',
|
||||||
|
model: pgBrowser.SecLabelModel,
|
||||||
editable: false, type: 'collection', canEdit: false,
|
editable: false, type: 'collection', canEdit: false,
|
||||||
group: '{{ _('Security') }}', canDelete: true,
|
group: '{{ _('Security') }}', canDelete: true,
|
||||||
mode: ['edit', 'create'], canAdd: true,
|
mode: ['edit', 'create'], canAdd: true,
|
||||||
@@ -321,25 +296,25 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
|
|||||||
type: 'nested', control: 'tab', group: '{{ _('Default Privileges') }}',
|
type: 'nested', control: 'tab', group: '{{ _('Default Privileges') }}',
|
||||||
mode: ['edit'],
|
mode: ['edit'],
|
||||||
schema:[{
|
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') }}',
|
{privileges: ['a', 'r', 'w', 'd', 'D', 'x', 't']}), label: '{{ _('Default Privileges: Tables') }}',
|
||||||
editable: false, type: 'collection', group: '{{ _('Tables') }}',
|
editable: false, type: 'collection', group: '{{ _('Tables') }}',
|
||||||
mode: ['edit', 'create'], control: 'unique-col-collection',
|
mode: ['edit', 'create'], control: 'unique-col-collection',
|
||||||
canAdd: true, canDelete: true, uniqueCol : ['grantee', 'grantor']
|
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') }}',
|
{privileges: ['r', 'w', 'U']}), label: '{{ _('Default Privileges: Sequences') }}',
|
||||||
editable: false, type: 'collection', group: '{{ _('Sequences') }}',
|
editable: false, type: 'collection', group: '{{ _('Sequences') }}',
|
||||||
mode: ['edit', 'create'], control: 'unique-col-collection',
|
mode: ['edit', 'create'], control: 'unique-col-collection',
|
||||||
canAdd: true, canDelete: true, uniqueCol : ['grantee', 'grantor']
|
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') }}',
|
{privileges: ['X']}), label: '{{ _('Default Privileges: Functions') }}',
|
||||||
editable: false, type: 'collection', group: '{{ _('Functions') }}',
|
editable: false, type: 'collection', group: '{{ _('Functions') }}',
|
||||||
mode: ['edit', 'create'], control: 'unique-col-collection',
|
mode: ['edit', 'create'], control: 'unique-col-collection',
|
||||||
canAdd: true, canDelete: true, uniqueCol : ['grantee', 'grantor']
|
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') }}',
|
{privileges: ['U']}), label: '{{ _('Default Privileges: Types') }}',
|
||||||
editable: false, type: 'collection', group: 'deftypesacl_group',
|
editable: false, type: 'collection', group: 'deftypesacl_group',
|
||||||
mode: ['edit', 'create'], control: 'unique-col-collection',
|
mode: ['edit', 'create'], control: 'unique-col-collection',
|
||||||
|
|||||||
@@ -26,12 +26,12 @@ ALTER DATABASE {{ conn|qtIdent(data.name) }} WITH CONNECTION LIMIT = {{ data.dat
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABEL.APPLY(conn, 'DATABASE', data.name, r.provider, r.security_label) }}
|
{{ SECLABEL.APPLY(conn, 'DATABASE', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABEL.APPLY(conn, 'DATABASE', data.name, r.provider, r.security_label) }}
|
{{ SECLABEL.APPLY(conn, 'DATABASE', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ COMMENT ON DATABASE {{ conn|qtIdent(data.name) }}
|
|||||||
{# Generate the security labels #}
|
{# Generate the security labels #}
|
||||||
{% if data.securities %}
|
{% if data.securities %}
|
||||||
{% for r in 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 %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{# Generate the variable/options #}
|
{# Generate the variable/options #}
|
||||||
|
|||||||
@@ -26,12 +26,12 @@ ALTER DATABASE {{ conn|qtIdent(data.name) }} WITH CONNECTION LIMIT = {{ data.dat
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
||||||
{% for r in seclabels.added %}
|
{% for r in seclabels.added %}
|
||||||
{{ SECLABEL.APPLY(conn, 'DATABASE', data.name, r.provider, r.security_label) }}
|
{{ SECLABEL.APPLY(conn, 'DATABASE', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
||||||
{% for r in seclabels.changed %}
|
{% for r in seclabels.changed %}
|
||||||
{{ SECLABEL.APPLY(conn, 'DATABASE', data.name, r.provider, r.security_label) }}
|
{{ SECLABEL.APPLY(conn, 'DATABASE', data.name, r.provider, r.label) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ COMMENT ON DATABASE {{ conn|qtIdent(data.name) }}
|
|||||||
{# Change the security labels #}
|
{# Change the security labels #}
|
||||||
{% if data.securities %}
|
{% if data.securities %}
|
||||||
{% for r in 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 %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{# Variables/options #}
|
{# 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