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

View of /trunk/webwork/system/scripts/removeTAPermissions.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: 1780 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 
    4 
    5 # ##################################################################
    6 # Copyright @ 1995-1998 University of Rochester
    7 # All Rights Reserved
    8 # ##################################################################
    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 
   20 ## removeTAPermissions.pl takes as arguments the coursename and TA's login_name
   21 ##  e.g. removeTAPermissions.pl demoCourse jsmith
   22 
   23 ## NOTE: this should only be run by the professor
   24 
   25 use Global;
   26 use Auth;
   27 use strict;
   28 
   29 if(@ARGV != 2) {
   30     print "\nSyntax is removeTAPermissions.pl coursename TALoginName\n";
   31     print "      (e.g. removeTAPermissions.pl demoCourse jsmith)\n\n";
   32     exit(0);
   33 }
   34 
   35 my $course = $ARGV[0];
   36 my $user = $ARGV[1];
   37 
   38 &Global::getCourseEnvironment($course);
   39 
   40 my $permissionsFile = &Global::getCoursePermissionsFile($course);
   41 my $scriptDirectory = &Global::getWebworkScriptDirectory($course);
   42 
   43 require "${scriptDirectory}$Global::FILE_pl";
   44 
   45 if (  defined( &get_permissions($user,$permissionsFile) ) ) {
   46     if ( &put_permissions(0,$user,$permissionsFile) ) {
   47         print "TA permissions removed for $user\n\n";
   48     }
   49     else {
   50     print "removeTAPermissions.pl: Unable to remove permissions for $user\n\n";
   51     }
   52 }
   53 else {
   54   print "User $user is not listed in the permissions file\n";
   55   print "Cannot remove TA permissions for $user\n\n";
   56 }
   57 
   58 print "Printout of permissions file\n";
   59 my %perm_hash =get_hash_from_db($permissionsFile);
   60 my(@permKeys) = sort keys %perm_hash;
   61 my $key;
   62 foreach $key (@permKeys) {
   63   print "login = $key       permissions =  $perm_hash{$key}\n";
   64 }
   65 

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9