Sha256: 06e947b798233609ff0189c678f610ae1dda82ef30aeda19804d95db66229d19

Contents?: true

Size: 338 Bytes

Versions: 9

Compression:

Stored size: 338 Bytes

Contents

module Comable
  class Ability
    include CanCan::Ability

    def initialize(user)
      user ||= Comable::User.new # guest user (not logged in)

      case user.role.to_sym
      when :admin
        can :manage, :all
      when :reporter
        can :read, :all
      else
        fail CanCan::AccessDenied
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
comable-core-0.7.1 app/models/comable/ability.rb
comable-core-0.7.0 app/models/comable/ability.rb
comable-core-0.7.0.beta2 app/models/comable/ability.rb
comable-core-0.7.0.beta1 app/models/comable/ability.rb
comable-core-0.6.0 app/models/comable/ability.rb
comable_core-0.5.0 app/models/comable/ability.rb
comable_core-0.4.2 app/models/comable/ability.rb
comable_core-0.4.1 app/models/comable/ability.rb
comable_core-0.4.0 app/models/comable/ability.rb