Fix for single role_attr
This commit is contained in:
parent
7dd2859f9b
commit
2a794fa776
1 changed files with 5 additions and 3 deletions
|
@ -400,8 +400,10 @@ def parse_role_attrs(role_attr_flags):
|
||||||
"""
|
"""
|
||||||
if ',' in role_attr_flags:
|
if ',' in role_attr_flags:
|
||||||
flag_set = frozenset(r.upper() for r in role_attr_flags.split(","))
|
flag_set = frozenset(r.upper() for r in role_attr_flags.split(","))
|
||||||
|
elif role_attr_flags:
|
||||||
|
flag_set = frozenset((role_attr_flags.upper(),))
|
||||||
else:
|
else:
|
||||||
flag_set = frozenset(role_attr_flags.upper())
|
flag_set = frozenset()
|
||||||
if not flag_set.issubset(VALID_FLAGS):
|
if not flag_set.issubset(VALID_FLAGS):
|
||||||
raise InvalidFlagsError('Invalid role_attr_flags specified: %s' %
|
raise InvalidFlagsError('Invalid role_attr_flags specified: %s' %
|
||||||
' '.join(flag_set.difference(VALID_FLAGS)))
|
' '.join(flag_set.difference(VALID_FLAGS)))
|
||||||
|
@ -431,11 +433,11 @@ def parse_privs(privs, db):
|
||||||
if ':' not in token:
|
if ':' not in token:
|
||||||
type_ = 'database'
|
type_ = 'database'
|
||||||
name = db
|
name = db
|
||||||
priv_set = frozenset(x.strip().upper() for x in token.split(','))
|
priv_set = frozenset(x.strip().upper() for x in token.split(',') if x.strip())
|
||||||
else:
|
else:
|
||||||
type_ = 'table'
|
type_ = 'table'
|
||||||
name, privileges = token.split(':', 1)
|
name, privileges = token.split(':', 1)
|
||||||
priv_set = frozenset(x.strip().upper() for x in privileges.split(','))
|
priv_set = frozenset(x.strip().upper() for x in privileges.split(',') if x.strip())
|
||||||
|
|
||||||
if not priv_set.issubset(VALID_PRIVS[type_]):
|
if not priv_set.issubset(VALID_PRIVS[type_]):
|
||||||
raise InvalidPrivsError('Invalid privs specified for %s: %s' %
|
raise InvalidPrivsError('Invalid privs specified for %s: %s' %
|
||||||
|
|
Loading…
Reference in a new issue