Skip to content

Commit

Permalink
Student auto feed script update (#18)
Browse files Browse the repository at this point in the history
* Update submitty_student_auto_feed.php

* Courses that are registered in Submitty but have no enrollment data in the CSV will no longer have students sent to the NULL section.
* Now am mapped course may also be a fully registered course.  Useful to auto-enroll students into an optional psuedo-course of additional lessons.

* Updates

Some code maintenance.

I am no longer going to support remote CSV file access.  The SSH2 library is buggy and unreliable.  Further, it is not used at RPI.  This code has been removed.

* Update

WIP

* Update submitty_student_auto_feed.php

WIP

* Update submitty_student_auto_feed.php

PR candidate

* Update submitty_student_auto_feed.php

Require SSL connection to DB.
  • Loading branch information
pbailie authored and bmcutler committed Sep 9, 2019
1 parent 7867846 commit 94f5a80
Show file tree
Hide file tree
Showing 2 changed files with 206 additions and 263 deletions.
65 changes: 3 additions & 62 deletions student_auto_feed/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* config.php script used by submitty_student_auto_feed
* By Peter Bailie, Systems Programmer (RPI dept of computer science)
*
* Requires minimum PHP version 5.6 with pgsql, iconv, and ssh2 extensions.
* Requires minimum PHP version 7.0 with pgsql and iconv extensions.
*
* Configuration of submitty_student_auto_feed is structured through defined
* constants. Expanded instructions can be found at
Expand Down Expand Up @@ -49,10 +49,7 @@
// add all pertinant student-is-registered codes that can be found in
// your CSV data dump. EXAMPLE: 'RA' may mean "registered by advisor"
// and 'RW' may mean "registered via web"
define('STUDENT_REGISTERED_CODES', serialize( array(
'RA',
'RW',
)));
define('STUDENT_REGISTERED_CODES', array('RA', 'RW'));

//An exceptionally small file size can indicate a problem with the feed, and
//therefore the feed should not be processed to preserve data integrity of the
Expand All @@ -68,61 +65,9 @@
// The following constants are used to read the CSV auto feed file provided by
// the registrar / data warehouse. ***THESE NEED TO BE SET.
//
// CSV_AUTH can be set to 'local' or 'remote_password' or 'remote_keypair'.
//
// 'local' means the CSV file can be read locally by the script, so no
// remote authentication details are needed.
//
// 'remote_password' means that the file must be accessed on another
// server, and authentication is by password.
// q.v. CSV_AUTH_PASSWORD
//
// 'remote_key' means that the file must be accessed on another
// server, and authentication is by RSA key pair.
// q.v. CSV_AUTH_PUBKEY, CSV_AUTH_PRIVKEY, CSV_PRIVKEY_PASSPHRASE
//
// CSV_FILE is the full path of the student auto feed file, regardless if it is
// accessed locally or remotely.
//
// CSV_REMOTE_SERVER is the fully qualified domain name of the server that hosts
// the student feed CSV file. This constant is ignored when
// CSV_AUTH is set to 'local'.
//
// CSV_AUTH_USER is the user account to access the student feed CSV, when the
// file exists on a remote server. This constant is ignored when
// CSV_AUTH is set to 'local'.
//
// CSV_AUTH_PASSWORD is the user account password required to access the student
// feed CSV on a remote server. This constant is ignored when
// CSV_AUTH is set to anything other than 'remote_password'.
//
// CSV_AUTH_PUBKEY is the path to the public key used to authenticate with the
// remote server that has the student feed CSV. The public key
// needs to be in OpenSSH format. This constant is ignored
// when CSV_AUTH is set to anything other than 'remote_keypair'.
//
// CSV_AUTH_PRIVKEY is the path to the private key used to communicate with the
// remote server that has the student feed CSV. This constant
// is ignored when CSV_AUTH is set to anything other than
// 'remote_keypair'.
//
// CSV_PRIVKEY_PASSPHRASE is the passphrase used to encrypt the private key.
// Set to null, if the private key is not encrypted.
// This constant is ignored when CSV_AUTH is set to
// anything other than 'remote_keypair'.
// NOTE: To use encrypted keys with an Ubuntu SSH/SFTP
// host, libssh2 needs be manually recompiled with
// OpenSSH. Otherwise, authentication will always
// fail. q.v. https://bugs.php.net/bug.php?id=58573
// and http://php.net/manual/en/function.ssh2-auth-pubkey-file.php
define('CSV_AUTH', 'remote_keypair');
define('CSV_FILE', '/path/to/datafile.csv');
define('CSV_REMOTE_SERVER', 'fileserver.myuniversity.edu');
define('CSV_AUTH_USER', 'remote_user');
define('CSV_AUTH_PASSWORD', null);
define('CSV_AUTH_PUBKEY', '/path/to/rsa_key.pub');
define('CSV_AUTH_PRIVKEY', '/path/to/rsa_key.pfx');
define('CSV_PRIVKEY_PASSPHRASE', 'MySecretPassphrase');
define('CSV_FILE', '/path/to/datafile.csv');

//Define what character is delimiting each field. ***THIS NEEDS TO BE SET.
//EXAMPLE: chr(9) is the tab character.
Expand Down Expand Up @@ -161,8 +106,4 @@
//Allows "\r" EOL encoding. This is rare but exists (e.g. Excel for Macintosh).
ini_set('auto_detect_line_endings', true);

//Needed to access student feed on a remote server.
//You can comment this out if the student feed is accessed locally.
ini_set("allow_url_fopen", true);

?>
Loading

0 comments on commit 94f5a80

Please sign in to comment.