Skip to content

Commit 7178033

Browse files
committed
remove sorted_users sorted_groups sorted_org
1 parent 4ca2943 commit 7178033

File tree

6 files changed

+0
-64
lines changed

6 files changed

+0
-64
lines changed

resources/lib/UnityGroup.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,6 @@ public function cancelGroupJoinRequest($user, $send_mail = true)
265265
// $ldapPiGroupEntry = $this->getLDAPPiGroup();
266266
// if ($ldapPiGroupEntry->exists()) {
267267
// $ldapPiGroupEntry->delete();
268-
// $this->REDIS->removeCacheArray("sorted_groups", "", $this->getPIUID());
269-
// foreach ($users as $user) {
270-
// $this->REDIS->removeCacheArray($user->getUID(), "groups", $this->getPIUID());
271-
// }
272268
// }
273269

274270
// // send email to every user of the now deleted PI group
@@ -532,9 +528,6 @@ private function init()
532528
$ldapPiGroupEntry->setAttribute("memberuid", array($owner->getUID()));
533529
$ldapPiGroupEntry->write();
534530
}
535-
536-
$this->REDIS->appendCacheArray("sorted_groups", "", $this->getPIUID());
537-
538531
// TODO if we ever make this project based, we need to update the cache here with the memberuid
539532
}
540533

resources/lib/UnityLDAP.php

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -224,46 +224,19 @@ public function getUnassignedID($uid, $UnitySQL)
224224
public function getAllUsers($UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook, $ignorecache = false)
225225
{
226226
$out = array();
227-
228-
if (!$ignorecache) {
229-
$users = $UnityRedis->getCache("sorted_users", "");
230-
if (!is_null($users)) {
231-
foreach ($users as $user) {
232-
array_push($out, new UnityUser($user, $this, $UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook));
233-
}
234-
235-
return $out;
236-
}
237-
}
238-
239227
$users = $this->userGroup->getAttribute("memberuid");
240228
sort($users);
241229
foreach ($users as $user) {
242230
$params = array($user, $this, $UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook);
243231
array_push($out, new UnityUser(...$params));
244232
}
245-
246233
return $out;
247234
}
248235

249236
public function getAllPIGroups($UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook, $ignorecache = false)
250237
{
251238
$out = array();
252-
253-
if (!$ignorecache) {
254-
$groups = $UnityRedis->getCache("sorted_groups", "");
255-
if (!is_null($groups)) {
256-
foreach ($groups as $group) {
257-
$params = array($group, $this, $UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook);
258-
array_push($out, new UnityGroup(...$params));
259-
}
260-
261-
return $out;
262-
}
263-
}
264-
265239
$pi_groups = $this->pi_groupOU->getChildren(true);
266-
267240
foreach ($pi_groups as $pi_group) {
268241
array_push($out, new UnityGroup(
269242
$pi_group->getAttribute("cn")[0],
@@ -274,27 +247,13 @@ public function getAllPIGroups($UnitySQL, $UnityMailer, $UnityRedis, $UnityWebho
274247
$UnityWebhook
275248
));
276249
}
277-
278250
return $out;
279251
}
280252

281253
public function getAllOrgGroups($UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook, $ignorecache = false)
282254
{
283255
$out = array();
284-
285-
if (!$ignorecache) {
286-
$orgs = $UnityRedis->getCache("sorted_orgs", "");
287-
if (!is_null($orgs)) {
288-
foreach ($orgs as $org) {
289-
array_push($out, new UnityOrg($org, $this, $UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook));
290-
}
291-
292-
return $out;
293-
}
294-
}
295-
296256
$org_groups = $this->org_groupOU->getChildren(true);
297-
298257
foreach ($org_groups as $org_group) {
299258
array_push($out, new UnityOrg(
300259
$org_group->getAttribute("cn")[0],
@@ -305,7 +264,6 @@ public function getAllOrgGroups($UnitySQL, $UnityMailer, $UnityRedis, $UnityWebh
305264
$UnityWebhook
306265
));
307266
}
308-
309267
return $out;
310268
}
311269

resources/lib/UnityOrg.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ public function init()
3636
$org_group->setAttribute("gidnumber", strval($nextGID));
3737
$org_group->write();
3838
}
39-
40-
$this->REDIS->appendCacheArray("sorted_orgs", "", $this->getOrgID());
4139
}
4240

4341
public function exists()

resources/lib/UnityUser.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,6 @@ public function init($send_mail = true)
115115
$this->LDAP->getUserGroup()->appendAttribute("memberuid", $this->getUID());
116116
$this->LDAP->getUserGroup()->write();
117117

118-
// add user to cache
119-
$this->REDIS->appendCacheArray("sorted_users", "", $this->getUID());
120-
121118
//
122119
// add to audit log
123120
//

test/functional/NewUserTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ private function ensureUserDoesNotExist()
6565
$all_users_group->write();
6666
assert(!in_array($USER->getUID(), $all_users_group->getAttribute("memberuid")));
6767
}
68-
$REDIS->removeCacheArray("sorted_users", "", $USER->getUID());
6968
}
7069

7170
private function ensureOrgGroupDoesNotExist()
@@ -76,7 +75,6 @@ private function ensureOrgGroupDoesNotExist()
7675
$org_group->getLDAPOrgGroup()->delete();
7776
assert(!$org_group->exists());
7877
}
79-
$REDIS->removeCacheArray("sorted_orgs", "", $USER->getOrgGroup()->getOrgID());
8078
}
8179

8280
private function ensureUserNotInPIGroup(UnityGroup $pi_group)
@@ -95,7 +93,6 @@ private function ensurePIGroupDoesNotExist()
9593
$USER->getPIGroup()->getLDAPPIGroup()->delete();
9694
assert(!$USER->getPIGroup()->exists());
9795
}
98-
$REDIS->removeCacheArray("sorted_groups", "", $USER->getPIGroup()->getPIUID());
9996
}
10097

10198
public function testCreateUserByJoinGoup()

workers/update-ldap-cache.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@
3838
$users = $LDAP->search("objectClass=posixAccount", $CONFIG["ldap"]["basedn"]);
3939
echo "response received.\n";
4040
$user_CNs = $LDAP->getUserGroup()->getAttribute("memberuid");
41-
sort($user_CNs);
42-
$REDIS->setCache("sorted_users", "", $user_CNs);
4341
foreach ($users as $user) {
4442
$uid = $user->getAttribute("cn")[0];
4543
if (!in_array($uid, $user_CNs)) {
@@ -61,8 +59,6 @@
6159
// phpcs:disable
6260
$org_group_CNs = array_map(function($x){return $x["cn"][0];}, $org_groups);
6361
// phpcs:enable
64-
sort($org_group_CNs);
65-
$REDIS->setCache("sorted_orgs", "", $org_group_CNs);
6662
foreach ($org_groups as $org_group) {
6763
$gid = $org_group["cn"][0];
6864
$REDIS->setCache($gid, "members", (@$org_group["memberuid"] ?? []));
@@ -75,9 +71,6 @@
7571
// phpcs:disable
7672
$pi_group_CNs = array_map(function($x){return $x["cn"][0];}, $pi_groups);
7773
// phpcs:enable
78-
sort($pi_group_CNs);
79-
// FIXME should be sorted_pi_groups
80-
$REDIS->setCache("sorted_groups", "", $pi_group_CNs);
8174

8275
$user_pi_group_member_of = [];
8376
foreach ($user_CNs as $uid) {

0 commit comments

Comments
 (0)