mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Update "parse_priv_to_db" function to return list a instead of a string.
This will also allow us to operate on individual privileges & also we
needed this functionality for column nodes.
For example,
*Earlier:* priv was string
GRANT {{ priv }} ON {{ type }} TO {{ conn|qtIdent(role) }};
*Now:* priv will be List, which we need to handle in jinja templates.
GRANT *{{ priv|join(', ') }}* ON {{ type }} TO {{ conn|qtIdent(role) }};
This commit is contained in:
committed by
Dave Page
parent
5d6c5bc74d
commit
8a7ec6b452
@@ -75,12 +75,12 @@ def parse_priv_to_db(str_privileges, allowed_acls = []):
|
||||
priv_without_grant.append(
|
||||
db_privileges[privilege['privilege_type']]
|
||||
)
|
||||
|
||||
priv_with_grant = ", ".join(priv_with_grant) \
|
||||
if len(priv_with_grant) < allowed_acls_len else 'ALL'
|
||||
priv_without_grant = ", ".join(priv_without_grant) \
|
||||
if len(priv_without_grant) < allowed_acls_len else 'ALL'
|
||||
|
||||
# If we have all acl then just return all
|
||||
if len(priv_with_grant) == allowed_acls_len:
|
||||
priv_with_grant = ['ALL']
|
||||
if len(priv_without_grant) == allowed_acls_len:
|
||||
priv_without_grant = ['ALL']
|
||||
# Appending and returning all ACL
|
||||
privileges.append({
|
||||
'grantee': priv['grantee'],
|
||||
'with_grant': priv_with_grant,
|
||||
|
||||
Reference in New Issue
Block a user