Fix user manager role handling. Fixes #2641

This commit is contained in:
Harshal Dhumal 2017-09-18 11:45:57 +01:00 committed by Dave Page
parent 765e130336
commit da40573f0b

View File

@ -96,7 +96,7 @@ define([
if(m instanceof Backbone.Collection) {
return true;
}
if (m.get("id") == userInfo['user_id']){
if (m.get("id") == userInfo['id']){
return false;
} else {
return true;
@ -110,7 +110,7 @@ define([
if(m instanceof Backbone.Collection) {
return true;
}
if (m.get("id") == userInfo['user_id']){
if (m.get("id") == userInfo['id']){
return false;
} else {
return true;
@ -283,7 +283,7 @@ define([
self = this;
e.preventDefault();
if (self.model.get("id") == userInfo['user_id']) {
if (self.model.get("id") == userInfo['id']) {
alertify.alert(
gettext('Cannot delete user.'),
gettext('Cannot delete currently logged in user.'),
@ -394,6 +394,15 @@ define([
footerTpl = _.template([
'<div class="pg-prop-footer">',
'<div class="pg-prop-status-bar" style="visibility:hidden">',
'<div class="media error-in-footer bg-red-1 border-red-2 font-red-3 text-14">',
'<div class="media-body media-middle">',
'<div class="alert-icon error-icon">',
'<i class="fa fa-exclamation-triangle" aria-hidden="true"></i>',
'</div>',
'<div class="alert-text">',
'</div>',
'</div>',
'</div>',
'</div>',
'</div>'].join("\n")),
$footer = $(footerTpl()),
@ -430,7 +439,8 @@ define([
self.on('pgadmin-session:model:invalid', function(msg, m, c) {
self.invalidUsers[m.cid] = msg;
m.trigger('pgadmin:user:invalid', m);
$statusBar.html(msg).css("visibility", "visible");
$statusBar.find('.alert-text').html(msg);
$statusBar.css("visibility", "visible");
});
self.on('pgadmin-session:model:valid', function(m, c) {
delete self.invalidUsers[m.cid];
@ -459,9 +469,11 @@ define([
}
if(msg){
$statusBar.html(msg).css("visibility", "visible");
$statusBar.find('.alert-text').html(msg);
$statusBar.css("visibility", "visible");
} else {
$statusBar.empty().css("visibility", "hidden");
$statusBar.find('.alert-text').empty();
$statusBar.css("visibility", "hidden");
}
},
saveUser: function(m) {