Class: Munificent::Admin::Ability

Inherits:
ApplicationAbility show all
Defined in:
app/abilities/munificent/admin/ability.rb

Instance Method Summary collapse

Methods inherited from ApplicationAbility

public_classes

Constructor Details

#initialize(user) ⇒ Ability

Returns a new instance of Ability.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/abilities/munificent/admin/ability.rb', line 4

def initialize(user)
  super()

  return unless user.is_a?(User)

  allow_reading_public_info
  allow_reading_self(user)

  if user.data_entry?
    allow_managing_public_info
    allow_managing_keys
  end
  allow_reading_donation_info if user.support?
  allow_managing_user_accounts if user.manages_users?

  can :manage, :all if user.full_access?
end