コード例 #1
0
ファイル: Authorization.cs プロジェクト: jaccoklouwer/AppNizi
        public async Task <AuthResultModel> AuthForDoctorOrPatient(HttpRequest req, int userId)
        {
            AuthGUID authGUID = await GetGUIDAsync(req);

            if (!authGUID.Acces || authGUID.GUID == "")
            {
                return(new AuthResultModel(false, AuthStatusCode.Unauthorized));
            }

            IAuthorizationRepository authRepository = DIContainer.Instance.GetService <IAuthorizationRepository>();

            return(authRepository.HasAcces(userId, authGUID.GUID)
                ? new AuthResultModel(true, AuthStatusCode.Ok)
                : new AuthResultModel(false, AuthStatusCode.Forbidden));
        }