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