Skip to content

Commit fe6aaa0

Browse files
committed
fixes from uid/gid change
1 parent 8b01414 commit fe6aaa0

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

resources/lib/UnityGroup.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class UnityGroup
3131
public function __construct($gid, $LDAP, $SQL, $MAILER, $REDIS, $WEBHOOK)
3232
{
3333
$this->gid = $gid;
34-
$this->entry = $LDAP->getPIGroupEntry($pi_uid);
34+
$this->entry = $LDAP->getPIGroupEntry($gid);
3535

3636
$this->LDAP = $LDAP;
3737
$this->SQL = $SQL;
@@ -537,19 +537,19 @@ private function init()
537537
private function addUserToGroup($new_user)
538538
{
539539
// Add to LDAP Group
540-
$this->entry->appendAttribute("memberuid", $new_user->getUID());
540+
$this->entry->appendAttribute("memberuid", $new_user->uid);
541541
$this->entry->write();
542-
$this->REDIS->appendCacheArray($this->getPIUID(), "members", $new_user->uid);
543-
$this->REDIS->appendCacheArray($new_user->getUID(), "groups", $this->gid);
542+
$this->REDIS->appendCacheArray($this->gid, "members", $new_user->uid);
543+
$this->REDIS->appendCacheArray($new_user->uid, "groups", $this->gid);
544544
}
545545

546546
private function removeUserFromGroup($old_user)
547547
{
548548
// Remove from LDAP Group
549549
$this->entry->removeAttributeEntryByValue("memberuid", $old_user->uid);
550550
$this->entry->write();
551-
$this->REDIS->removeCacheArray($this->getPIUID(), "members", $old_user->uid);
552-
$this->REDIS->removeCacheArray($old_user->getUID(), "groups", $this->gid);
551+
$this->REDIS->removeCacheArray($this->gid, "members", $old_user->uid);
552+
$this->REDIS->removeCacheArray($old_user->uid, "groups", $this->gid);
553553
}
554554

555555
public function userExists($user)
@@ -578,7 +578,7 @@ public function getOwner()
578578
);
579579
}
580580

581-
public static function getPIUIDfromUID($uid)
581+
public static function ownerUID2GID($uid)
582582
{
583583
return self::PI_PREFIX . $uid;
584584
}

resources/lib/UnityUser.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public function getOrg($ignorecache = false)
198198
public function setFirstname($firstname, $operator = null)
199199
{
200200
$this->entry->setAttribute("givenname", $firstname);
201-
$operator = is_null($operator) ? $this->getUID() : $operator->uid;
201+
$operator = is_null($operator) ? $this->uid : $operator->uid;
202202

203203
$this->SQL->addLog(
204204
$operator,
@@ -247,7 +247,7 @@ public function getFirstname($ignorecache = false)
247247
public function setLastname($lastname, $operator = null)
248248
{
249249
$this->entry->setAttribute("sn", $lastname);
250-
$operator = is_null($operator) ? $this->getUID() : $operator->uid;
250+
$operator = is_null($operator) ? $this->uid : $operator->uid;
251251

252252
$this->SQL->addLog(
253253
$operator,
@@ -302,7 +302,7 @@ public function getFullname()
302302
public function setMail($email, $operator = null)
303303
{
304304
$this->entry->setAttribute("mail", $email);
305-
$operator = is_null($operator) ? $this->getUID() : $operator->uid;
305+
$operator = is_null($operator) ? $this->uid : $operator->uid;
306306

307307
$this->SQL->addLog(
308308
$operator,
@@ -350,7 +350,7 @@ public function getMail($ignorecache = false)
350350
*/
351351
public function setSSHKeys($keys, $operator = null, $send_mail = true)
352352
{
353-
$operator = is_null($operator) ? $this->getUID() : $operator->uid;
353+
$operator = is_null($operator) ? $this->uid : $operator->uid;
354354
$keys_filt = array_values(array_unique($keys));
355355
if ($this->entry->exists()) {
356356
$this->entry->setAttribute("sshpublickey", $keys_filt);
@@ -486,7 +486,7 @@ public function setHomeDir($home, $operator = null)
486486
if ($this->entry->exists()) {
487487
$this->entry->setAttribute("homedirectory", $home);
488488
$this->entry->write();
489-
$operator = is_null($operator) ? $this->getUID() : $operator->uid;
489+
$operator = is_null($operator) ? $this->uid : $operator->uid;
490490

491491
$this->SQL->addLog(
492492
$operator,

test/functional/NewUserTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ private function ensureUserDoesNotExist()
6565
$org->removeUser($USER);
6666
assert(!$org->inOrg($USER));
6767
}
68-
$LDAP->getUserEntry($USER->getUID())->delete();
68+
$LDAP->getUserEntry($USER->uid)->delete();
6969
assert(!$USER->exists());
7070
}
7171
$all_users_group = $LDAP->getUserGroup();
@@ -104,7 +104,7 @@ private function ensurePIGroupDoesNotExist()
104104
{
105105
global $USER, $LDAP;
106106
if ($USER->getPIGroup()->exists()) {
107-
$LDAP->getPIGroupEntry($USER->getPIGroup()->getPIUID())->delete();
107+
$LDAP->getPIGroupEntry($USER->getPIGroup()->gid)->delete();
108108
assert(!$USER->getPIGroup()->exists());
109109
}
110110
}

0 commit comments

Comments
 (0)