Sha256: ca0730bb7efc662d7a4660f5b9615de7f7a5cac92b3e1a254c56eb3ae2293bf0

Contents?: true

Size: 334 Bytes

Versions: 2

Compression:

Stored size: 334 Bytes

Contents

class Shared::EnsureUserNotDisabledPrecondition < BasePrecondition
  delegate :current_user, :current_ability, to: :action

  def perform
    if current_user && current_user.disabled && !current_ability.can?(:manage, :all)
      return build_view(Defaults::ForbiddenView, errors: ['Your account has been disabled'])
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aldous-1.0.1 examples/basic_todo/app/controller_actions/shared/ensure_user_not_disabled_precondition.rb
aldous-1.0.0 examples/basic_todo/app/controller_actions/shared/ensure_user_not_disabled_precondition.rb