diff options
author | zsloan | 2021-10-12 16:08:54 -0500 |
---|---|---|
committer | GitHub | 2021-10-12 16:08:54 -0500 |
commit | 35105c816726b58dc376b2c3925d48077aeca675 (patch) | |
tree | a7d184e4eea8aeb4b9bf0d17468ba6a1efafef46 /scripts/authentication/resource.py | |
parent | 70023c835bdeeffc48efafe96626ac5b01b5a6d2 (diff) | |
parent | a212ad123f902b6a9c74bcac1d98bc274cebbdda (diff) | |
download | genenetwork2-35105c816726b58dc376b2c3925d48077aeca675.tar.gz |
Merge branch 'testing' into feature/add_resizeable_columns
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)) |