Adding validation for the previleges control.

This commit is contained in:
Murtuza Zabuawala 2016-02-10 13:01:14 +05:30 committed by Ashesh Vashi
parent dc51baefcc
commit a02b1a4813

View File

@ -177,6 +177,22 @@
},
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;
}
});