Class CurrentUser
- Namespace
- KadicErp.WebApi.Infrastructure.Security
- Assembly
- KadicErp.WebApi.dll
public class CurrentUser : ICurrentUser, ITenantContext
- Inheritance
-
objectCurrentUser
- Implements
-
ICurrentUserITenantContext
Properties
public string Email { get; }
Property Value
- string
IsAuthenticated
public bool IsAuthenticated { get; }
Property Value
- bool
IsPlatformAdmin
Set when the authenticated caller holds an active platform-admin grant at the moment the JWT was issued. This is a HINT derived from a JWT claim — handlers that enforce cross-tenant bypass MUST still re-verify against IPlatformAdminService to shrink the revocation window to the service's cache duration (seconds, not the JWT lifetime).
public bool IsPlatformAdmin { get; }
Property Value
- bool
Permissions
public IReadOnlyCollection<string> Permissions { get; }
Property Value
- IReadOnlyCollection<string>
Roles
public IReadOnlyCollection<string> Roles { get; }
Property Value
- IReadOnlyCollection<string>
TenantBranchId
public Guid TenantBranchId { get; }
Property Value
- Guid
TenantBranchIds
public IReadOnlyCollection<Guid> TenantBranchIds { get; }
Property Value
- IReadOnlyCollection<Guid>
TenantId
public Guid TenantId { get; }
Property Value
- Guid
UserId
public Guid UserId { get; }
Property Value
- Guid
Username
public string Username { get; }
Property Value
- string
Methods
Clear()
public void Clear()
HasAllPermissions(params string[])
public bool HasAllPermissions(params string[] permissionCodes)
Parameters
permissionCodesstring[]
Returns
- bool
HasAnyPermission(params string[])
public bool HasAnyPermission(params string[] permissionCodes)
Parameters
permissionCodesstring[]
Returns
- bool
HasPermission(string)
public bool HasPermission(string permissionCode)
Parameters
permissionCodestring
Returns
- bool
SetAuthenticated(Guid, Guid, Guid, IEnumerable<Guid>, string?, string?, IEnumerable<string>, IEnumerable<string>, bool)
public void SetAuthenticated(Guid userId, Guid tenantId, Guid tenantBranchId, IEnumerable<Guid> tenantBranchIds, string? username, string? email, IEnumerable<string> roles, IEnumerable<string> permissions, bool isPlatformAdmin = false)
Parameters
userIdGuidtenantIdGuidtenantBranchIdGuidtenantBranchIdsIEnumerable<Guid>usernamestringemailstringrolesIEnumerable<string>permissionsIEnumerable<string>isPlatformAdminbool