mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed privileges parsing issue while editing privileges of existing object. Fixes #1417
This commit is contained in:
parent
a025c0ebf0
commit
8918b8894d
@ -58,6 +58,7 @@
|
||||
* + privileges - Privileges for that role.
|
||||
**/
|
||||
var PrivilegeRoleModel = pgNode.PrivilegeRoleModel = pgNode.Model.extend({
|
||||
idAttribute: 'grantee',
|
||||
defaults: {
|
||||
grantee: undefined,
|
||||
grantor: undefined,
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user