From da40573f0b4c104e17bbec89835449248fb0a260 Mon Sep 17 00:00:00 2001 From: Harshal Dhumal Date: Mon, 18 Sep 2017 11:45:57 +0100 Subject: [PATCH] Fix user manager role handling. Fixes #2641 --- .../static/js/user_management.js | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/web/pgadmin/tools/user_management/static/js/user_management.js b/web/pgadmin/tools/user_management/static/js/user_management.js index fffe7e237..bc88371c3 100644 --- a/web/pgadmin/tools/user_management/static/js/user_management.js +++ b/web/pgadmin/tools/user_management/static/js/user_management.js @@ -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([ ''].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) {