public inbox for [email protected]  
help / color / mirror / Atom feed
[pgadmin4] fix for RM1417
2+ messages / 2 participants
[nested] [flat]

* [pgadmin4] fix for RM1417
@ 2016-08-08 14:59 Harshal Dhumal <[email protected]>
  2016-08-08 15:32 ` Re: [pgadmin4] fix for RM1417 Dave Page <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Harshal Dhumal @ 2016-08-08 14:59 UTC (permalink / raw)
  To: pgadmin-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:


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [pgadmin4] fix for RM1417
  2016-08-08 14:59 [pgadmin4] fix for RM1417 Harshal Dhumal <[email protected]>
@ 2016-08-08 15:32 ` Dave Page <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Dave Page @ 2016-08-08 15:32 UTC (permalink / raw)
  To: Harshal Dhumal <[email protected]>; +Cc: pgadmin-hackers

Thanks - patch applied.

On Mon, Aug 8, 2016 at 3:59 PM, Harshal Dhumal
<[email protected]> wrote:
> 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
>



-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: 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




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-08-08 15:32 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-08-08 14:59 [pgadmin4] fix for RM1417 Harshal Dhumal <[email protected]>
2016-08-08 15:32 ` Dave Page <[email protected]>

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