@@ -13,12 +13,6 @@ function cn2org($cn)
1313 return $ matches [1 ];
1414}
1515
16- function insert_plus_address ($ email , $ plus )
17- {
18- $ parts = explode ("@ " , $ email , 2 );
19- return $ parts [0 ] . "+ " . $ plus . "@ " . $ parts [1 ];
20- }
21-
2216// if array is length 1 then replace it with its one element
2317function flatten_attributes (array $ attributes ): array
2418{
@@ -30,16 +24,14 @@ function flatten_attributes(array $attributes): array
3024$ cn = strtolower (
3125 trim (readline ("Please enter the cn to be used for the course (example: cs123_umass_edu): " )),
3226);
33- $ operator_uid = trim (
34- readline (
35- "Enter the UID of the Unity team member responsible for the course (example: simonleary_umass_edu): " ,
36- ),
27+ $ teacher_uid = trim (
28+ readline ("Enter the UID of the user teaching the course (example: simonleary_umass_edu): " ),
3729);
3830$ org_gid = cn2org ($ cn );
3931
40- $ operator = new UnityUser ($ operator_uid , $ LDAP , $ SQL , $ MAILER , $ WEBHOOK );
41- if (!$ operator ->exists ()) {
42- _die ("no such user: ' $ operator_uid ' " , 1 );
32+ $ teacher = new UnityUser ($ teacher_uid , $ LDAP , $ SQL , $ MAILER , $ WEBHOOK );
33+ if (!$ teacher ->exists ()) {
34+ _die ("no such user: ' $ teacher_uid ' " , 1 );
4335}
4436
4537$ course_user = new UnityUser ($ cn , $ LDAP , $ SQL , $ MAILER , $ WEBHOOK );
@@ -51,7 +43,7 @@ function flatten_attributes(array $attributes): array
5143if (!$ org ->exists ()) {
5244 print "WARNING: creating new org ' $ org_gid'... \n" ;
5345}
54- $ mail = insert_plus_address ( $ operator ->getMail (), $ cn );
46+ $ mail = $ teacher ->getMail ();
5547$ course_user ->init ($ givenName , $ sn , $ mail , $ org_gid );
5648
5749$ course_pi_group = $ course_user ->getPIGroup ();
@@ -73,6 +65,6 @@ function flatten_attributes(array $attributes): array
7365 JSON_PRETTY_PRINT ,
7466);
7567
76- $ course_pi_group ->newUserRequest ($ operator , false );
77- $ course_pi_group ->approveUser ($ operator );
68+ $ course_pi_group ->newUserRequest ($ teacher , false );
69+ $ course_pi_group ->approveUser ($ teacher );
7870
0 commit comments