Class: ZmLdifExport::DistributionList

Inherits:
ZimbraResource show all
Defined in:
lib/zmldifexport.rb

Constant Summary

Constants inherited from ZimbraResource

ZimbraResource::BLACK_LIST_ATTRS

Instance Attribute Summary

Attributes inherited from ZimbraResource

#attributes, #name, #real_attrs

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ZimbraResource

#attr_to_zmprov, attrs_xml, #id, #invalid_attribute?, #invalid_value?, #parse_attributes, #to_zmprov, #zimbra_attrs

Constructor Details

#initialize(ldif) ⇒ DistributionList

Returns a new instance of DistributionList.



435
436
437
438
# File 'lib/zmldifexport.rb', line 435

def initialize(ldif)
  @name = ldif[:uid]
  @attributes = parse_attributes(ldif: ldif, exclude: [:uid])
end

Class Method Details

.add(resource) ⇒ Object



431
432
433
# File 'lib/zmldifexport.rb', line 431

def self.add(resource)
  @resources.push resource
end

.allObject



427
428
429
# File 'lib/zmldifexport.rb', line 427

def self.all
  return @resources
end

Instance Method Details

#zmprov_adla(domain:, print: false) ⇒ Object



462
463
464
465
466
467
468
469
470
471
472
473
# File 'lib/zmldifexport.rb', line 462

def zmprov_adla(domain:, print: false)
  lines = []
  attributes.each do |name, value|
    next unless name =~ /zimbraMailAlias/i
    value.each do |v|
      lines << "adla #{name(:zmprov, domain)} #{v}" 
    end
  end
  cmd = lines.join(' ')
  puts cmd if print
  return cmd
end

#zmprov_adlm(domain:, print: false) ⇒ Object



451
452
453
454
455
456
457
458
459
460
# File 'lib/zmldifexport.rb', line 451

def zmprov_adlm(domain:, print: false)
  line = ['adlm', name(:zmprov, domain)]
  attributes.each do |name, value|
    next unless name =~ /zimbraMailForwardingAddress/i
    line << value.join(' ')
  end
  cmd = line.join(' ')
  puts cmd if print
  return cmd
end

#zmprov_cdl(domain: '', print: false) ⇒ Object



440
441
442
443
444
445
446
447
448
449
# File 'lib/zmldifexport.rb', line 440

def zmprov_cdl(domain: '', print: false)
  line = ['zmprov cdl', name(:zmprov, domain)]
  attributes.each do |name, value|
    next if name =~ /(zimbraMailForwardingAddress)|(zimbraMailAlias)/i
    line << attr_to_zmprov(attr_name: name, value: value)
  end
  cmd = line.join(' ')
  puts cmd if print
  return cmd
end