Sha256: 422a8f40dcee4aa3bc59aab65354db77f3206804fa3a54a0375feb75b410aea9

Contents?: true

Size: 1 KB

Versions: 4

Compression:

Stored size: 1 KB

Contents

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

  def initialize user

    #
    # signed in user
    #
    unless user.blank?

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

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

    can [ :index, :show ], City
    
    can [ :index, :show ], Event

    can [ :index ], Gallery
    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 ], Tag
    can [ :show ], Tag do |tag|
      tag.is_public
    end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ishapi-0.1.8.57 app/models/ishapi/ability.rb
ishapi-0.1.8.56 app/models/ishapi/ability.rb
ishapi-0.1.8.55 app/models/ishapi/ability.rb
ishapi-0.1.8.54 app/models/ishapi/ability.rb