Fixes #1273 - Resolved an issue setting privileges on the SHELL type.
parent
6501f4cf36
commit
6dbfb7db7e
|
@ -180,15 +180,22 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
||||||
// Clearing previous errors first.
|
// Clearing previous errors first.
|
||||||
this.errorModel.clear();
|
this.errorModel.clear();
|
||||||
// Validation for member name
|
// Validation for member name
|
||||||
if ( _.has(changedAttrs, 'member_name') && _.isUndefined(this.get('member_name')) ||
|
if ( _.isUndefined(this.get('member_name')) ||
|
||||||
_.isNull(this.get('member_name')) ||
|
_.isNull(this.get('member_name')) ||
|
||||||
String(this.get('member_name')).replace(/^\s+|\s+$/g, '') == '') {
|
String(this.get('member_name')).replace(/^\s+|\s+$/g, '') == '') {
|
||||||
errmsg = '{{ _('Please specify the value for member name.') }}';
|
errmsg = '{{ _('Please specify the value for member name.') }}';
|
||||||
this.errorModel.set('member_name', errmsg)
|
this.errorModel.set('member_name', errmsg)
|
||||||
return errmsg;
|
return errmsg;
|
||||||
}
|
}
|
||||||
|
else if ( _.isUndefined(this.get('type')) ||
|
||||||
|
_.isNull(this.get('type')) ||
|
||||||
|
String(this.get('type')).replace(/^\s+|\s+$/g, '') == '') {
|
||||||
|
errmsg = '{{ _('Please specify the type.') }}';
|
||||||
|
this.errorModel.set('type', errmsg)
|
||||||
|
return errmsg;
|
||||||
|
}
|
||||||
// Validation for Length/precision field (see comments above if confused about the naming!)
|
// Validation for Length/precision field (see comments above if confused about the naming!)
|
||||||
else if (_.has(changedAttrs, 'tlength') && this.get('is_tlength')
|
else if (this.get('is_tlength')
|
||||||
&& !_.isUndefined(this.get('tlength'))) {
|
&& !_.isUndefined(this.get('tlength'))) {
|
||||||
if (this.get('tlength') < this.get('min_val'))
|
if (this.get('tlength') < this.get('min_val'))
|
||||||
errmsg = '{{ _('Length/precision should not be less than ') }}' + this.get('min_val');
|
errmsg = '{{ _('Length/precision should not be less than ') }}' + this.get('min_val');
|
||||||
|
@ -201,7 +208,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Validation for scale field (see comments above if confused about the naming!)
|
// Validation for scale field (see comments above if confused about the naming!)
|
||||||
else if (_.has(changedAttrs, 'precision') && this.get('is_precision')
|
else if (this.get('is_precision')
|
||||||
&& !_.isUndefined(this.get('precision'))) {
|
&& !_.isUndefined(this.get('precision'))) {
|
||||||
if (this.get('precision') < this.get('min_val'))
|
if (this.get('precision') < this.get('min_val'))
|
||||||
errmsg = '{{ _('Scale should not be less than ') }}' + this.get('min_val');
|
errmsg = '{{ _('Scale should not be less than ') }}' + this.get('min_val');
|
||||||
|
@ -757,6 +764,12 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
||||||
uniqueCol : ['grantee'], deps: ['typtype'],
|
uniqueCol : ['grantee'], 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
|
||||||
|
// Clear acl & security label collections as well
|
||||||
|
if (m.get('typtype') === 'p') {
|
||||||
|
var acl = m.get('typacl');
|
||||||
|
if(acl.length > 0)
|
||||||
|
acl.reset();
|
||||||
|
}
|
||||||
return !(m.get('typtype') === 'p');
|
return !(m.get('typtype') === 'p');
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
|
@ -767,6 +780,12 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
||||||
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
|
||||||
|
// Clear acl & security label collections as well
|
||||||
|
if (m.get('typtype') === 'p') {
|
||||||
|
var secLabs = m.get('seclabels');
|
||||||
|
if(secLabs.length > 0)
|
||||||
|
secLabs.reset();
|
||||||
|
}
|
||||||
return !(m.get('typtype') === 'p');
|
return !(m.get('typtype') === 'p');
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
|
@ -811,7 +830,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
||||||
msg = '{{ _('Output function can not be empty.') }}';
|
msg = '{{ _('Output function can not be empty.') }}';
|
||||||
this.errorModel.set('typoutput', msg);
|
this.errorModel.set('typoutput', msg);
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
|
return msg ? msg : null;
|
||||||
},
|
},
|
||||||
// We will disable everything if we are under catalog node
|
// We will disable everything if we are under catalog node
|
||||||
inSchema: function() {
|
inSchema: function() {
|
||||||
|
|
|
@ -254,6 +254,11 @@
|
||||||
|
|
||||||
var privileges = [];
|
var privileges = [];
|
||||||
|
|
||||||
|
if (this.attributes &&
|
||||||
|
this.attributes['privileges']) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
this.attributes['privileges'].each(
|
this.attributes['privileges'].each(
|
||||||
function(p) {
|
function(p) {
|
||||||
if (p.get('privilege')) {
|
if (p.get('privilege')) {
|
||||||
|
@ -282,20 +287,24 @@
|
||||||
this.errorModel.unset('grantee');
|
this.errorModel.unset('grantee');
|
||||||
}
|
}
|
||||||
|
|
||||||
var anyPrivSelected = false;
|
|
||||||
this.attributes['privileges'].each(
|
|
||||||
function(p) {
|
|
||||||
if (p.get('privilege')) {
|
|
||||||
anyPrivSelected = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!anyPrivSelected) {
|
if (this.attributes &&
|
||||||
msg = window.pgAdmin.Browser.messages.NO_PRIV_SELECTED;
|
this.attributes['privileges']) {
|
||||||
this.errorModel.set('privileges', msg);
|
var anyPrivSelected = false;
|
||||||
errmsg = errmsg || msg;
|
this.attributes['privileges'].each(
|
||||||
} else {
|
function(p) {
|
||||||
this.errorModel.unset('privileges');
|
if (p.get('privilege')) {
|
||||||
|
anyPrivSelected = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!anyPrivSelected) {
|
||||||
|
msg = window.pgAdmin.Browser.messages.NO_PRIV_SELECTED;
|
||||||
|
this.errorModel.set('privileges', msg);
|
||||||
|
errmsg = errmsg || msg;
|
||||||
|
} else {
|
||||||
|
this.errorModel.unset('privileges');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return errmsg;
|
return errmsg;
|
||||||
|
|
Loading…
Reference in New Issue