aboutsummaryrefslogtreecommitdiffstats
path: root/code/api/Enums/EUserRole.cs
diff options
context:
space:
mode:
Diffstat (limited to 'code/api/Enums/EUserRole.cs')
-rw-r--r--code/api/Enums/EUserRole.cs22
1 files changed, 22 insertions, 0 deletions
diff --git a/code/api/Enums/EUserRole.cs b/code/api/Enums/EUserRole.cs
new file mode 100644
index 0000000..75a81b3
--- /dev/null
+++ b/code/api/Enums/EUserRole.cs
@@ -0,0 +1,22 @@
+namespace I2R.Storage.Api.Enums;
+
+public enum EUserRole
+{
+ LEAST_PRIVILEGED = 0,
+ ADMIN = 1,
+}
+
+public static class UserRole
+{
+ public static EUserRole FromString(string role) => role switch {
+ "least_privileged" => EUserRole.LEAST_PRIVILEGED,
+ "admin" => EUserRole.ADMIN,
+ _ => throw new ArgumentOutOfRangeException(nameof(role), role, null)
+ };
+
+ public static string ToString(EUserRole role) => role switch {
+ EUserRole.LEAST_PRIVILEGED => "least_privileged",
+ EUserRole.ADMIN => "admin",
+ _ => throw new ArgumentOutOfRangeException(nameof(role), role, null)
+ };
+} \ No newline at end of file