home *** CD-ROM | disk | FTP | other *** search
/ Peanuts NeXT Software Archives / Peanuts-2.iso / Developer / webobjects / extensions / win-nt / NTPerl5-109.exe / Lib / Win32 / NETADMIN.PM < prev    next >
Encoding:
Perl POD Document  |  1996-06-04  |  4.8 KB  |  185 lines

  1. package Win32::NetAdmin;
  2.  
  3. #
  4. #NetAdmin.pm
  5. #Written by Douglas Lankshear for hip communications.
  6. #
  7.  
  8. require Exporter;
  9. require DynaLoader;
  10.  
  11. die "The Win32::NetAdmin module works only on Windows NT" if(!Win32::IsWinNT() );
  12.  
  13. @ISA= qw( Exporter DynaLoader );
  14. # Items to export into callers namespace by default. Note: do not export
  15. # names by default without a very good reason. Use EXPORT_OK instead.
  16. # Do not simply export all your public functions/methods/constants.
  17. @EXPORT = qw(
  18.     FILTER_TEMP_DUPLICATE_ACCOUNT
  19.     FILTER_NORMAL_ACCOUNT
  20.     FILTER_INTERDOMAIN_TRUST_ACCOUNT
  21.     FILTER_WORKSTATION_TRUST_ACCOUNT
  22.     FILTER_SERVER_TRUST_ACCOUNT
  23.     UF_TEMP_DUPLICATE_ACCOUNT
  24.     UF_NORMAL_ACCOUNT
  25.     UF_INTERDOMAIN_TRUST_ACCOUNT
  26.     UF_WORKSTATION_TRUST_ACCOUNT
  27.     UF_SERVER_TRUST_ACCOUNT
  28.     UF_MACHINE_ACCOUNT_MASK
  29.     UF_ACCOUNT_TYPE_MASK
  30.     UF_DONT_EXPIRE_PASSWD
  31.     UF_SETTABLE_BITS
  32.     UF_SCRIPT
  33.     UF_ACCOUNTDISABLE
  34.     UF_HOMEDIR_REQUIRED
  35.     UF_LOCKOUT
  36.     UF_PASSWD_NOTREQD
  37.     UF_PASSWD_CANT_CHANGE
  38.     USE_FORCE
  39.     USE_LOTS_OF_FORCE
  40.     USE_NOFORCE
  41.     USER_PRIV_MASK
  42.     USER_PRIV_GUEST
  43.     USER_PRIV_USER
  44.     USER_PRIV_ADMIN
  45. );
  46.  
  47. =head1 NAME
  48.  
  49. Win32::NetAdmin - manage network groups and users in perl
  50.  
  51. =head1 SYNOPSIS
  52.  
  53.     use Win32::NetAdmin;
  54.  
  55. =head1 DESCRIPTION
  56.  
  57. This module offers control over the administration of groups and users over a network.
  58.  
  59. =head1 FUNCTIONS
  60.  
  61. =head2 NOTE:
  62. all of the functions return FALSE (0) if they fail, unless otherwise noted.
  63. server is optional for all the calls below. (if not given the local machine is assumed.)
  64.  
  65. =over 10
  66.  
  67. =item GetDomainController(server, domain, returnedName)
  68.     Return the name of the domain controller for server
  69.  
  70. =item UserCreate(server, userName, password, passwordAge, privilege, homeDir, comment, flags, scriptPath)
  71.     Creates a user on server with password, passwordAge, privilege, homeDir, comment, flags, and scriptPath
  72.  
  73. =item UserDelete(server, user)
  74.     Deletes a user from server
  75.  
  76. =item UserGetAttributes(server, userName, password, passwordAge, privilege, homeDir, comment, flags, scriptPath)
  77.     Gets password, passwordAge, privilege, homeDir, comment, flags, and scriptPath for user
  78.  
  79. =item UserSetAttributes(server, userName, password, passwordAge, privilege, homeDir, comment, flags, scriptPath)
  80.     Sets password, passwordAge, privilege, homeDir, comment, flags, and scriptPath for user
  81.  
  82. =item UserChangePassword(domainname, username, oldpassword, newpassword)
  83.     Changes a users password. Can be run under any account.
  84.  
  85. =item UsersExist(server, userName)
  86.     Checks if a User exists
  87.  
  88. =item GetUsers(server, filter, \@userArray)
  89.     Fills userArray with the all of the User names
  90.  
  91. =item GroupCreate(server, group, comment)
  92.     Creates a group
  93.  
  94. =item GroupDelete(server, group)
  95.     Deletes a group
  96.  
  97. =item GroupGetAttributes(server, groupName, comment)
  98.     Gets the comment
  99.  
  100. =item GroupSetAttributes(server, groupName, comment)
  101.     Sets the comment
  102.  
  103. =item GroupAddUsers(server, groupName, users)
  104.     Adds a user to a group
  105.  
  106. =item GroupDelUsers(server, groupName, users)
  107.     Deletes a users from a group
  108.  
  109. =item GroupIsMember(server, groupName, user)
  110.     Returns TRUE if user is a member of groupName
  111.  
  112. =item GroupGetMembers(server, groupName, \@userArray)
  113.     Fills userArray with the members of groupName
  114.  
  115. =item LocalGroupCreate(server, group, comment)
  116.     Creates a local group
  117.  
  118. =item LocalGroupDelete(server, group)
  119.     Deletes a local group
  120.  
  121. =item LocalGroupGetAttributes(server, groupName, comment)
  122.     Gets the comment
  123.  
  124. =item LocalGroupSetAttributes(server, groupName, comment)
  125.     Sets the comment
  126.  
  127. =item LocalGroupIsMember(server, groupName, user)
  128.     Returns TRUE if user is a member of groupName
  129.  
  130. =item LocalGroupGetMembers(server, groupName, \@userArray)
  131.     Fills userArray with the members of groupName
  132.  
  133. =item LocalGroupAddUsers(server, groupName, users)
  134.     Adds a user to a group
  135.  
  136. =item LocalGroupDelUsers(server, groupName, users)
  137.     Deletes a users from a group
  138.  
  139. =back
  140.  
  141. =cut
  142.  
  143. sub AUTOLOAD {
  144.     # This AUTOLOAD is used to 'autoload' constants from the constant()
  145.     # XS function.  If a constant is not found then control is passed
  146.     # to the AUTOLOAD in AutoLoader.
  147.  
  148.     local($constname);
  149.     ($constname = $AUTOLOAD) =~ s/.*:://;
  150.     #reset $! to zero to reset any current errors.
  151.     $!=0;
  152.     $val = constant($constname, @_ ? $_[0] : 0);
  153.     if ($! != 0) {
  154.     if ($! =~ /Invalid/) {
  155.         $AutoLoader::AUTOLOAD = $AUTOLOAD;
  156.         goto &AutoLoader::AUTOLOAD;
  157.     }
  158.     else {
  159.         ($pack,$file,$line) = caller;
  160.         die "Your vendor has not defined Win32::NetAdmin macro $constname, used in $file at line $line.";
  161.     }
  162.     }
  163.     eval "sub $AUTOLOAD { $val }";
  164.     goto &$AUTOLOAD;
  165. }
  166.  
  167. bootstrap Win32::NetAdmin;
  168.  
  169. # Preloaded methods go here.
  170.  
  171. # Autoload methods go after __END__, and are processed by the autosplit program.
  172.  
  173. 1;
  174. __END__
  175.     
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.