Skip to content

Commit bab6f45

Browse files
committed
UnityOrg as well
1 parent 29d74a3 commit bab6f45

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

resources/lib/UnityOrg.php

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66

77
class UnityOrg
88
{
9-
private $orgid;
9+
public $gid;
1010

1111
private $MAILER;
1212
private $SQL;
1313
private $LDAP;
1414
private $REDIS;
1515
private $WEBHOOK;
1616

17-
public function __construct($orgid, $LDAP, $SQL, $MAILER, $REDIS, $WEBHOOK)
17+
public function __construct($gid, $LDAP, $SQL, $MAILER, $REDIS, $WEBHOOK)
1818
{
19-
$this->orgid = $orgid;
19+
$this->gid = $gid;
2020

2121
$this->LDAP = $LDAP;
2222
$this->SQL = $SQL;
@@ -37,7 +37,7 @@ public function init()
3737
$org_group->write();
3838
}
3939

40-
$this->REDIS->appendCacheArray("sorted_orgs", "", $this->getOrgID());
40+
$this->REDIS->appendCacheArray("sorted_orgs", "", $this->gid);
4141
}
4242

4343
public function exists()
@@ -47,12 +47,7 @@ public function exists()
4747

4848
public function getLDAPOrgGroup()
4949
{
50-
return $this->LDAP->getOrgGroupEntry($this->orgid);
51-
}
52-
53-
public function getOrgID()
54-
{
55-
return $this->orgid;
50+
return $this->LDAP->getOrgGroupEntry($this->gid);
5651
}
5752

5853
public function inOrg($user, $ignorecache = false)
@@ -82,7 +77,7 @@ public function getOrgMembers($ignorecache = false)
8277
public function getOrgMemberUIDs($ignorecache = false)
8378
{
8479
if (!$ignorecache) {
85-
$cached_val = $this->REDIS->getCache($this->getOrgID(), "members");
80+
$cached_val = $this->REDIS->getCache($this->gid, "members");
8681
if (!is_null($cached_val)) {
8782
$members = $cached_val;
8883
}
@@ -95,7 +90,7 @@ public function getOrgMemberUIDs($ignorecache = false)
9590
}
9691
if (!$ignorecache && $updatecache) {
9792
sort($members);
98-
$this->REDIS->setCache($this->getOrgID(), "members", $members);
93+
$this->REDIS->setCache($this->gid, "members", $members);
9994
}
10095
return $members;
10196
}
@@ -105,14 +100,14 @@ public function addUser($user)
105100
$org_group = $this->getLDAPOrgGroup();
106101
$org_group->appendAttribute("memberuid", $user->getUID());
107102
$org_group->write();
108-
$this->REDIS->appendCacheArray($this->getOrgID(), "members", $user->getUID());
103+
$this->REDIS->appendCacheArray($this->gid, "members", $user->getUID());
109104
}
110105

111106
public function removeUser($user)
112107
{
113108
$org_group = $this->getLDAPOrgGroup();
114109
$org_group->removeAttributeEntryByValue("memberuid", $user->getUID());
115110
$org_group->write();
116-
$this->REDIS->removeCacheArray($this->getOrgID(), "members", $user->getUID());
111+
$this->REDIS->removeCacheArray($this->gid, "members", $user->getUID());
117112
}
118113
}

0 commit comments

Comments
 (0)