add logging for the logout event to the UI component, relocate module setting deletion to repository

This commit is contained in:
Shaun Walker
2021-12-15 10:33:12 -05:00
parent 6a57980439
commit e3ebbde767
5 changed files with 40 additions and 11 deletions

View File

@ -2,6 +2,7 @@ using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using Oqtane.Enums;
using Oqtane.Providers;
using Oqtane.Security;
using Oqtane.Services;
@ -17,6 +18,7 @@ namespace Oqtane.Themes.Controls
[Inject] public IJSRuntime jsRuntime { get; set; }
[Inject] public IServiceProvider ServiceProvider { get; set; }
[Inject] public SiteState SiteState { get; set; }
[Inject] public ILogService LoggingService { get; set; }
protected void LoginUser()
{
@ -31,6 +33,8 @@ namespace Oqtane.Themes.Controls
protected async Task LogoutUser()
{
await UserService.LogoutUserAsync(PageState.User);
await LoggingService.Log(PageState.Alias, PageState.Page.PageId, PageState.ModuleId, PageState.User.UserId, GetType().AssemblyQualifiedName, "Logout", LogFunction.Security, LogLevel.Information, null, "User Logout For Username {Username}", PageState.User.Username);
PageState.User = null;
bool authorizedtoviewpage = UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, PageState.Page.Permissions);