Sha256: 874b5c2f0bfc7fe7edf2fb552e33de536894cd5e867a2f0e0ca29e6880b060b5

Contents?: true

Size: 510 Bytes

Versions: 4

Compression:

Stored size: 510 Bytes

Contents

module Rostra
  class Ability
    include CanCan::Ability

    attr_reader :user

    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, Question
        cannot :vote, Question, :user => user

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

      can :read, :all
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rostra-0.0.14 app/models/rostra/ability.rb
rostra-0.0.13 app/models/rostra/ability.rb
rostra-0.0.12 app/models/rostra/ability.rb
rostra-0.0.11 app/models/rostra/ability.rb