public AuthorizeProfile GetProfile() { var context = _accessor.HttpContext; AuthorizeProfile authorizeProfile = null; var claims = context.User.Claims; var userIdData = claims.FirstOrDefault(c => c.Type == "UserId"); var userOrgnizarionData = claims.FirstOrDefault(c => c.Type == "Organization"); int UserId = -1; int OrgnizationId = -1; int.TryParse(userIdData?.Value, out UserId); int.TryParse(userOrgnizarionData?.Value, out OrgnizationId); if (UserId != -1 && OrgnizationId != -1) { authorizeProfile = new AuthorizeProfile(); authorizeProfile.UserId = UserId; authorizeProfile.UserId = OrgnizationId; } return(authorizeProfile); }
public ValuesController(AuthorizeProfile authorizeProfile) { _authorizeProfile = authorizeProfile; }
public UserRepository(IUnitOfWork <AccountDbContext> unitOfWork, IMapper mapper, AuthorizeProfile authorizeProfile) : base(authorizeProfile) { _uow = unitOfWork; _mapper = mapper; }
public BaseRepository(AuthorizeProfile authorizeProfile) { UserId = authorizeProfile.UserId; OrgnizationId = authorizeProfile.OrgnizationId; }