home *** CD-ROM | disk | FTP | other *** search
/ Freelog 15 / FREELOG 15.ISO / WebMaster / Perl / PERL5106.ZIP / perl5 / Lib / Win32 / NETADMIN.PM < prev    next >
Encoding:
Perl POD Document  |  1996-01-17  |  4.3 KB  |  171 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.     UF_TEMP_DUPLICATE_ACCOUNT
  19.     UF_NORMAL_ACCOUNT
  20.     UF_INTERDOMAIN_TRUST_ACCOUNT
  21.     UF_WORKSTATION_TRUST_ACCOUNT
  22.     UF_SERVER_TRUST_ACCOUNT
  23.     UF_MACHINE_ACCOUNT_MASK
  24.     UF_ACCOUNT_TYPE_MASK
  25.     UF_DONT_EXPIRE_PASSWD
  26.     UF_SETTABLE_BITS
  27.     UF_SCRIPT
  28.     UF_ACCOUNTDISABLE
  29.     UF_HOMEDIR_REQUIRED
  30.     UF_LOCKOUT
  31.     UF_PASSWD_NOTREQD
  32.     UF_PASSWD_CANT_CHANGE
  33.     USE_FORCE
  34.     USE_LOTS_OF_FORCE
  35.     USE_NOFORCE
  36.     USER_PRIV_MASK
  37.     USER_PRIV_GUEST
  38.     USER_PRIV_USER
  39.     USER_PRIV_ADMIN
  40. );
  41.  
  42. =head1 NAME
  43.  
  44. Win32::NetAdmin - manage network groups and users in perl
  45.  
  46. =head1 SYNOPSIS
  47.  
  48.     use Win32::NetAdmin;
  49.  
  50. =head1 DESCRIPTION
  51.  
  52. This module offers control over the administration of groups and users over a network.
  53.  
  54. =head1 FUNCTIONS
  55.  
  56. =head2 NOTE:
  57. all of the functions return FALSE (0) if they fail, unless otherwise noted.
  58. server is optional for all the calls below. (if not given the local machine is assumed.)
  59.  
  60. =over 10
  61.  
  62. =item GetDomainController(server, domain, returnedName)
  63.     Return the name of the domain controller for server
  64.  
  65. =item UserCreate(server, userName, password, passwordAge, privilege, homeDir, comment, flags, scriptPath)
  66.     Creates a user on server with password, passwordAge, privilege, homeDir, comment, flags, and scriptPath
  67.  
  68. =item UserDelete(server, user)
  69.     Deletes a user from server
  70.  
  71. =item UserGetAttributes(server, userName, password, passwordAge, privilege, homeDir, comment, flags, scriptPath)
  72.     Gets password, passwordAge, privilege, homeDir, comment, flags, and scriptPath for user
  73.  
  74. =item UserSetAttributes(server, userName, password, passwordAge, privilege, homeDir, comment, flags, scriptPath)
  75.     Sets password, passwordAge, privilege, homeDir, comment, flags, and scriptPath for user
  76.  
  77. =item GroupCreate(server, group, comment)
  78.     Creates a group
  79.  
  80. =item GroupDelete(server, group)
  81.     Deletes a group
  82.  
  83. =item GroupGetAttributes(server, groupName, comment)
  84.     Gets the comment
  85.  
  86. =item GroupSetAttributes(server, groupName, comment)
  87.     Sets the comment
  88.  
  89. =item GroupAddUsers(server, groupName, users)
  90.     Adds a user to a group
  91.  
  92. =item GroupDelUsers(server, groupName, users)
  93.     Deletes a users from a group
  94.  
  95. =item GroupIsMember(server, groupName, user)
  96.     Returns TRUE if user is a member of groupName
  97.  
  98. =item GroupGetMembers(server, groupName, userArray)
  99.     Fills userArray with the members of groupName
  100.  
  101. =item LocalGroupCreate(server, group, comment)
  102.     Creates a local group
  103.  
  104. =item LocalGroupDelete(server, group)
  105.     Deletes a local group
  106.  
  107. =item LocalGroupGetAttributes(server, groupName, comment)
  108.     Gets the comment
  109.  
  110. =item LocalGroupSetAttributes(server, groupName, comment)
  111.     Sets the comment
  112.  
  113. =item LocalGroupIsMember(server, groupName, user)
  114.     Returns TRUE if user is a member of groupName
  115.  
  116. =item LocalGroupGetMembers(server, groupName, userArray)
  117.     Fills userArray with the members of groupName
  118.  
  119. =item LocalGroupAddUsers(server, groupName, users)
  120.     Adds a user to a group
  121.  
  122. =item LocalGroupDelUsers(server, groupName, users)
  123.     Deletes a users from a group
  124.  
  125. =back
  126.  
  127. =cut
  128.  
  129. sub AUTOLOAD {
  130.     # This AUTOLOAD is used to 'autoload' constants from the constant()
  131.     # XS function.  If a constant is not found then control is passed
  132.     # to the AUTOLOAD in AutoLoader.
  133.  
  134.     local($constname);
  135.     ($constname = $AUTOLOAD) =~ s/.*:://;
  136.     #reset $! to zero to reset any current errors.
  137.     $!=0;
  138.     $val = constant($constname, @_ ? $_[0] : 0);
  139.     if ($! != 0) {
  140.     if ($! =~ /Invalid/) {
  141.         $AutoLoader::AUTOLOAD = $AUTOLOAD;
  142.         goto &AutoLoader::AUTOLOAD;
  143.     }
  144.     else {
  145.         ($pack,$file,$line) = caller;
  146.         die "Your vendor has not defined NetAdmin macro $constname, used in $file at line $line.";
  147.     }
  148.     }
  149.     eval "sub $AUTOLOAD { $val }";
  150.     goto &$AUTOLOAD;
  151. }
  152.  
  153. bootstrap Win32::NetAdmin;
  154.  
  155. # Preloaded methods go here.
  156.  
  157. # Autoload methods go after __END__, and are processed by the autosplit program.
  158.  
  159. 1;
  160. __END__
  161.     
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.