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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11 - (download) (as text) (annotate)
Mon Jun 18 15:21:51 2001 UTC (11 years, 11 months ago) by sam
File size: 1646 byte(s)
another setup script test (changed #! lines)

    1 #!/usr/local/bin/webwork-perl
    2 
    3 # ##################################################################
    4 # Copyright @ 1995-1999 University of Rochester
    5 # All Rights Reserved
    6 # ##################################################################
    7 
    8 use lib '.'; use webworkInit; # WeBWorKInitLine
    9 
   10 ## setTAPermissions.pl takes as arguments the coursename and TAs login_name
   11 ##  e.g. setTAPermissions.pl demoCourse jsmith
   12 
   13 ## NOTE: this should only be run by the professor
   14 
   15 use Global;
   16 use Auth;
   17 use strict;
   18 
   19 if(@ARGV != 2)
   20   {print "\nSyntax is setTAPermissions.pl coursename TALoginName\n";
   21    print "      (e.g. setTAPermissions.pl demoCourse jsmith) \n\n";
   22    exit(0);
   23   }
   24 
   25 my $course = $ARGV[0];
   26 my $user = $ARGV[1];
   27 
   28 &Global::getCourseEnvironment($course);
   29 
   30 my $permissionsFile = &Global::getCoursePermissionsFile($course);
   31 my $scriptDirectory = &Global::getWebworkScriptDirectory($course);
   32 
   33 require "${scriptDirectory}$Global::FILE_pl";
   34 
   35 # first verify that the user already has a permission set
   36 
   37 if (  defined( &get_permissions($user,$permissionsFile) ) ) {
   38     if ( &put_permissions($Global::TA_permissions,$user,$permissionsFile) ) {
   39         print "TA permissions set for $user\n\n";
   40     }
   41     else {
   42         print "setTAPermissions.pl: Unable to set permissions for $user\n\n";
   43     }
   44 }
   45 else {
   46   print "User $user is not listed in the permissions file\n";
   47   print "Cannot set TA permissions for $user\n\n";
   48 }
   49 
   50 
   51 print "Printout of permissions file\n";
   52 my %perm_hash =get_hash_from_db($permissionsFile);
   53 my(@permKeys) = sort keys %perm_hash;
   54 my $key;
   55 foreach $key (@permKeys) {
   56   print "login = $key       permissions =  $perm_hash{$key}\n";
   57 }
   58 
   59 

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9