diff options
author | Frederick Muriuki Muriithi | 2021-10-06 18:25:12 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2021-10-06 18:25:12 +0300 |
commit | 8153dd9cf423ffbd81e48fbd1a39b265fe819c08 (patch) | |
tree | dde4ccd73292b2eec9f38d2b2ac5793e27abc5b7 /wqflask/utility/redis_tools.py | |
parent | a99bd2cef7fda9b6ec44d49f9f12aa040ca55136 (diff) | |
parent | 7a15d24a6598f30801dd897ddc72d3773641e7bd (diff) | |
download | genenetwork2-8153dd9cf423ffbd81e48fbd1a39b265fe819c08.tar.gz |
Merge branch 'testing' of github.com:genenetwork/genenetwork2 into clustered_heatmaps
Diffstat (limited to 'wqflask/utility/redis_tools.py')
-rw-r--r-- | wqflask/utility/redis_tools.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/wqflask/utility/redis_tools.py b/wqflask/utility/redis_tools.py index 99295c67..de9dde46 100644 --- a/wqflask/utility/redis_tools.py +++ b/wqflask/utility/redis_tools.py @@ -127,20 +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 if this_admin else None for this_admin in group_ob['admins']]) - group_members = set([this_member 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: |