Sha256: f1502785a8ac5512a14db579197694445db6bd6e39e5b0ba1df9fa7d5096b6b0
Contents?: true
Size: 967 Bytes
Versions: 2
Compression:
Stored size: 967 Bytes
Contents
#!/usr/bin/env ruby require 'active_samba_ldap' require 'active_samba_ldap/command' argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options| opts.banner += " GROUP_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 Group < ActiveSambaLdap::Group ldap_mapping end class User < ActiveSambaLdap::User ldap_mapping end class Computer < ActiveSambaLdap::Computer ldap_mapping end unless Group.exists?(name) $stderr.puts "group '#{name}' doesn't exist." exit 1 end group = Group.find(name) begin group.destroy(:remove_members => true, :force_change_primary_members => options.force) rescue ActiveSambaLdap::Error $stderr.puts $! exit 1 end ActiveSambaLdap::Base.restart_nscd ActiveSambaLdap::Base.clear_active_connections!
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
activesambaldap-0.0.1 | bin/asl-samba-groupdel |
activesambaldap-0.0.2 | bin/asl-samba-groupdel |