Class: Zaikio::Directory::CurrentPerson

Inherits:
Base
  • Object
show all
Defined in:
lib/zaikio/directory/current_person.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.findObject



8
9
10
# File 'lib/zaikio/directory/current_person.rb', line 8

def self.find
  all.find_one
end

.find_with_fallback(fallback) ⇒ Object



12
13
14
# File 'lib/zaikio/directory/current_person.rb', line 12

def self.find_with_fallback(fallback)
  all.with_fallback(fallback).find_one
end

Instance Method Details

#admin_organizationsObject



28
29
30
31
32
# File 'lib/zaikio/directory/current_person.rb', line 28

def admin_organizations
  organization_memberships.map do |m|
    m.organization if m.roles.include?("admin") || m.roles.include?("owner")
  end.compact
end

#fetchObject



20
21
22
# File 'lib/zaikio/directory/current_person.rb', line 20

def fetch
  self.attributes = get
end

#organizationsObject



24
25
26
# File 'lib/zaikio/directory/current_person.rb', line 24

def organizations
  organization_memberships.with_fallback.map(&:organization)
end