Class: ChefFixie::Sql::Orgs

Inherits:
SqlTable show all
Defined in:
lib/chef_fixie_shahid/sql_objects.rb

Constant Summary collapse

GlobalOrg =
"0" * 32

Class Method Summary collapse

Methods inherited from SqlTable

#all, element, filter_by, #filter_core, #get_table, #initialize, #inner, max_count_default, #mk_element, primary, table

Methods included from AuthzMapper

#authz_to_name, included, mapper, register, struct_to_name

Constructor Details

This class inherits a constructor from ChefFixie::Sql::SqlTable

Class Method Details

.org_guid_to_name(guid) ⇒ Object



432
433
434
435
436
437
438
439
440
441
442
# File 'lib/chef_fixie_shahid/sql_objects.rb', line 432

def self.org_guid_to_name(guid)
  "global" if guid == GlobalOrg
  # Cache the class
  @orgs ||= Orgs.new
  names = @orgs.by_id(guid).all(1)
  if names.count == 1
    names.first.name
  else
    "unknown-#{guid}"
  end
end