diff options
author | Frederick Muriuki Muriithi | 2021-10-12 14:34:38 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2021-10-12 14:34:38 +0300 |
commit | bfb9d00aabd140cd30ffd0d586464f2341550f6c (patch) | |
tree | 3c999a8761e25457be432d0a036974c88fac47ad /scripts/authentication/resource.py | |
parent | 8153dd9cf423ffbd81e48fbd1a39b265fe819c08 (diff) | |
parent | 9b28d111ad156f3862286e88bc220e02d5e1312b (diff) | |
download | genenetwork2-bfb9d00aabd140cd30ffd0d586464f2341550f6c.tar.gz |
Merge branch 'testing' of github.com:genenetwork/genenetwork2 into clustered_heatmaps
Diffstat (limited to 'scripts/authentication/resource.py')
-rw-r--r-- | scripts/authentication/resource.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/authentication/resource.py b/scripts/authentication/resource.py index 8fcf09d7..4996f34c 100644 --- a/scripts/authentication/resource.py +++ b/scripts/authentication/resource.py @@ -63,12 +63,16 @@ def recover_hash(name: str, file_path: str, set_function) -> bool: if __name__ == "__main__": # Initialising the parser CLI arguments parser = argparse.ArgumentParser() + parser.add_argument("--group-id", + help="Add the group id to all resources") parser.add_argument("--restore", help="Restore from a given backup") parser.add_argument("--enable-backup", action="store_true", help="Create a back up before edits") args = parser.parse_args() + if not args.group_id: + exit("Please specify the group-id!\n") if args.restore: if recover_hash(name="resources", file_path=args.back_up, @@ -92,8 +96,8 @@ if __name__ == "__main__": for resource_id, resource in RESOURCES.items(): _resource = json.loads(resource) # str -> dict conversion - _resource["group_masks"] = {"editors": {"metadata": "edit", - "data": "edit"}} + _resource["group_masks"] = {args.group_id: {"metadata": "edit", + "data": "edit"}} REDIS_CONN.hset("resources", resource_id, json.dumps(_resource)) |