public inbox for [email protected]  
help / color / mirror / Atom feed
From: Harshal Dhumal <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgadmin4] fix for RM1417
Date: Mon, 8 Aug 2016 20:29:21 +0530
Message-ID: <CAFiP3vx3Ge-XRo-4p3kfAAxxYtAw2NUYdj=_7tMKS66KDtDE3g@mail.gmail.com> (raw)
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-hackers>

Hi,

PFA patch for issue RM1417.

Changes: Fixed privileges parsing issue while editing privileges of exiting
object.

Additional Note: This was general issue and was not related to runtime or
pg 9.6.



-- 
*Harshal Dhumal*
*Software Engineer*

EnterpriseDB India: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Attachments:

  [text/x-patch] RM1417.patch (1.7K, 3-RM1417.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/static/js/privilege.js b/web/pgadmin/browser/server_groups/servers/static/js/privilege.js
index 70246f6..418122e 100644
--- a/web/pgadmin/browser/server_groups/servers/static/js/privilege.js
+++ b/web/pgadmin/browser/server_groups/servers/static/js/privilege.js
@@ -58,6 +58,7 @@
    *  + privileges - Privileges for that role.
    **/
   var PrivilegeRoleModel = pgNode.PrivilegeRoleModel = pgNode.Model.extend({
+    idAttribute: 'grantee',
     defaults: {
       grantee: undefined,
       grantor: undefined,
diff --git a/web/pgadmin/browser/server_groups/servers/utils.py b/web/pgadmin/browser/server_groups/servers/utils.py
index 356b808..4aa04ea 100644
--- a/web/pgadmin/browser/server_groups/servers/utils.py
+++ b/web/pgadmin/browser/server_groups/servers/utils.py
@@ -63,6 +63,24 @@ def parse_priv_to_db(str_privileges, allowed_acls=[]):
         priv_with_grant = []
         priv_without_grant = []
 
+        if isinstance(priv['privileges'], dict) and 'changed' in priv['privileges']:
+            tmp = []
+            for p in priv['privileges']['changed']:
+                tmp_p = {'privilege_type': p['privilege_type'],
+                         'privilege': False,
+                         'with_grant': False}
+
+                if 'with_grant' in p:
+                    tmp_p['privilege'] = True
+                    tmp_p['with_grant'] = p['with_grant']
+
+                if 'privilege' in p:
+                    tmp_p['privilege'] = p['privilege']
+
+                tmp.append(tmp_p)
+
+            priv['privileges'] = tmp
+
         for privilege in priv['privileges']:
 
             if privilege['privilege_type'] not in db_privileges:


view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [pgadmin4] fix for RM1417
  In-Reply-To: <CAFiP3vx3Ge-XRo-4p3kfAAxxYtAw2NUYdj=_7tMKS66KDtDE3g@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox