Module: ActiveSambaLdap::Entry::ClassMethods

Defined in:
lib/active_samba_ldap/entry.rb

Instance Method Summary collapse

Instance Method Details

#create(attributes = nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/active_samba_ldap/entry.rb', line 9

def create(attributes=nil)
  pool = nil
  number_key = nil
  attributes ||= {}
  attributes = attributes.stringify_keys
  ensure_ou(attributes[dn_attribute])
  entry = super do |entry|
    options, pool, number_key = prepare_create_options(entry, attributes)
    entry.fill_default_values(options)
    yield entry if block_given?
  end
  if entry.errors.empty? and pool
    pool[number_key] = Integer(entry[number_key]).succ
    unless pool.save
      pool.each do |key, value|
        entry.add("pool: #{key}", value)
      end
    end
  end
  entry
end

#samba4?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/active_samba_ldap/entry.rb', line 31

def samba4?
  configuration[:samba4]
end