Sha256: ad419bda9611df317402e579e3ebcfa558883ba3a5d42b2fe800be2c85ba738b

Contents?: true

Size: 510 Bytes

Versions: 30

Compression:

Stored size: 510 Bytes

Contents

module Rostra
  class Ability
    include CanCan::Ability

    def initialize(user)
      @user = user || User.new

      if @user.can_participate_in_rostra?
        can :manage, Question, :user => user
        can :manage, Answer, :user => user
        can :manage, Comment, :user => user

        can [:vote, :toggle_following], Question
        cannot :vote, Question, :user => user

        can [:vote], Answer
        cannot :vote, Answer, :user => user
      end

      can :read, :all
    end

  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
rostra-0.3.6 app/models/rostra/ability.rb
rostra-0.3.5 app/models/rostra/ability.rb
rostra-0.3.4 app/models/rostra/ability.rb
rostra-0.3.3 app/models/rostra/ability.rb
rostra-0.3.2 app/models/rostra/ability.rb
rostra-0.3.1 app/models/rostra/ability.rb
rostra-0.2.1 app/models/rostra/ability.rb
rostra-0.2.0 app/models/rostra/ability.rb
rostra-0.1.26 app/models/rostra/ability.rb
rostra-0.1.25 app/models/rostra/ability.rb
rostra-0.1.24 app/models/rostra/ability.rb
rostra-0.1.23 app/models/rostra/ability.rb
rostra-0.1.22 app/models/rostra/ability.rb
rostra-0.1.21 app/models/rostra/ability.rb
rostra-0.1.20 app/models/rostra/ability.rb
rostra-0.1.19 app/models/rostra/ability.rb
rostra-0.1.18 app/models/rostra/ability.rb
rostra-0.1.17 app/models/rostra/ability.rb
rostra-0.1.16 app/models/rostra/ability.rb
rostra-0.1.15 app/models/rostra/ability.rb