Project

General

Profile

« Previous | Next » 

Revision 70b17bfa

Added by Marc Dequènes about 15 years ago

  • ID 70b17bfae38dcac0b3ddd3c0b19b1ee5496b166c

[evol] apply password hash if requested

View differences:

conf/ldap_shadows/global.conf
---
default_shadow: MilkyPond
password_hash: ssha
data/ldap_shadows/schema/global.yaml
mapping:
=:
type: any
"password_hash": {type: str, enum: [crypt, md5, smd5, sha, ssha]}
lib/ldap_shadows/elements/object.rb
self.family_siblings.collect {|obj| obj.dn }
end
def modified_attributes
def modified_attributes(op_types = nil, att_only = false)
list = []
prepare_data_for_saving do |data, ldap_data|
list = collect_modified_attributes(ldap_data, data)
false
end
unless op_types.nil?
list.reject! do |mod_info|
op_type, att, new_val = mod_info
not op_types.include? op_type
end
end
if att_only
list.collect! do |mod_info|
op_type, att, new_val = mod_info
att
end
end
list
end
......
def before_save_jobs
check_hooks_before(:save)
check_missing_attributes
check_password
end
def before_delete_jobs
......
end
end
def check_password
return unless self.modified_attributes([:replace], true).include? 'userPassword'
hash_func = self.class.config.global_config[:password_hash]
return if hash_func.nil?
self.userPassword = ActiveLdap::UserPassword.send(hash_func, self.userPassword)
end
def after_save_jobs
check_hooks_after(:save)
end
lib/ldap_shadows/shadow.rb
$KCODE = 'UTF8'
require 'jcode'
require 'active_ldap'
require 'active_ldap/user_password'
require 'ldap_shadows/activeldap_fixes'
require 'facets/metaid'
require 'lib/ldap_shadows/elements'
require 'ldap_shadows/elements'
module LdapShadows
......
EOS
klass.instance_variable_set(:@handle, e_name)
klass.instance_variable_set(:@shadow, self)
klass.instance_variable_set(:@config, @config)
klass.instance_variable_set(:@parameters, e_def)
klass.meta_eval do
attr_reader :handle, :shadow, :parameters
attr_reader :handle, :shadow, :config, :parameters
end
begin

Also available in: Unified diff