Sha256: d1504f2a6ecaab54dc9be4e023a02587da1766ce16920ed28d5779ee1567d201

Contents?: true

Size: 547 Bytes

Versions: 23

Compression:

Stored size: 547 Bytes

Contents

require 'cancan'

module RailsOps::AuthorizationBackend
  class CanCanCan < Abstract
    EXCEPTION_CLASS = 'CanCan::AccessDenied'

    def initialize
      unless defined?(CanCanCan)
        fail 'RailsOps is configured to use CanCanCan authorization'\
             "backend, but the Gem 'cancancan' does not appear to be installed."
      end
    end

    def authorize!(operation, *args)
      ability = operation.context.try(:ability) || fail(RailsOps::Exceptions::AuthorizationNotPerformable)
      ability.authorize!(*args)
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
rails_ops-1.1.20 lib/rails_ops/authorization_backend/can_can_can.rb
rails_ops-1.1.19 lib/rails_ops/authorization_backend/can_can_can.rb
rails_ops-1.1.18 lib/rails_ops/authorization_backend/can_can_can.rb
rails_ops-1.1.17 lib/rails_ops/authorization_backend/can_can_can.rb
rails_ops-1.1.16 lib/rails_ops/authorization_backend/can_can_can.rb
rails_ops-1.1.15 lib/rails_ops/authorization_backend/can_can_can.rb
rails_ops-1.1.14 lib/rails_ops/authorization_backend/can_can_can.rb
rails_ops-1.1.13 lib/rails_ops/authorization_backend/can_can_can.rb
rails_ops-1.1.12 lib/rails_ops/authorization_backend/can_can_can.rb
rails_ops-1.1.11 lib/rails_ops/authorization_backend/can_can_can.rb
rails_ops-1.1.10 lib/rails_ops/authorization_backend/can_can_can.rb
rails_ops-1.1.9 lib/rails_ops/authorization_backend/can_can_can.rb
rails_ops-1.1.8 lib/rails_ops/authorization_backend/can_can_can.rb
rails_ops-1.1.7 lib/rails_ops/authorization_backend/can_can_can.rb
rails_ops-1.1.6 lib/rails_ops/authorization_backend/can_can_can.rb
rails_ops-1.1.5 lib/rails_ops/authorization_backend/can_can_can.rb
rails_ops-1.1.4 lib/rails_ops/authorization_backend/can_can_can.rb
rails_ops-1.1.3 lib/rails_ops/authorization_backend/can_can_can.rb
rails_ops-1.1.2 lib/rails_ops/authorization_backend/can_can_can.rb
rails_ops-1.1.1 lib/rails_ops/authorization_backend/can_can_can.rb