Sha256: 29f86789eea824b610d64024a0f3f779acaad20bb0e2c40d47ed792d1426fa33

Contents?: true

Size: 938 Bytes

Versions: 14

Compression:

Stored size: 938 Bytes

Contents

class Ability
  include CanCan::Ability



  def initialize(user)
    if user && user.administrator?
      can :manage, :all
    elsif Houston.config.defines_abilities?
      Houston.config.configure_abilities(self, user)
    else
      default_abilities_for(user)
    end
  end



  def default_abilities_for(user)

    # Anyone can see everything
    can :read, :all

    if user

      # If you're logged in, you can update yourself
      can :update, user


      if user.developer? or user.tester?

        # Developers and Testers can see and comment on Testing Reports
        # They can also edit their own notes
        can [:create, :read], TestingNote
        can [:update, :destroy], TestingNote, user_id: user.id

      end


      if user.developer?

        # Developers can manage projects and releases
        can :manage, Project
        can :manage, Release
        can :manage, Sprint

      end
    end

  end



end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
houston-core-0.7.0.beta3 app/models/ability.rb
houston-core-0.7.0.beta2 app/models/ability.rb
houston-core-0.7.0.beta app/models/ability.rb
houston-core-0.6.3 app/models/ability.rb
houston-core-0.6.2 app/models/ability.rb
houston-core-0.6.1 app/models/ability.rb
houston-core-0.6.0 app/models/ability.rb
houston-core-0.5.6 app/models/ability.rb
houston-core-0.5.5 app/models/ability.rb
houston-core-0.5.4 app/models/ability.rb
houston-core-0.5.3 app/models/ability.rb
houston-core-0.5.2 app/models/ability.rb
houston-core-0.5.1 app/models/ability.rb
houston-core-0.5.0 app/models/ability.rb