@@ -18,7 +18,6 @@ class UnityGroup
1818 private $ SQL ;
1919 private $ MAILER ;
2020 private $ WEBHOOK ;
21- private $ REDIS ;
2221
2322 /**
2423 * Constructor for the object
@@ -27,14 +26,13 @@ class UnityGroup
2726 * @param LDAP $LDAP LDAP Connection
2827 * @param SQL $SQL SQL Connection
2928 */
30- public function __construct ($ pi_uid , $ LDAP , $ SQL , $ MAILER , $ REDIS , $ WEBHOOK )
29+ public function __construct ($ pi_uid , $ LDAP , $ SQL , $ MAILER , $ WEBHOOK )
3130 {
3231 $ this ->pi_uid = $ pi_uid ;
3332
3433 $ this ->LDAP = $ LDAP ;
3534 $ this ->SQL = $ SQL ;
3635 $ this ->MAILER = $ MAILER ;
37- $ this ->REDIS = $ REDIS ;
3836 $ this ->WEBHOOK = $ WEBHOOK ;
3937 }
4038
@@ -221,11 +219,6 @@ public function removeGroup($send_mail = true)
221219 if (!$ ldapPiGroupEntry ->delete ()) {
222220 throw new Exception ("Unable to delete PI ldap group " );
223221 }
224-
225- $ this ->REDIS ->removeCacheArray ("sorted_groups " , "" , $ this ->getPIUID ());
226- foreach ($ users as $ user ) {
227- $ this ->REDIS ->removeCacheArray ($ user ->getUID (), "groups " , $ this ->getPIUID ());
228- }
229222 }
230223
231224 // send email to every user of the now deleted PI group
@@ -398,7 +391,6 @@ public function getRequests()
398391 $ this ->LDAP ,
399392 $ this ->SQL ,
400393 $ this ->MAILER ,
401- $ this ->REDIS ,
402394 $ this ->WEBHOOK
403395 );
404396 array_push ($ out , [$ user , $ request ["timestamp " ]]);
@@ -407,43 +399,25 @@ public function getRequests()
407399 return $ out ;
408400 }
409401
410- public function getGroupMembers ($ ignorecache = false )
402+ public function getGroupMembers ()
411403 {
412- if (!$ ignorecache ) {
413- $ cached_val = $ this ->REDIS ->getCache ($ this ->getPIUID (), "members " );
414- if (!is_null ($ cached_val )) {
415- $ members = $ cached_val ;
416- }
417- }
418-
419- $ updatecache = false ;
420404 if (!isset ($ members )) {
421405 $ pi_group = $ this ->getLDAPPiGroup ();
422406 $ members = $ pi_group ->getAttribute ("memberuid " );
423- $ updatecache = true ;
424407 }
425408
426409 $ out = array ();
427- $ cache_arr = array ();
428410 $ owner_uid = $ this ->getOwner ()->getUID ();
429411 foreach ($ members as $ member ) {
430412 $ user_obj = new UnityUser (
431413 $ member ,
432414 $ this ->LDAP ,
433415 $ this ->SQL ,
434416 $ this ->MAILER ,
435- $ this ->REDIS ,
436417 $ this ->WEBHOOK
437418 );
438419 array_push ($ out , $ user_obj );
439- array_push ($ cache_arr , $ user_obj ->getUID ());
440420 }
441-
442- if (!$ ignorecache && $ updatecache ) {
443- sort ($ cache_arr );
444- $ this ->REDIS ->setCache ($ this ->getPIUID (), "members " , $ cache_arr );
445- }
446-
447421 return $ out ;
448422 }
449423
@@ -492,10 +466,6 @@ private function init()
492466 throw new Exception ("Failed to create POSIX group for " . $ owner ->getUID ()); // this shouldn't execute
493467 }
494468 }
495-
496- $ this ->REDIS ->appendCacheArray ("sorted_groups " , "" , $ this ->getPIUID ());
497-
498- // TODO if we ever make this project based, we need to update the cache here with the memberuid
499469 }
500470
501471 private function addUserToGroup ($ new_user )
@@ -507,9 +477,6 @@ private function addUserToGroup($new_user)
507477 if (!$ pi_group ->write ()) {
508478 throw new Exception ("Unable to write PI group " );
509479 }
510-
511- $ this ->REDIS ->appendCacheArray ($ this ->getPIUID (), "members " , $ new_user ->getUID ());
512- $ this ->REDIS ->appendCacheArray ($ new_user ->getUID (), "groups " , $ this ->getPIUID ());
513480 }
514481
515482 private function removeUserFromGroup ($ old_user )
@@ -521,9 +488,6 @@ private function removeUserFromGroup($old_user)
521488 if (!$ pi_group ->write ()) {
522489 throw new Exception ("Unable to write PI group " );
523490 }
524-
525- $ this ->REDIS ->removeCacheArray ($ this ->getPIUID (), "members " , $ old_user ->getUID ());
526- $ this ->REDIS ->removeCacheArray ($ old_user ->getUID (), "groups " , $ this ->getPIUID ());
527491 }
528492
529493 public function userExists ($ user )
@@ -552,7 +516,6 @@ public function getOwner()
552516 $ this ->LDAP ,
553517 $ this ->SQL ,
554518 $ this ->MAILER ,
555- $ this ->REDIS ,
556519 $ this ->WEBHOOK
557520 );
558521 }
0 commit comments