#!/usr/local/bin/perl # ################################################################## # Copyright @ 1995-1999 University of Rochester # All Rights Reserved # ################################################################## use lib '/ww/webwork/gage_system/webwork/system/lib/'; # mainWeBWorKDirectory ## setTAPermissions.pl takes as arguments the coursename and TAs login_name ## e.g. setTAPermissions.pl demoCourse jsmith ## NOTE: this should only be run by the professor use Global; use Auth; use strict; if(@ARGV != 2) {print "\nSyntax is setTAPermissions.pl coursename TALoginName\n"; print " (e.g. setTAPermissions.pl demoCourse jsmith) \n\n"; exit(0); } my $course = $ARGV[0]; my $user = $ARGV[1]; &Global::getCourseEnvironment($course); my $permissionsFile = &Global::getCoursePermissionsFile($course); my $scriptDirectory = &Global::getWebworkScriptDirectory($course); require "${scriptDirectory}$Global::FILE_pl"; # first verify that the user already has a permission set if ( defined( &get_permissions($user,$permissionsFile) ) ) { if ( &put_permissions($Global::TA_permissions,$user,$permissionsFile) ) { print "TA permissions set for $user\n\n"; } else { print "setTAPermissions.pl: Unable to set permissions for $user\n\n"; } } else { print "User $user is not listed in the permissions file\n"; print "Cannot set TA permissions for $user\n\n"; } print "Printout of permissions file\n"; my %perm_hash =get_hash_from_db($permissionsFile); my(@permKeys) = sort keys %perm_hash; my $key; foreach $key (@permKeys) { print "login = $key permissions = $perm_hash{$key}\n"; }