Class: Ishapi::Ability
- Inherits:
-
Object
- Object
- Ishapi::Ability
- Includes:
- CanCan::Ability
- Defined in:
- app/models/ishapi/ability.rb
Instance Method Summary collapse
-
#initialize(user) ⇒ Ability
constructor
A new instance of Ability.
Constructor Details
#initialize(user) ⇒ Ability
Returns a new instance of Ability.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'app/models/ishapi/ability.rb', line 5 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_profile == user.profile end can [ :update ], ::CoTailors::Address do |address| puts [ user.inspect, address.inspect ], '+++ user in cancancan' true end 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 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 |