diff options
author | crupest <crupest@outlook.com> | 2020-01-29 23:13:15 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-01-29 23:13:15 +0800 |
commit | abde51b167f17301c25e32ae247e7909c0dc9367 (patch) | |
tree | c9131a7b95fffd64bf2c26527d7f62fbdefa7e2c /Timeline/Models/UserRoleConvert.cs | |
parent | 81c261b59016e15d320ad963882afe4d9c7b5f7d (diff) | |
download | timeline-abde51b167f17301c25e32ae247e7909c0dc9367.tar.gz timeline-abde51b167f17301c25e32ae247e7909c0dc9367.tar.bz2 timeline-abde51b167f17301c25e32ae247e7909c0dc9367.zip |
...
Diffstat (limited to 'Timeline/Models/UserRoleConvert.cs')
-rw-r--r-- | Timeline/Models/UserRoleConvert.cs | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/Timeline/Models/UserRoleConvert.cs b/Timeline/Models/UserRoleConvert.cs deleted file mode 100644 index ade9a799..00000000 --- a/Timeline/Models/UserRoleConvert.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System;
-using System.Collections.Generic;
-using System.Linq;
-using Timeline.Entities;
-
-namespace Timeline.Models
-{
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1062:Validate arguments of public methods", Justification = "No need.")]
- public static class UserRoleConvert
- {
- public const string UserRole = UserRoles.User;
- public const string AdminRole = UserRoles.Admin;
-
- public static string[] ToArray(bool administrator)
- {
- return administrator ? new string[] { UserRole, AdminRole } : new string[] { UserRole };
- }
-
- public static string[] ToArray(string s)
- {
- return s.Split(',').ToArray();
- }
-
- public static bool ToBool(IReadOnlyCollection<string> roles)
- {
- return roles.Contains(AdminRole);
- }
-
- public static string ToString(IReadOnlyCollection<string> roles)
- {
- return string.Join(',', roles);
- }
-
- public static string ToString(bool administrator)
- {
- return administrator ? UserRole + "," + AdminRole : UserRole;
- }
-
- public static bool ToBool(string s)
- {
- return s.Contains("admin", StringComparison.InvariantCulture);
- }
- }
-}
|