aboutsummaryrefslogtreecommitdiff
path: root/scripts/authentication
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/authentication')
-rw-r--r--scripts/authentication/resource.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/authentication/resource.py b/scripts/authentication/resource.py
new file mode 100644
index 00000000..75ef9e93
--- /dev/null
+++ b/scripts/authentication/resource.py
@@ -0,0 +1,25 @@
+"""A script that adds the group: 'editors' to every
+resource. 'editors' should have the right to edit both metadata and
+data.
+
+To use this script, simply run:
+
+.. code-block:: python
+ python resource.py
+
+"""
+import json
+import redis
+
+
+if __name__ == "__main__":
+ REDIS_CONN = redis.Redis()
+ resources = REDIS_CONN.hgetall("resources_clone")
+ for resource_id, resource in resources.items():
+ deserialized_resource = json.loads(resource)
+ deserialized_resource["group_masks"] = {
+ "editors": {"metadata": "edit",
+ "data": "edit"}}
+ REDIS_CONN.hset("resources_clone",
+ resource_id,
+ json.dumps(deserialized_resource))