Example #1
0
        public override async Task Run(object prm)
        {
            if (IsRunning)
            {
                return;
            }
            IsRunning = true;
            var manual = (bool?)prm;

            try
            {
                manual = manual ?? false;
                //Check inactive users are correct
                if (DateTime.Now > _lastAuthCheck.AddMinutes(Settings.WebAuthModule.AuthCheckIntervalMinutes) || manual.Value)
                {
                    _lastAuthCheck = DateTime.Now;

                    await LogHelper.LogModule("Running AuthCheck module...", Category);

                    var sw = Stopwatch.StartNew();
                    await WebAuthModule.UpdateAllUserRoles(Settings.WebAuthModule.ExemptDiscordRoles, Settings.WebAuthModule.AuthCheckIgnoreRoles);

                    // await LogHelper.LogInfo("Auth check complete!", Category);
                    sw.Stop();
                    Debug.WriteLine(sw.Elapsed.TotalSeconds);
                }
            }
            finally
            {
                IsRunning = false;
            }
        }
Example #2
0
        private async Task CheckDBUsers(bool manual)
        {
            //Check inactive users are correct
            if (DateTime.Now > _lastAuthCheck.AddMinutes(2) || manual)
            {
                _lastAuthCheck = DateTime.Now;

                await LogHelper.LogModule("Running DB users auth check...", Category);

                if (manual)
                {
                    await SQLHelper.ResetAuthUsersLastCheck();
                }
                await WebAuthModule.UpdateAllUserRoles(Settings.WebAuthModule.ExemptDiscordRoles, Settings.WebAuthModule.AuthCheckIgnoreRoles);
            }
        }