-
Notifications
You must be signed in to change notification settings - Fork 30
/
RoleNames.cs
159 lines (123 loc) · 4.33 KB
/
RoleNames.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace GoNorth
{
/// <summary>
/// Role Names
/// </summary>
public class RoleNames
{
/// <summary>
/// Administrator role
/// </summary>
public const string Administrator = "Administrator";
/// <summary>
/// Task role
/// </summary>
public const string Task = "Task";
/// <summary>
/// Task Management Board role
/// </summary>
public const string TaskBoardManager = "TaskBoardManager";
/// <summary>
/// Task Board Category Management role
/// </summary>
public const string TaskBoardCategoryManager = "TaskBoardCategoryManager";
/// <summary>
/// Task Type Manager role
/// </summary>
public const string TaskTypeManager = "TaskTypeManager";
/// <summary>
/// Kortisto role
/// </summary>
public const string Kortisto = "Kortisto";
/// <summary>
/// Kortisto template manager role
/// </summary>
public const string KortistoTemplateManager = "KortistoTemplateManager";
/// <summary>
/// Kortisto player manager role
/// </summary>
public const string KortistoPlayerManager = "KortistoPlayerManager";
/// <summary>
/// Styr role
/// </summary>
public const string Styr = "Styr";
/// <summary>
/// Styr template manager role
/// </summary>
public const string StyrTemplateManager = "StyrTemplateManager";
/// <summary>
/// Evne role
/// </summary>
public const string Evne = "Evne";
/// <summary>
/// Evne template manager role
/// </summary>
public const string EvneTemplateManager = "EvneTemplateManager";
/// <summary>
/// Kirja role
/// </summary>
public const string Kirja = "Kirja";
/// <summary>
/// Karta role
/// </summary>
public const string Karta = "Karta";
/// <summary>
/// Karta map manager role
/// </summary>
public const string KartaMapManager = "KartaMapManager";
/// <summary>
/// Tale role
/// </summary>
public const string Tale = "Tale";
/// <summary>
/// Aika role
/// </summary>
public const string Aika = "Aika";
/// <summary>
/// Implementation status tracker role
/// </summary>
public const string ImplementationStatusTracker = "ImplementationStatusTracker";
/// <summary>
/// Export Objects
/// </summary>
public const string ExportObjects = "ExportObjects";
/// <summary>
/// Manage Export Templates
/// </summary>
public const string ManageExportTemplates = "ManageExportTemplates";
/// <summary>
/// Project config manager role
/// </summary>
public const string ProjectConfigManager = "ProjectConfigManager";
/// <summary>
/// Returns all Role Names
/// </summary>
/// <returns>All Role Names</returns>
public static List<string> GetAllRoleNames()
{
List<string> roles = new List<string>();
FieldInfo[] roleFields = typeof(RoleNames).GetFields(BindingFlags.Public | BindingFlags.Static);
foreach(FieldInfo roleField in roleFields)
{
if(roleField.IsLiteral && !roleField.IsInitOnly)
{
roles.Add(roleField.GetValue(null).ToString());
}
}
return roles;
}
/// <summary>
/// Returns the name of a role by the normalized name
/// </summary>
/// <param name="normalizedName">Normalized name</param>
/// <returns>Normalized Name</returns>
public static string GetRoleNameByNormalizedName(string normalizedName)
{
return GetAllRoleNames().FirstOrDefault(r => r.Equals(normalizedName, StringComparison.OrdinalIgnoreCase));
}
};
}