Sha256: 4c78b82a5c8a8d62a39c66725000b7c12bd3250b2d720a7c83e52978222f3f4e
Contents?: true
Size: 1.88 KB
Versions: 3
Compression:
Stored size: 1.88 KB
Contents
#!/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| options.remove_home_directory = false options.interactive = false options.computer_account = false opts.banner += " USER_NAME" opts.on("-c", "--[no-]computer-account", _("is a Windows Workstation"), _("(otherwise, Windows user)"), "(#{options.computer_account})") {|options.computer_account|} opts.on("-r", "--[no-]remove-home-directory", _("remove home directory"), "(#{options.remove_home_directory})") do |bool| options.remove_home_directory = bool end opts.on("-i", "--[no-]interactive", _("do interactively"), "(#{options.interactive})") do |bool| options.interactive = bool end 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 end class Computer < ActiveSambaLdap::Computer ldap_mapping end class Group < ActiveSambaLdap::Group ldap_mapping end if options.computer_account member_class = Computer member_type = _("computer") else member_class = User member_type = _("user") end if options.computer_account name = name.chomp("$") + "$" end unless member_class.exists?(name) $stderr.puts(_("%s doesn't exist: %s") % [member_type, name]) exit 1 end member = member_class.find(name) member.destroy(:removed_from_group => true, :remove_home_directory => options.remove_home_directory, :remove_home_directory_interactive => options.interactive) ActiveSambaLdap::Base.restart_nscd ActiveSambaLdap::Base.clear_active_connections!
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
activesambaldap-0.0.4 | bin/asl-userdel |
activesambaldap-0.0.5 | bin/asl-userdel |
activesambaldap-0.0.6 | bin/asl-userdel |