Project

General

Profile

« Previous | Next » 

Revision 9681b76a

Added by Marc Dequènes about 15 years ago

  • ID 9681b76a1be610ebf6489b28f115114c1eb3adb0

[evol] distinguish object handle from the attributes, and allow aspects to associate with an attribute ignored by the object

View differences:

config/test.conf
desc_attribute: cn
optional_classes: []
allowed_aspects: ['primary', 'mail', 'fs', 'shell', 'ftp', 'web', 'jabber']
hidden_attributes: ['objectClass']
hidden_attributes: ['objectClass', 'uid']
expert_attributes: ['uidNumber', 'gidNumber', 'gecos']
relations:
primaryGroup:
......
desc_attribute: cn
optional_classes: []
allowed_aspects: ['primary', 'mail', 'fs', 'shell', 'ftp', 'web', 'jabber']
hidden_attributes: ['objectClass']
hidden_attributes: ['objectClass', 'uid']
expert_attributes: ['uidNumber', 'gidNumber', 'gecos']
relations:
primaryGroup:
......
mapping:
classes: ['primaryAccount']
presentation:
associated_attributes: ['uid']
relations:
locale/en.yml
---
en:
objects:
individual: "Individual"
bot: "Bot"
group: "Group"
entity: "Entity"
attribute_types:
allowGlobalDirectory: "Disclose Own Contact Information in GLobal Directory"
cn: "Full Name"
......
preferredLanguage: "Language Preference"
sn: "Surname"
sshAuthKey: "SSH Public Key(s)"
uid: "Identifier"
uid: "Identifier (Login)"
uidNumber: "Identifier (numeric)"
uniqueAbbreviation: "Unique Abbreviation"
uniqueMember: "Group member"
......
foundersIndividuals: "Founder(s) Individual(s)"
foundersEntities: "Founder(s) Entity(ies)"
aspects:
primary: "Primary Account"
ftp: "FTP Account"
web: "Web Account"
shell: "Shell Account"
test.rb
aspect_data = self.class.mapper.get_aspect(aspect)
if defined?(aspect_data[:presentation][:associated_attributes]) and aspect_data[:presentation][:associated_attributes]
taken_attr_list = aspect_data[:presentation][:associated_attributes] & attr_list
taken_attr_list = aspect_data[:presentation][:associated_attributes] & (attr_list + ignored_attrs)
unless taken_attr_list.empty?
obj_aspects[aspect] ||= {}
obj_aspects[aspect].merge!(fetch_attributes_data(taken_attr_list, options))
......
def display_data(attr_data)
attr_data.each_pair do |key, val|
item_name = translate_data_key(key)
puts item_name + ": " + (val.is_a?(Array) ? val.sort.collect{|v| v.to_s }.join(", ") : val.to_s)
field_name = translate_data_key(key)
puts field_name + ": " + (val.is_a?(Array) ? val.sort.collect{|v| v.to_s }.join(", ") : val.to_s)
end
end
......
exit 2
end
item_name = args[1]
item_identifier = args[1]
begin
item = obj_klass.find(item_name)
item = obj_klass.find(item_identifier)
rescue ActiveLdap::EntryNotFound
STDERR.puts "No such item '#{obj_name}/#{item_name}'"
STDERR.puts "No such item '#{obj_name}/#{item_identifier}'"
exit 2
end
obj_human_name = I18n.t(obj_name, :scope => 'objects', :default => "Object '#{obj_name}'")
puts "=== #{obj_human_name}: #{item.name} ==="
if $debug_opt
puts item.to_s
puts "=== Detected Info ==="
puts "--- Detected Info ---"
puts "aspects: " + item.aspects.sort.join(", ")
puts "=== Relations ==="
puts "--- Relations ---"
item.relations.each do |rel|
puts "#{rel}: " + item.send(rel).collect{|g| g.name }.join(", ")
end
......
display_data(obj_info)
obj_aspects.each_pair do |aspect_name, aspect_data|
aspect_display_name = I18n.t(aspect_name, :scope => 'aspects', :default => "Aspect: #{aspect_name}")
puts "=== #{aspect_display_name} ==="
aspect_display_name = I18n.t(aspect_name, :scope => 'aspects', :default => "Aspect '#{aspect_name}'")
puts "--- #{aspect_display_name} ---"
display_data(aspect_data)
end
end

Also available in: Unified diff