diff options
author | zsloan | 2021-10-05 16:41:13 -0500 |
---|---|---|
committer | GitHub | 2021-10-05 16:41:13 -0500 |
commit | 70023c835bdeeffc48efafe96626ac5b01b5a6d2 (patch) | |
tree | 5e23e1139d2e01e2ad42969f58d148132db963a7 /wqflask/utility/redis_tools.py | |
parent | de79d0d5087bf97f59a16327132fd287d57e1c3f (diff) | |
parent | 4c6a7e46dd7afe311c0bed38c4a69ddadf3cb416 (diff) | |
download | genenetwork2-70023c835bdeeffc48efafe96626ac5b01b5a6d2.tar.gz |
Merge branch 'testing' into feature/add_resizeable_columns
Diffstat (limited to 'wqflask/utility/redis_tools.py')
-rw-r--r-- | wqflask/utility/redis_tools.py | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/wqflask/utility/redis_tools.py b/wqflask/utility/redis_tools.py index ff125bd2..de9dde46 100644 --- a/wqflask/utility/redis_tools.py +++ b/wqflask/utility/redis_tools.py @@ -127,22 +127,20 @@ def check_verification_code(code): def get_user_groups(user_id): - # ZS: Get the groups where a user is an admin or a member and + # Get the groups where a user is an admin or a member and # return lists corresponding to those two sets of groups - admin_group_ids = [] # ZS: Group IDs where user is an admin - user_group_ids = [] # ZS: Group IDs where user is a regular user + admin_group_ids = [] # Group IDs where user is an admin + user_group_ids = [] # Group IDs where user is a regular user groups_list = Redis.hgetall("groups") - for key in groups_list: + for group_id, group_details in groups_list.items(): try: - group_ob = json.loads(groups_list[key]) - group_admins = set([this_admin.encode( - 'utf-8') if this_admin else None for this_admin in group_ob['admins']]) - group_members = set([this_member.encode( - 'utf-8') if this_member else None for this_member in group_ob['members']]) + _details = json.loads(group_details) + group_admins = set([this_admin if this_admin else None for this_admin in _details['admins']]) + group_members = set([this_member if this_member else None for this_member in _details['members']]) if user_id in group_admins: - admin_group_ids.append(group_ob['id']) + admin_group_ids.append(group_id) elif user_id in group_members: - user_group_ids.append(group_ob['id']) + user_group_ids.append(group_id) else: continue except: |