Initial commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
using SharepointToolbox.Web.Core.Models;
|
||||
|
||||
namespace SharepointToolbox.Web.Services.Session;
|
||||
|
||||
public class UserContextAccessor : IUserContextAccessor
|
||||
{
|
||||
private AppUser? _user;
|
||||
|
||||
public string Email => _user?.Email ?? string.Empty;
|
||||
public string DisplayName => _user?.DisplayName ?? string.Empty;
|
||||
public UserRole Role => _user?.Role ?? UserRole.TechN0;
|
||||
public bool IsAuthenticated => _user is not null;
|
||||
|
||||
public event Action? Initialized;
|
||||
|
||||
public void Initialize(AppUser user)
|
||||
{
|
||||
_user = user;
|
||||
Initialized?.Invoke();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user