diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-12-21 23:37:23 +0100 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-12-21 23:37:23 +0100 |
| commit | 82ade3c31fb17b662feec59e9e654ceb66edbb7a (patch) | |
| tree | 26443c41c55d2cd2ae46fdd0d663aca84b779ffe /code/api/Enums | |
| parent | e60703aadca7d423c0fbfb189d5ef439fc1df072 (diff) | |
| download | storage-82ade3c31fb17b662feec59e9e654ceb66edbb7a.tar.xz storage-82ade3c31fb17b662feec59e9e654ceb66edbb7a.zip | |
feat: Add initial schema and start login
Diffstat (limited to 'code/api/Enums')
| -rw-r--r-- | code/api/Enums/EUserRole.cs | 22 |
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 |
