admin: do not add int variants of roles in SQL mode (#6283)
This commit is contained in:
parent
9385ba2faa
commit
1e2ecdbe4e
|
@ -343,12 +343,15 @@ class UsersDirectory(Directory):
|
|||
other_roles = [str(x) for x in checked_roles if x not in ('admin', 'none')]
|
||||
if other_roles:
|
||||
other_roles_set = set(other_roles)
|
||||
# duplicate all roles as they may be also stored as integers
|
||||
for other_role in other_roles:
|
||||
try:
|
||||
other_roles_set.add(int(other_role))
|
||||
except ValueError:
|
||||
continue
|
||||
if not (get_publisher().has_site_option('postgresql') and
|
||||
get_cfg('postgresql', {})):
|
||||
# with pickle storage we have to duplicate all roles as
|
||||
# they may have been stored as integers
|
||||
for other_role in other_roles:
|
||||
try:
|
||||
other_roles_set.add(int(other_role))
|
||||
except ValueError:
|
||||
continue
|
||||
criterias.append(st.Intersects('roles', other_roles_set))
|
||||
criterias = [st.Or(criterias)]
|
||||
|
||||
|
|
Loading…
Reference in New Issue