Sha256: 946d7137405bddac29b91cbdd3875fe9e2ac74f131a8582fae0ee19364c754fd

Contents?: true

Size: 791 Bytes

Versions: 9

Compression:

Stored size: 791 Bytes

Contents

class Ishapi::Ability
  include ::CanCan::Ability

  def initialize user

    #
    # signed in user
    #
    unless user.blank?

      if user.profile && user.profile.manager?
        can :manage, :all
      end

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

    can [ :index, :show ], City
    
    can [ :show ], Gallery do |gallery|
      gallery.is_public
    end

    can [ :index ], Report
    can [ :my_index, :show ], Report do |report|
      report.is_public
    end
    
    can [ :welcome_home, :fb_sign_in, :open_permission ], Ishapi

    can [ :index, :show ], Site

    can [ :index ], Venue
    can [ :show ], Venue do |venue|
      venue.is_public
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ishapi-0.1.8.25 app/models/ishapi/ability.rb
ishapi-0.1.8.24 app/models/ishapi/ability.rb
ishapi-0.1.8.23 app/models/ishapi/ability.rb
ishapi-0.1.8.22 app/models/ishapi/ability.rb
ishapi-0.1.8.21 app/models/ishapi/ability.rb
ishapi-0.1.8.20 app/models/ishapi/ability.rb
ishapi-0.1.8.19 app/models/ishapi/ability.rb
ishapi-0.1.8.18 app/models/ishapi/ability.rb
ishapi-0.1.8.17 app/models/ishapi/ability.rb