Project

General

Profile

« Previous | Next » 

Revision efe1cd5c

Added by Marc Dequènes almost 15 years ago

  • ID efe1cd5c890da81b4c93b1de0643ea67c5e4336d

[evol] improve config #1 (objects+relations config is separated)

View differences:

bin/shadowwalker
begin
ActiveLdap::Base.setup_connection(config[:ldap])
config[:objects].each_pair do |obj_name, obj_data|
$ldapctl.load_object(obj_name, obj_data)
obj_config_dir = File.join(LdapShadows::Config::CFG_DIR, "objects")
obj_config_pattern = File.join(obj_config_dir, "**", "*.conf")
Dir.glob(obj_config_pattern).each do |f|
next if f[0..0] == "."
obj_name = File.basename(f).sub(".conf", "")
obj_config = YAML.load(IO.read(f))
obj_config.recursive_symbolize_keys!
$ldapctl.load_object(obj_name, obj_config)
end
$ldapctl.load_relations
rescue ActiveLdap::Error => e
STDERR.puts _("LDAP connection error: %s") % e.to_s
conf/ldap_shadows/objects/bot.conf
mapping:
dn_attribute: uid
prefix: ''
classes: ['bot']
sort_by: uid
presentation:
allowed_aspects: ['primary', 'mail', 'fs', 'shell', 'ftp', 'web', 'jabber']
hidden_attributes: ['uid']
expert_attributes: ['uidNumber', 'gidNumber', 'gecos']
conf/ldap_shadows/objects/domain.conf
mapping:
dn_attribute: cn
prefix: ''
classes: ['genericDomain']
sort_by: cn
presentation:
allowed_aspects: []
conf/ldap_shadows/objects/entity.conf
mapping:
dn_attribute: o
prefix: ''
classes: ['entity']
excluded_classes: ['dcObject']
sort_by: o
presentation:
name_attribute: o
hidden_attributes: ['founder']
associated_relations: ['foundersIndividuals', 'foundersEntities']
relations:
foundersIndividuals:
type: :has_many
object: individual
foreign_key: founder
primary_key: dn
foundersEntities:
type: :has_many
object: entity
foreign_key: founder
primary_key: dn
conf/ldap_shadows/objects/group.conf
mapping:
dn_attribute: cn
prefix: ''
classes: ['posixGroup', 'groupOfMembers']
sort_by: cn
presentation:
allowed_aspects: []
hidden_attributes: ['uniqueMember']
expert_attributes: ['gidNumber']
associated_relations: ['individualsPrimaryMembers', 'botsPrimaryMembers', 'individualsSecondaryMembers', 'botsSecondaryMembers']
relations:
individualsPrimaryMembers:
type: :belongs_to
object: individual
many: gidNumber
foreign_key: gidNumber
botsPrimaryMembers:
type: :belongs_to
object: bot
many: gidNumber
foreign_key: gidNumber
individualsSecondaryMembers:
type: :has_many
object: individual
foreign_key: uniqueMember
primary_key: dn
botsSecondaryMembers:
type: :has_many
object: bot
foreign_key: uniqueMember
primary_key: dn
conf/ldap_shadows/objects/individual.conf
mapping:
dn_attribute: uid
prefix: ''
classes: ['individual']
sort_by: uid
presentation:
allowed_aspects: ['primary', 'mail', 'fs', 'shell', 'ftp', 'web', 'jabber']
hidden_attributes: ['uid']
expert_attributes: ['uidNumber', 'gidNumber', 'gecos']
conf/ldap_shadows/objects/secondary_account.conf
mapping:
dn_attribute: uid
prefix: ''
classes: ['secondaryAccount']
sort_by: uid
presentation:
allowed_aspects: ['mail', 'fs', 'shell', 'ftp', 'web', 'jabber']
conf/ldap_shadows/objects/system_account.conf
mapping:
dn_attribute: uid
prefix: ''
classes: ['systemAccount']
sort_by: uid
presentation:
allowed_aspects: ['mail', 'fs', 'shell', 'ftp', 'web', 'jabber']
conf/ldap_shadows/objects/unit.conf
mapping:
dn_attribute: ou
prefix: ''
classes: ['organizationalUnit']
# no sort_by means sort by DN
presentation:
name_attribute: dn
conf/ldap_shadows/test.conf
presentation:
hidden_attributes: ['objectClass', 'userPassword', 'hasSubordinates', 'entryUUID', 'entryDN', 'structuralObjectClass', 'subschemaSubentry']
tree_objects: ['unit', 'entity']
objects:
bot:
mapping:
dn_attribute: uid
prefix: ''
classes: ['bot']
sort_by: uid
presentation:
allowed_aspects: ['primary', 'mail', 'fs', 'shell', 'ftp', 'web', 'jabber']
hidden_attributes: ['uid']
expert_attributes: ['uidNumber', 'gidNumber', 'gecos']
individual:
mapping:
dn_attribute: uid
prefix: ''
classes: ['individual']
sort_by: uid
presentation:
allowed_aspects: ['primary', 'mail', 'fs', 'shell', 'ftp', 'web', 'jabber']
hidden_attributes: ['uid']
expert_attributes: ['uidNumber', 'gidNumber', 'gecos']
group:
mapping:
dn_attribute: cn
prefix: ''
classes: ['posixGroup', 'groupOfMembers']
sort_by: cn
presentation:
allowed_aspects: []
hidden_attributes: ['uniqueMember']
expert_attributes: ['gidNumber']
associated_relations: ['individualsPrimaryMembers', 'botsPrimaryMembers', 'individualsSecondaryMembers', 'botsSecondaryMembers']
relations:
individualsPrimaryMembers:
type: :belongs_to
object: individual
many: gidNumber
foreign_key: gidNumber
botsPrimaryMembers:
type: :belongs_to
object: bot
many: gidNumber
foreign_key: gidNumber
individualsSecondaryMembers:
type: :has_many
object: individual
foreign_key: uniqueMember
primary_key: dn
botsSecondaryMembers:
type: :has_many
object: bot
foreign_key: uniqueMember
primary_key: dn
entity:
mapping:
dn_attribute: o
prefix: ''
classes: ['entity']
excluded_classes: ['dcObject']
sort_by: o
presentation:
name_attribute: o
hidden_attributes: ['founder']
associated_relations: ['foundersIndividuals', 'foundersEntities']
relations:
foundersIndividuals:
type: :has_many
object: individual
foreign_key: founder
primary_key: dn
foundersEntities:
type: :has_many
object: entity
foreign_key: founder
primary_key: dn
unit:
mapping:
dn_attribute: ou
prefix: ''
classes: ['organizationalUnit']
# no sort_by means sort by DN
presentation:
name_attribute: dn
secondary_account:
mapping:
dn_attribute: uid
prefix: ''
classes: ['secondaryAccount']
sort_by: uid
presentation:
allowed_aspects: ['mail', 'fs', 'shell', 'ftp', 'web', 'jabber']
system_account:
mapping:
dn_attribute: uid
prefix: ''
classes: ['systemAccount']
sort_by: uid
presentation:
allowed_aspects: ['mail', 'fs', 'shell', 'ftp', 'web', 'jabber']
domain:
mapping:
dn_attribute: cn
prefix: ''
classes: ['genericDomain']
sort_by: cn
presentation:
allowed_aspects: []
aspects:
mail:
mapping:

Also available in: Unified diff