== Description The sys-admin package is a unified, cross platform replacement for the Etc module. == Installation === Win32 ruby test\tc_admin.rb # optional ruby install.rb === Unix ruby extconf.rb nmake ruby test\tc_admin.rb # optional nmake site-install == Synopsis require "sys/admin" include Sys # Yields a User object for each user Admin.users{ |user| p user } # Returns an Array of User objects a = Admin.users # Yields a Group object for each group Admin.groups{ |group| p group } # Returns an Array of Group objects g = Admin.groups # Get information about a particular user p Admin.get_user("nobody") # Get information about a particular group p Admin.get_group("adm") == Admin Admin.get_login Returns the user name (only) of the current login. Admin.get_user(name, host=localhost) Admin.get_user(uid, host=localhost, local=true) Returns a User object based on +name+ or +uid+. Win32 only: you may specify a host from which information is retrieved. The default is the local machine. You may also specify whether to retrieve a local or global account. The default is local. Admin.get_group(name, host=localhost, local=true) Admin.get_group(gid, host=localhost, local=true) Returns a Group object based on +name+ or +uid+. Win32 only: you may specify a host from which information is retrieved. The default is the local machine. You can retrieve either a global or local group, depending on the value of the +local+ argument. Admin.groups(host=localhost, local=true) Admin.groups(host=localhost, local=true){ |group| ... } In block form, yields a Group object for each user on the system. In non-block form, returns an Array of Group objects. Win32 only: you may specify a host from which information is retrieved. The default is the local machine. You can retrieve either a global or local group, depending on the value of the +local+ argument. Admin.users(host=localhost, local=true) Admin.users(host=localhost, local=true){ |user| ... } In block form, yields a User object for each user on the system. In non-block form, returns an Array of User objects. Win32 only: you may specify a host from which information is retrieved. The default is the local machine. You can retrieve either a global or local group, depending on the value of the +local+ argument. == User class === User (Win32) The User class has the following attributes on Win32 systems: * account_type * caption * description * domain * password * full_name * install_date * name * sid * status * disabled? * local? * lockout? * password_changeable? * password_expires? * password_required? === User (Unix) The User class has the following attributes on Unix systems: * name * passwd * uid * gid * dir * shell * gecos * quota * age * class * comment * expire == Group Classes === Group (Win32) The Group class has the following attributes on Win32 systems: * caption * description * domain * install_date * name * sid * status * gid * local? === Group (Unix) The Group class has the following attributes on Unix systems: * name * gid * members * passwd == Error Classes AdminError < StandardError Raised if anything goes wrong with any of the above methods. == Developer's Notes === Win32 The Win32 version now uses a win32ole + WMI approach to getting information. This means that the WMI service must be running on the target machine in order to work (which it is, by default). Note that, by default, local user and group information is retrieved instead of global. You probably do NOT want to iterate over global users or groups because there can be quite a few on your domain. == Future Plans The following methods will be added for both platforms: * Admin.add_user * Admin.config_user * Admin.delete_user == Known Bugs None that I'm aware of. If you find any, please log them on the project page at http://www.rubyforge.org/projects/sysutils. == License Ruby's == Copyright (C) 2005, Daniel J. Berger All Rights Reserved == Author Daniel J. Berger djberg96@yahoo.com IRC nickname: imperator/mok/rubyhacker1