Sha256: cb232ef719ce33898de620f163a40e73d5864acd4725bd6911a6e9ad6934d7d4
Contents?: true
Size: 996 Bytes
Versions: 2
Compression:
Stored size: 996 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 UnixIdPool < ActiveSambaLdap::UnixIdPool ldap_mapping end if Group.exists?(name) $stderr.puts "group '#{name}' already exists." exit 1 end create_options = { :cn => name, :gid_number => options.gid, :pool_class => UnixIdPool, :group_type => options.group_type, } group = Group.create(create_options) unless group.errors.empty? group.errors.each_full do |message| $stderr.puts(message) end 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-groupadd |
activesambaldap-0.0.2 | bin/asl-samba-groupadd |