public async Task <bool> HasPermission(HasPermissionRequest hasPermissionRequest)
        {
            try
            {
                var userId = _apiRequest.UserId;

                if (_apiRequest.ApplicationId != hasPermissionRequest.ApplicationId)
                {
                    throw new KeyNotFoundException("Uygulama id bulunamadı");
                }

                var roles = (await _userRoleManager.GetRolesByUserIdAsync(userId)).ResultList;

                foreach (var permissionAttribute in hasPermissionRequest.PermissionAttributes)
                {
                    if (permissionAttribute.ClaimType != null)
                    {
                        await CheckCustomClaimAsync(hasPermissionRequest.ApplicationId, userId, roles, permissionAttribute.ClaimType);
                    }
                    else if (permissionAttribute.Entity != null && permissionAttribute.Crud != null)
                    {
                        await CheckEntityClaimAsync(_apiRequest.ApplicationId, userId, roles, permissionAttribute.Entity, (Crud)permissionAttribute.Crud);
                    }
                    else
                    {
                        throw new KeyNotFoundException();
                    }
                }
            }
            catch (KeyNotFoundException ex)
            {
                throw new UnauthorizedAccessException(ex.Message);
            }
            catch (Exception ex)
            {
                _logger.LogCritical(ex.Message);
                throw;
            }

            return(true);
        }