Sha256: 0b0aad84a32eb82fda64984041bfcc5352931974233330ac03283712796c59f6

Contents?: true

Size: 753 Bytes

Versions: 2

Compression:

Stored size: 753 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 [ :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

2 entries across 2 versions & 1 rubygems

Version Path
ishapi-0.1.8.16 app/models/ishapi/ability.rb
ishapi-0.1.8.15 app/models/ishapi/ability.rb