forked from ddrilling/AsbCloudServer
20 lines
477 B
C#
20 lines
477 B
C#
using AsbCloudDb.Model;
|
|
using System.Security.Claims;
|
|
|
|
namespace AsbCloudWebApi
|
|
{
|
|
public static class Extensions
|
|
{
|
|
public static int? GetCompanyId(this ClaimsPrincipal user)
|
|
{
|
|
var claimIdCompany = user.FindFirst(nameof(User.IdCompany));
|
|
if (claimIdCompany is null)
|
|
return null;
|
|
|
|
return int.TryParse(claimIdCompany.Value, out int uid)
|
|
? uid
|
|
: null;
|
|
}
|
|
}
|
|
}
|