Sha256: 2fc45e211e2cd3ecd3d9f972800da762af43acdd3962b595b2c7fe09aed76774

Contents?: true

Size: 412 Bytes

Versions: 9

Compression:

Stored size: 412 Bytes

Contents

require 'cancan'

class Ability
  include CanCan::Ability

  def initialize(user)
    user ||= Georgia::User.new

    if user.has_role? 'Admin'
      can :manage, :all
    elsif user.has_role? 'Editor'
      can :manage, :all
      cannot :manage, Georgia::User
    else # or if user is Guest
      can [:read, :edit, :update, :search, :draft, :review], :all
      cannot :manage, Georgia::User
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
georgia-0.7.8 app/models/ability.rb
georgia-0.7.7 app/models/ability.rb
georgia-0.7.6 app/models/ability.rb
georgia-0.7.5 app/models/ability.rb
georgia-0.7.4 app/models/ability.rb
georgia-0.7.3 app/models/ability.rb
georgia-0.7.2 app/models/ability.rb
georgia-0.7.1 app/models/ability.rb
georgia-0.7.0 app/models/ability.rb