mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-09-03 20:52:57 -05:00
Adding validation for the previleges control.
This commit is contained in:
committed by
Ashesh Vashi
parent
dc51baefcc
commit
a02b1a4813
@@ -177,6 +177,22 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
validate: function() {
|
validate: function() {
|
||||||
|
var err = {},
|
||||||
|
errmsg = null,
|
||||||
|
changedAttrs = this.sessAttrs,
|
||||||
|
msg = undefined;
|
||||||
|
// We will throw error if user have not entered
|
||||||
|
// either grantee or privileges
|
||||||
|
if (_.has(changedAttrs, 'grantor')) {
|
||||||
|
if (_.isUndefined(this.get('grantee')) ||
|
||||||
|
this.get('privileges').length == 0) {
|
||||||
|
errmsg = 'Please specify grantee/privileges';
|
||||||
|
this.errorModel.set('grantee', errmsg);
|
||||||
|
return errmsg;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.errorModel.unset('grantee');
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user