Sha256: fb5287baa78ceac8a889d0ed0ddf90fadeac488a0ede9e2d4fc5f2a25a6147f5
Contents?: true
Size: 591 Bytes
Versions: 8
Compression:
Stored size: 591 Bytes
Contents
# frozen_string_literal: true module Ibrain module Extentions class ActiveRequired < GraphQL::Schema::FieldExtension def resolve(object:, arguments:, **rest) raise ActionController::InvalidAuthenticityToken, I18n.t('ibrain.errors.session.is_deactivated') if is_invalid_session(object) # yield the current time as `memo` yield(object, arguments, rest) end private def is_activated(object) object.try(:context).try(:fetch, :current_user, nil).blank? && options.try(:fetch, :session_required, false) end end end end
Version data entries
8 entries across 8 versions & 1 rubygems