Sha256: 503357106130ae01f3057c9b50d16119ae11f357aaf41e96bae7bd01be6595a7

Contents?: true

Size: 1.7 KB

Versions: 1

Compression:

Stored size: 1.7 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 [ :update ], ::CoTailors::Address do |address|
        puts [ user.inspect, address.inspect ], '+++ user in cancancan'
        true
      end

      can [ :show ], Gallery do |gallery|
        gallery.user_profile == user.profile
      end
      can [ :do_purchase ], ::Gameui

      can [ :create, :unlock ], ::Ish::Payment

      can [ :buy_stars ], ::IshModels::UserProfile

    end
    #
    # anonymous user
    #
    user ||= User.new

    can [ :show ], IshModels::UserProfile

    can [ :index, :show ], City

    can [ :update ], ::CoTailors::Address
    can [ :add ], ::CoTailors::OrderItem
    can [ :create, :update_measurements ], ::CoTailors::Order
    can [ :show ], ::CoTailors::Product

    can [ :index, :show ], Event

    #
    # Ish::P
    #


    #
    # G
    #
    can [ :index ], Gallery
    can [ :show ], Gallery do |gallery|
      gallery.is_public && !gallery.is_trash
    end
    can [ :index, :show ], ::Gameui::Map
    can [ :show ], ::Gameui::Marker

    can [ :index ], Report
    can [ :my_index, :show ], Report do |report|
      report.is_public
    end

    can [ :fb_sign_in, :long_term_token, :open_permission, :welcome_home ], Ishapi

    can [ :index, :show ], Site

    can [ :index ], Tag
    can [ :show ], Tag do |tag|
      tag.is_public
    end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ishapi-0.1.8.134 app/models/ishapi/ability.rb