WeBWorK Main Forum

adding new admins to all previous courses

adding new admins to all previous courses

by Mike Malone -
Number of replies: 1

Greetings,

Currently handling course creation on a WW 2.19 server. I'm an "admin" on the server.
We've added another "admin" but they don't have access to the courses that were created before they came onboard. I can manually add them individually to the courses since I was already an admin when the courses were create, but we are talking dozens of courses. Is there a way to add the new "admin" to all the existing courses in bulk?

Thanks,

Mike

In reply to Mike Malone

adding new admins to all previous courses

by Danny Glin -

You can take advantage of the scripts in /opt/webwork/webwork2/bin to help with this.

Make a copy of /opt/webwork/webwork2/bin/addadmin (e.g. addlocaladmin), and edit that file with the details for your new admin.  Most of the field names in the script are self-explanatory.  In the second line, the first argument of crypt is the plaintext password, so replace that instance of "admin" with the administrator's password (assuming that WeBWorK is managing passwords for you.  If you're using an external authentication service you can delete that line).

Once you have your new addlocaladmin script you can run it as follows (replace [coursename] with the name of an individual course):

cd /opt/webwork/webwork2/bin
./wwsh [coursename] ./addlocaladmin

The following command should run the script on all of the courses on your server.  I haven't actually tested this.

for coursename in `ls /opt/webwork/courses`; do /opt/webwork/webwork2/bin/wwsh $coursename /opt/webwork/webwork2/bin/addlocaladmin; done