~jan0sch/smederee

Showing details for patch 224eb5b36f2104130bef70d38cc8e62eab3780d0.
2024-07-14 (Sun), 2:39 PM - Jens Grassel - 224eb5b36f2104130bef70d38cc8e62eab3780d0

security: refactor permission model

- rename `Execute` to `Manage`
- adjust documentation for rights/permissions of each case
Summary of changes
1 files modified with 7 lines added and 7 lines removed
  • modules/security/src/main/scala/de/smederee/security/Permission.scala with 7 added and 7 removed lines
diff -rN -u old-smederee/modules/security/src/main/scala/de/smederee/security/Permission.scala new-smederee/modules/security/src/main/scala/de/smederee/security/Permission.scala
--- old-smederee/modules/security/src/main/scala/de/smederee/security/Permission.scala	2025-01-11 03:11:25.036548880 +0000
+++ new-smederee/modules/security/src/main/scala/de/smederee/security/Permission.scala	2025-01-11 03:11:25.036548880 +0000
@@ -18,13 +18,13 @@
   */
 enum Permission(val encoded: Int) {
 
-    /** Allow executing tasks related to the data e.g. start build pipeline. */
-    case Execute extends Permission(encoded = 1)
+    /** Allow managing a resource (project or organisation settings) and delete it. */
+    case Manage extends Permission(encoded = 1)
 
     /** Allow reading data (non modifying operations) e.g. view a repository or organisation. */
     case Read extends Permission(encoded = 4)
 
-    /** Allow writing data including deletion e.g. push commits, delete a project or modify an organisation. */
+    /** Allow writing data e.g. push commits or modify tickets. */
     case Write extends Permission(encoded = 2)
 }
 
@@ -42,13 +42,13 @@
     def decode(encoded: Int): Set[Permission] =
         encoded match {
             case 0 => Set.empty
-            case 1 => Set(Execute)
+            case 1 => Set(Manage)
             case 2 => Set(Write)
-            case 3 => Set(Execute, Write)
+            case 3 => Set(Manage, Write)
             case 4 => Set(Read)
-            case 5 => Set(Execute, Read)
+            case 5 => Set(Manage, Read)
             case 6 => Set(Read, Write)
-            case 7 => Set(Execute, Read, Write)
+            case 7 => Set(Manage, Read, Write)
             case _ => Set.empty // We return an empty set for illegal values!
         }