public static bool IsAllow(HttpContextBase httpContext) { var userIdentity = httpContext.User.Identity; if (userIdentity.IsAuthenticated == false) { return(false); } // If no configuration about Quiz Master, // then all users can be Quiz Master. var setting = JsonAppSettings.AsDictionary("QuizMaster"); if (setting == null) { return(true); } using (var db = new QuizWebAppDb()) { var userInfo = db.Users.Find(userIdentity.UserId()); if (userInfo == null) { return(false); } return (setting["idProviderName"] == userInfo.IdProviderName && setting["name"] == userInfo.Name); } }
//private static string _filteredLogsPath; public static async Task LoadAsync(string settingsPath) { Console.Write("Loading settings and verifying (or getting new) OAuth token"); _settingsPath = settingsPath; var jsonFile = File.ReadAllText(settingsPath); _jsonAppSettings = JsonSerializer.Deserialize <JsonAppSettings>(jsonFile); await ValidateSettings(); _originalLogsPath = Path.Combine(_jsonAppSettings.OutputPath, "original"); //_filteredLogsPath = Path.Combine(_jsonAppSettings.OutputPath, "filtered"); _ = Directory.CreateDirectory(_originalLogsPath); //_ = Directory.CreateDirectory(_filteredLogsPath); Console.WriteLine(" Done."); }