Class: Zaikio::Hub::CurrentPerson

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.findObject



16
17
18
# File 'lib/zaikio/hub/current_person.rb', line 16

def self.find
  all.find_one
end

.find_with_fallback(fallback) ⇒ Object



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

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

Instance Method Details

#admin_organizationsObject



36
37
38
39
40
# File 'lib/zaikio/hub/current_person.rb', line 36

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

#fetchObject



28
29
30
# File 'lib/zaikio/hub/current_person.rb', line 28

def fetch
  self.attributes = get
end

#organizationsObject



32
33
34
# File 'lib/zaikio/hub/current_person.rb', line 32

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