Sha256: 9898464c68dce04ecf11ed8839452abe2a3da52955f1446b310fe92bea33e4e2
Contents?: true
Size: 845 Bytes
Versions: 35
Compression:
Stored size: 845 Bytes
Contents
#!/usr/bin/ruby base = File.expand_path(File.join(File.dirname(__FILE__), "..")) $LOAD_PATH << File.join(base, "lib") $LOAD_PATH << File.join(base, "examples") require 'active_ldap' require 'objects/user' require 'objects/group' argv, opts, options = ActiveLdap::Command.parse_options do |opts, options| opts.banner += " GROUP_NAME" end if argv.size == 1 name = argv.shift else $stderr.puts opts exit 1 end pwb = Proc.new do |user| ActiveLdap::Command.read_password("[#{user}] Password: ") end ActiveLdap::Base.setup_connection(:password_block => pwb, :allow_anonymous => false) if Group.exists?(name) $stderr.puts("Group #{name} already exists.") exit 1 end group = Group.new(name) group.gid_number = 9000 unless group.save puts "failed" puts group.errors.full_messages exit 1 end
Version data entries
35 entries across 35 versions & 3 rubygems