Sha256: abc6ebf272e805ddadfb17a7b242db9453b2ea2dab16a8bc6b30028d0c4b0fb5

Contents?: true

Size: 645 Bytes

Versions: 24

Compression:

Stored size: 645 Bytes

Contents

class Ability
  include CanCan::Ability

  def initialize(u)
    if u.is_super_admin?
      can :manage, :all
      can :publish, :all
      can :assign_roles, User
    elsif u.is_admin?
      can :manage, :all
      can :publish, :all
      can :assign_roles, User
      can(:destroy, Page) { |page| page.key.blank? }
    elsif u.is_contributor?
      can([:update, :edit], User) { |user| user == u }
      can :read, :all
      can :create, Page
      can([:update, :destroy, :edit], Page) do |item|
        u.id == item.creator_id
      end
      can(:destroy, Page) { |page| page.key.blank? }
    else
      can :read, :all
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
forge-cli-0.1.10 lib/forge/app/models/ability.rb
forge-cli-0.1.9 lib/forge/app/models/ability.rb
forge-cli-0.1.8 lib/forge/app/models/ability.rb
forge-cli-0.1.7 lib/forge/app/models/ability.rb
forge-cli-0.1.6 lib/forge/app/models/ability.rb
forge-cli-0.1.5 lib/forge/app/models/ability.rb
forge-cli-0.1.4 lib/forge/app/models/ability.rb
forge-cli-0.1.3 lib/forge/app/models/ability.rb
forge-cli-0.1.2 lib/forge/app/models/ability.rb
forge-cli-0.1.1 lib/forge/app/models/ability.rb
forge-cli-0.1.0 lib/forge/app/models/ability.rb
forge-cli-0.0.18 lib/forge/app/models/ability.rb
forge-cli-0.0.17 lib/forge/app/models/ability.rb
forge-cli-0.0.16 lib/forge/app/models/ability.rb
forge-cli-0.0.15 lib/forge/app/models/ability.rb
forge-cli-0.0.14 lib/forge/app/models/ability.rb
forge-cli-0.0.13 lib/forge/app/models/ability.rb
forge-cli-0.0.12 lib/forge/app/models/ability.rb
forge-cli-0.0.11 lib/forge/app/models/ability.rb
forge-cli-0.0.10 lib/forge/app/models/ability.rb