Skip to content

Commit 94f5a80

Browse files
pbailiebmcutler
authored andcommitted
Student auto feed script update (#18)
* 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.
1 parent 7867846 commit 94f5a80

File tree

2 files changed

+206
-263
lines changed

2 files changed

+206
-263
lines changed

student_auto_feed/config.php

Lines changed: 3 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* config.php script used by submitty_student_auto_feed
66
* By Peter Bailie, Systems Programmer (RPI dept of computer science)
77
*
8-
* Requires minimum PHP version 5.6 with pgsql, iconv, and ssh2 extensions.
8+
* Requires minimum PHP version 7.0 with pgsql and iconv extensions.
99
*
1010
* Configuration of submitty_student_auto_feed is structured through defined
1111
* constants. Expanded instructions can be found at
@@ -49,10 +49,7 @@
4949
// add all pertinant student-is-registered codes that can be found in
5050
// your CSV data dump. EXAMPLE: 'RA' may mean "registered by advisor"
5151
// and 'RW' may mean "registered via web"
52-
define('STUDENT_REGISTERED_CODES', serialize( array(
53-
'RA',
54-
'RW',
55-
)));
52+
define('STUDENT_REGISTERED_CODES', array('RA', 'RW'));
5653

5754
//An exceptionally small file size can indicate a problem with the feed, and
5855
//therefore the feed should not be processed to preserve data integrity of the
@@ -68,61 +65,9 @@
6865
// The following constants are used to read the CSV auto feed file provided by
6966
// the registrar / data warehouse. ***THESE NEED TO BE SET.
7067
//
71-
// CSV_AUTH can be set to 'local' or 'remote_password' or 'remote_keypair'.
72-
//
73-
// 'local' means the CSV file can be read locally by the script, so no
74-
// remote authentication details are needed.
75-
//
76-
// 'remote_password' means that the file must be accessed on another
77-
// server, and authentication is by password.
78-
// q.v. CSV_AUTH_PASSWORD
79-
//
80-
// 'remote_key' means that the file must be accessed on another
81-
// server, and authentication is by RSA key pair.
82-
// q.v. CSV_AUTH_PUBKEY, CSV_AUTH_PRIVKEY, CSV_PRIVKEY_PASSPHRASE
83-
//
8468
// CSV_FILE is the full path of the student auto feed file, regardless if it is
8569
// accessed locally or remotely.
86-
//
87-
// CSV_REMOTE_SERVER is the fully qualified domain name of the server that hosts
88-
// the student feed CSV file. This constant is ignored when
89-
// CSV_AUTH is set to 'local'.
90-
//
91-
// CSV_AUTH_USER is the user account to access the student feed CSV, when the
92-
// file exists on a remote server. This constant is ignored when
93-
// CSV_AUTH is set to 'local'.
94-
//
95-
// CSV_AUTH_PASSWORD is the user account password required to access the student
96-
// feed CSV on a remote server. This constant is ignored when
97-
// CSV_AUTH is set to anything other than 'remote_password'.
98-
//
99-
// CSV_AUTH_PUBKEY is the path to the public key used to authenticate with the
100-
// remote server that has the student feed CSV. The public key
101-
// needs to be in OpenSSH format. This constant is ignored
102-
// when CSV_AUTH is set to anything other than 'remote_keypair'.
103-
//
104-
// CSV_AUTH_PRIVKEY is the path to the private key used to communicate with the
105-
// remote server that has the student feed CSV. This constant
106-
// is ignored when CSV_AUTH is set to anything other than
107-
// 'remote_keypair'.
108-
//
109-
// CSV_PRIVKEY_PASSPHRASE is the passphrase used to encrypt the private key.
110-
// Set to null, if the private key is not encrypted.
111-
// This constant is ignored when CSV_AUTH is set to
112-
// anything other than 'remote_keypair'.
113-
// NOTE: To use encrypted keys with an Ubuntu SSH/SFTP
114-
// host, libssh2 needs be manually recompiled with
115-
// OpenSSH. Otherwise, authentication will always
116-
// fail. q.v. https://bugs.php.net/bug.php?id=58573
117-
// and http://php.net/manual/en/function.ssh2-auth-pubkey-file.php
118-
define('CSV_AUTH', 'remote_keypair');
119-
define('CSV_FILE', '/path/to/datafile.csv');
120-
define('CSV_REMOTE_SERVER', 'fileserver.myuniversity.edu');
121-
define('CSV_AUTH_USER', 'remote_user');
122-
define('CSV_AUTH_PASSWORD', null);
123-
define('CSV_AUTH_PUBKEY', '/path/to/rsa_key.pub');
124-
define('CSV_AUTH_PRIVKEY', '/path/to/rsa_key.pfx');
125-
define('CSV_PRIVKEY_PASSPHRASE', 'MySecretPassphrase');
70+
define('CSV_FILE', '/path/to/datafile.csv');
12671

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

164-
//Needed to access student feed on a remote server.
165-
//You can comment this out if the student feed is accessed locally.
166-
ini_set("allow_url_fopen", true);
167-
168109
?>

0 commit comments

Comments
 (0)