public static void ReloadRoles() { if (RoleList.Count > 0) { RoleList.RemoveAll(v => true); } JObject config = JObject.Parse(File.ReadAllText("permissions.json")); foreach (JProperty role in ((JObject)config.SelectToken("Roles")).Properties()) { Role newRole = new Role(role.Name); foreach (JToken command in config.SelectToken($"Roles.{role.Name}")) { newRole.Commands.Add(command.ToString()); } RoleList.Add(newRole); } }
public static bool IsPermitted(Role role, string command) { // TODO return true; }