Sha256: 790a2810b3bc4baed16ebd94b1419f3e5eeb3329f7cafa21fcf3e79d181a2b42

Contents?: true

Size: 903 Bytes

Versions: 9

Compression:

Stored size: 903 Bytes

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 ], 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
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ishapi-0.1.8.52 app/models/ishapi/ability.rb
ishapi-0.1.8.49 app/models/ishapi/ability.rb
ishapi-0.1.8.48 app/models/ishapi/ability.rb
ishapi-0.1.8.47 app/models/ishapi/ability.rb
ishapi-0.1.8.46 app/models/ishapi/ability.rb
ishapi-0.1.8.45 app/models/ishapi/ability.rb
ishapi-0.1.8.44 app/models/ishapi/ability.rb
ishapi-0.1.8.43 app/models/ishapi/ability.rb
ishapi-0.1.8.42 app/models/ishapi/ability.rb