#!/usr/bin/env ruby require 'active_samba_ldap' require 'active_samba_ldap/command' include ActiveSambaLdap::GetTextSupport argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options| opts.banner += " USER_NAME" end name = nil if argv.size == 1 name = argv.first else $stderr.puts opts exit 1 end unless Process.uid.zero? $stderr.puts(_("need root authority.")) exit 1 end ActiveSambaLdap::Base.establish_connection("update") class User < ActiveSambaLdap::User ldap_mapping :recommended_classes => [] end class Computer < ActiveSambaLdap::Computer ldap_mapping :recommended_classes => [] end class Group < ActiveSambaLdap::Group ldap_mapping :recommended_classes => [] end unless User.exists?(name) $stderr.puts(_("user doesn't exist: %s") % name) exit 1 end user = User.find(name) user.destroy(:removed_from_group => true, :remove_home_directory => true) ActiveSambaLdap::Base.restart_nscd ActiveSambaLdap::Base.clear_active_connections!