aboutsummaryrefslogtreecommitdiff
path: root/scripts/authentication/resource.py
diff options
context:
space:
mode:
authorzsloan2022-01-14 18:22:32 +0000
committerzsloan2022-01-14 18:22:32 +0000
commit68ac19153b128f60b660e11365e5fd4304c95300 (patch)
tree198e03522af43a2d41f3c02cf3785bcfd4635fc4 /scripts/authentication/resource.py
parentf588ad96ae5045499860fa6e2740e101ad4410d7 (diff)
parent9ab0c3b6cc146e1711f1478242d4198eed720e4c (diff)
downloadgenenetwork2-68ac19153b128f60b660e11365e5fd4304c95300.tar.gz
Merge branch 'testing' of github.com:genenetwork/genenetwork2 into feature/add_rqtl_pairscan
Diffstat (limited to 'scripts/authentication/resource.py')
-rwxr-xr-x[-rw-r--r--]scripts/authentication/resource.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/scripts/authentication/resource.py b/scripts/authentication/resource.py
index 4996f34c..4b8d801a 100644..100755
--- a/scripts/authentication/resource.py
+++ b/scripts/authentication/resource.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python3
"""A script that:
- Optionally restores data from a json file.
@@ -37,14 +38,14 @@ from datetime import datetime
def recover_hash(name: str, file_path: str, set_function) -> bool:
"""Recover back-ups using the `set_function`
- Parameters:
+ Args:
+ - name: Redis hash where `file_path` will be restored
+ - file_path: File path where redis hash is sourced from
+ - set_function: Function used to do the Redis backup for
+ example: HSET
- - `name`: Redis hash where `file_path` will be restored
-
- - `file_path`: File path where redis hash is sourced from
-
- - `set_function`: Function used to do the Redis backup for
- example: HSET
+ Returns:
+ A boolean indicating whether the function ran successfully.
"""
try:
@@ -97,7 +98,8 @@ if __name__ == "__main__":
for resource_id, resource in RESOURCES.items():
_resource = json.loads(resource) # str -> dict conversion
_resource["group_masks"] = {args.group_id: {"metadata": "edit",
- "data": "edit"}}
+ "data": "edit",
+ "admin": "not-admin"}}
REDIS_CONN.hset("resources",
resource_id,
json.dumps(_resource))