diff --git a/resources/lib/UnityGroup.php b/resources/lib/UnityGroup.php index ab2c7270..184bb747 100644 --- a/resources/lib/UnityGroup.php +++ b/resources/lib/UnityGroup.php @@ -265,10 +265,6 @@ public function cancelGroupJoinRequest($user, $send_mail = true) // $ldapPiGroupEntry = $this->getLDAPPiGroup(); // if ($ldapPiGroupEntry->exists()) { // $ldapPiGroupEntry->delete(); - // $this->REDIS->removeCacheArray("sorted_groups", "", $this->getPIUID()); - // foreach ($users as $user) { - // $this->REDIS->removeCacheArray($user->getUID(), "groups", $this->getPIUID()); - // } // } // // send email to every user of the now deleted PI group @@ -532,9 +528,6 @@ private function init() $ldapPiGroupEntry->setAttribute("memberuid", array($owner->getUID())); $ldapPiGroupEntry->write(); } - - $this->REDIS->appendCacheArray("sorted_groups", "", $this->getPIUID()); - // TODO if we ever make this project based, we need to update the cache here with the memberuid } diff --git a/resources/lib/UnityLDAP.php b/resources/lib/UnityLDAP.php index 61371638..73308309 100644 --- a/resources/lib/UnityLDAP.php +++ b/resources/lib/UnityLDAP.php @@ -224,46 +224,19 @@ public function getUnassignedID($uid, $UnitySQL) public function getAllUsers($UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook, $ignorecache = false) { $out = array(); - - if (!$ignorecache) { - $users = $UnityRedis->getCache("sorted_users", ""); - if (!is_null($users)) { - foreach ($users as $user) { - array_push($out, new UnityUser($user, $this, $UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook)); - } - - return $out; - } - } - $users = $this->userGroup->getAttribute("memberuid"); sort($users); foreach ($users as $user) { $params = array($user, $this, $UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook); array_push($out, new UnityUser(...$params)); } - return $out; } public function getAllPIGroups($UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook, $ignorecache = false) { $out = array(); - - if (!$ignorecache) { - $groups = $UnityRedis->getCache("sorted_groups", ""); - if (!is_null($groups)) { - foreach ($groups as $group) { - $params = array($group, $this, $UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook); - array_push($out, new UnityGroup(...$params)); - } - - return $out; - } - } - $pi_groups = $this->pi_groupOU->getChildren(true); - foreach ($pi_groups as $pi_group) { array_push($out, new UnityGroup( $pi_group->getAttribute("cn")[0], @@ -274,27 +247,13 @@ public function getAllPIGroups($UnitySQL, $UnityMailer, $UnityRedis, $UnityWebho $UnityWebhook )); } - return $out; } public function getAllOrgGroups($UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook, $ignorecache = false) { $out = array(); - - if (!$ignorecache) { - $orgs = $UnityRedis->getCache("sorted_orgs", ""); - if (!is_null($orgs)) { - foreach ($orgs as $org) { - array_push($out, new UnityOrg($org, $this, $UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook)); - } - - return $out; - } - } - $org_groups = $this->org_groupOU->getChildren(true); - foreach ($org_groups as $org_group) { array_push($out, new UnityOrg( $org_group->getAttribute("cn")[0], @@ -305,7 +264,6 @@ public function getAllOrgGroups($UnitySQL, $UnityMailer, $UnityRedis, $UnityWebh $UnityWebhook )); } - return $out; } diff --git a/resources/lib/UnityOrg.php b/resources/lib/UnityOrg.php index c965d628..2b414bb9 100644 --- a/resources/lib/UnityOrg.php +++ b/resources/lib/UnityOrg.php @@ -36,8 +36,6 @@ public function init() $org_group->setAttribute("gidnumber", strval($nextGID)); $org_group->write(); } - - $this->REDIS->appendCacheArray("sorted_orgs", "", $this->getOrgID()); } public function exists() diff --git a/resources/lib/UnityUser.php b/resources/lib/UnityUser.php index e1465251..29b79dd7 100644 --- a/resources/lib/UnityUser.php +++ b/resources/lib/UnityUser.php @@ -115,9 +115,6 @@ public function init($send_mail = true) $this->LDAP->getUserGroup()->appendAttribute("memberuid", $this->getUID()); $this->LDAP->getUserGroup()->write(); - // add user to cache - $this->REDIS->appendCacheArray("sorted_users", "", $this->getUID()); - // // add to audit log // diff --git a/workers/update-ldap-cache.php b/workers/update-ldap-cache.php index 4b2a0ed3..842c409f 100755 --- a/workers/update-ldap-cache.php +++ b/workers/update-ldap-cache.php @@ -38,8 +38,6 @@ $users = $LDAP->search("objectClass=posixAccount", $CONFIG["ldap"]["basedn"]); echo "response received.\n"; $user_CNs = $LDAP->getUserGroup()->getAttribute("memberuid"); - sort($user_CNs); - $REDIS->setCache("sorted_users", "", $user_CNs); foreach ($users as $user) { $uid = $user->getAttribute("cn")[0]; if (!in_array($uid, $user_CNs)) { @@ -61,8 +59,6 @@ // phpcs:disable $org_group_CNs = array_map(function($x){return $x["cn"][0];}, $org_groups); // phpcs:enable - sort($org_group_CNs); - $REDIS->setCache("sorted_orgs", "", $org_group_CNs); foreach ($org_groups as $org_group) { $gid = $org_group["cn"][0]; $REDIS->setCache($gid, "members", (@$org_group["memberuid"] ?? [])); @@ -75,9 +71,6 @@ // phpcs:disable $pi_group_CNs = array_map(function($x){return $x["cn"][0];}, $pi_groups); // phpcs:enable - sort($pi_group_CNs); - // FIXME should be sorted_pi_groups - $REDIS->setCache("sorted_groups", "", $pi_group_CNs); $user_pi_group_member_of = []; foreach ($user_CNs as $uid) {