[system] / trunk / webwork / system / scripts / newpassword.pl Repository:
ViewVC logotype

View of /trunk/webwork/system/scripts/newpassword.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 70 - (download) (as text) (annotate)
Mon Jun 25 18:20:05 2001 UTC (18 years, 5 months ago) by sam
File size: 1890 byte(s)
Removed unneeded scripts (as per discussion with gage, apizer). Added
BEGIN-block method for library inclusion to command-line scripts.

    1 #!/usr/local/bin/webwork-perl
    2 
    3 ## $Id$
    4 
    5 ## newpassword.pl takes as arguments the course, loginname and newpassword
    6 ##  e.g. newpassword.pl demoCourse dummy 000-00-0000
    7 
    8 ## NOTE: this should only be run by the professor
    9 
   10 BEGIN {
   11   my $useLibDir = '.';
   12   if    ($0 =~ m|^(/.*)/|)  { $useLibDir = $1; }
   13   elsif ($0 =~ m|^(\..*)/|) { $useLibDir = $1; }
   14   elsif ($0 =~ m|^(.+)/|)   { $useLibDir = "./$1"; }
   15   unshift @INC, $useLibDir;
   16 }
   17 
   18 use webworkInit; # WeBWorKInitLine
   19 use Global;
   20 use Auth;
   21 
   22 $course      = $ARGV[0];
   23 $login_name  = $ARGV[1];
   24 $newPassword = $ARGV[2];
   25 
   26 if(@ARGV != 3)
   27   {print "\nSyntax is: newpassword.pl coursename loginname newpassword\n";
   28    print "     (e.g. newpassword.pl demoCourse aa001c 3ldI9y)\n\n";
   29    exit(0);
   30   }
   31 &Global::getCourseEnvironment($course);
   32 my $passwordFile = &Global::getCoursePasswordFile($course);
   33 my $permissionsFile = &Global::getCoursePermissionsFile($course);
   34 
   35 print "$login_name, $newPassword, $passwordFile\n";
   36 
   37 &new_password($login_name, $newPassword, $passwordFile);
   38 unless (defined &get_permissions($login_name, $permissionsFile))
   39   { &put_permissions(0,$login_name,$permissionsFile);}
   40 
   41 # leave permissions as the originally were. Now if someone in the group runs this
   42 #script, they will not get an error message
   43 
   44 #chmod($Global::password_permission, $passwordFile) ||
   45 #                             die "Can't do chmod($Global::password_permission, $passwordFile)";
   46 #chown(-1,$Global::numericalGroupID,$passwordFile)  ||
   47 #                             die "Can't do chown(-1,$Global::numericalGroupID,$passwordFile)";
   48 #
   49 #chmod($Global::permissions_permission, $permissionsFile) ||
   50 #                             die "Can't do chmod($Global::permissions_permission, $permissionsFile)";
   51 #chown(-1,$Global::numericalGroupID,$permissionsFile)  ||
   52 #                             die "Can't do chown(-1,$Global::numericalGroupID,$permissionsFile)";
   53 
   54 
   55 

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9