Sha256: f7ec8625789418110f1536e9c55bfb68e47630fcb01dda6fe3823aa1fa519bf9

Contents?: true

Size: 342 Bytes

Versions: 2

Compression:

Stored size: 342 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 view_builder.build(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.1.3 examples/basic_todo/app/controller_actions/shared/ensure_user_not_disabled_precondition.rb
aldous-1.1.2 examples/basic_todo/app/controller_actions/shared/ensure_user_not_disabled_precondition.rb