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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6 - (download) (as text) (annotate)
Fri Jun 15 14:29:57 2001 UTC (18 years, 7 months ago) by gage
File size: 1726 byte(s)
development version dev-1-7-01 from /ww/webwork/development 15-June-2001

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

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9