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:
Murtuza Zabuawala
2016-03-09 17:10:03 +00:00
committed by Dave Page
parent 5d6c5bc74d
commit 8a7ec6b452
3 changed files with 21 additions and 21 deletions

View File

@@ -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,