Sha256: dee60ecae60d0a267a51e1349efd005366db35c04148ce2b65d54af6286d401d

Contents?: true

Size: 572 Bytes

Versions: 8

Compression:

Stored size: 572 Bytes

Contents

class IshManager::Ability
  include ::CanCan::Ability

  def initialize user 

    #
    # signed in user
    #
    unless user.blank?

      if user.profile && user.profile.manager?
        can :manage, :all
        can [ :home ], ::Manager
        can :destroy, ::Photo
      end

      can [ :show ], ::Gallery do |gallery|
        gallery.user == user
      end
      
    end
    user ||= ::User.new
    
    can [ :read ], ::Gallery do |gallery|
      gallery.is_public
    end

    can [ :read ], ::Report do |report|
      report.is_public
    end
    
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ish_manager-0.1.8.14 app/models/ish_manager/ability.rb
ish_manager-0.1.8.13 app/models/ish_manager/ability.rb
ish_manager-0.1.8.12 app/models/ish_manager/ability.rb
ish_manager-0.1.8.11 app/models/ish_manager/ability.rb
ish_manager-0.1.8.10 app/models/ish_manager/ability.rb
ish_manager-0.1.8.9 app/models/ish_manager/ability.rb
ish_manager-0.1.8.8 app/models/ish_manager/ability.rb
ish_manager-0.1.8.7 app/models/ish_manager/ability.rb