about summary refs log tree commit diff
path: root/migrations/auth/20250729_01_CNn2p-create-initial-system-wide-resources-access-privileges.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-07-29 09:43:33 -0500
committerFrederick Muriuki Muriithi2025-07-29 10:15:14 -0500
commit5c0b9077320d62ac26685dc37291c18d3670fb98 (patch)
treed3bd9a4d44803473fce41efab2c3facdb68a10ef /migrations/auth/20250729_01_CNn2p-create-initial-system-wide-resources-access-privileges.py
parent065d97043611b0892dc56b813db87d943c67ec7d (diff)
downloadgn-auth-5c0b9077320d62ac26685dc37291c18d3670fb98.tar.gz
Add system-wide resource-access privileges for system administrators
System administrators need to access, and modify the resources in the
system, and to do that, we need to grant them specific privileges to
check against.

These privileges act on the wrapper resource objects, not necessarily
the data attached to the resource object.
Diffstat (limited to 'migrations/auth/20250729_01_CNn2p-create-initial-system-wide-resources-access-privileges.py')
-rw-r--r--migrations/auth/20250729_01_CNn2p-create-initial-system-wide-resources-access-privileges.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/migrations/auth/20250729_01_CNn2p-create-initial-system-wide-resources-access-privileges.py b/migrations/auth/20250729_01_CNn2p-create-initial-system-wide-resources-access-privileges.py
new file mode 100644
index 0000000..be0d022
--- /dev/null
+++ b/migrations/auth/20250729_01_CNn2p-create-initial-system-wide-resources-access-privileges.py
@@ -0,0 +1,31 @@
+"""
+Create initial system-wide resources access privileges
+"""
+
+from yoyo import step
+
+__depends__ = {'20250722_02_M8TXv-add-system-user-edit-privilege-to-system-admin-role'}
+
+steps = [
+    step(
+        """
+        INSERT INTO privileges(privilege_id, privilege_description)
+        VALUES
+          ("system:resource:view",
+           "View the wrapper resource object (not attached data). This is mostly for administration purposes."),
+          ("system:resource:edit",
+           "Edit/update the wrapper resource object (not attached data). This is mostly for administration purposes."),
+          ("system:resource:delete",
+           "Delete the wrapper resource object (not attached data). This is mostly for administration purposes."),
+          ("system:resource:reassign-group",
+           "Reassign the resource, and its data, to a different user group."),
+          ("system:resource:assign-owner",
+           "Assign ownership of any resource to any user.")
+        """,
+        """
+        DELETE FROM privileges WHERE privilege_id IN
+          ("system:resource:view", "system:resource:edit",
+           "system:resource:delete", "system:resource:reassign-group",
+           "system:resource:assign-owner")
+        """)
+]