Skip to content

Commit b6a1491

Browse files
committed
remove UnityUser->getUID(), make uid property public
1 parent f46cc39 commit b6a1491

21 files changed

+235
-239
lines changed

resources/init.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@
119119
$SEND_PIMESG_TO_ADMINS = $CONFIG["mail"]["send_pimesg_to_admins"];
120120

121121
$SQL->addLog(
122-
$OPERATOR->getUID(),
122+
$OPERATOR->uid,
123123
$_SERVER['REMOTE_ADDR'],
124124
"user_login",
125-
$OPERATOR->getUID()
125+
$OPERATOR->uid
126126
);
127127

128128
if (!$_SESSION["user_exists"]) {

resources/lib/UnityGroup.php

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ public function requestGroup($firstname, $lastname, $email, $org, $send_mail_to_
8686
}
8787

8888
// check if account deletion request already exists
89-
if ($this->SQL->accDeletionRequestExists($this->getOwner()->getUID())) {
89+
if ($this->SQL->accDeletionRequestExists($this->getOwner()->uid)) {
9090
return;
9191
}
9292

93-
$this->SQL->addRequest($this->getOwner()->getUID(), $firstname, $lastname, $email, $org);
93+
$this->SQL->addRequest($this->getOwner()->uid, $firstname, $lastname, $email, $org);
9494

9595
if ($send_mail) {
9696
// send email to requestor
@@ -102,7 +102,7 @@ public function requestGroup($firstname, $lastname, $email, $org, $send_mail_to_
102102
$this->WEBHOOK->sendWebhook(
103103
"group_request_admin",
104104
array(
105-
"user" => $this->getOwner()->getUID(),
105+
"user" => $this->getOwner()->uid,
106106
"org" => $org,
107107
"name" => "$firstname $lastname",
108108
"email" => $email
@@ -114,7 +114,7 @@ public function requestGroup($firstname, $lastname, $email, $org, $send_mail_to_
114114
"admin",
115115
"group_request_admin",
116116
array(
117-
"user" => $this->getOwner()->getUID(),
117+
"user" => $this->getOwner()->uid,
118118
"org" => $org,
119119
"name" => "$firstname $lastname",
120120
"email" => $email
@@ -126,7 +126,7 @@ public function requestGroup($firstname, $lastname, $email, $org, $send_mail_to_
126126
"pi_approve",
127127
"group_request_admin",
128128
array(
129-
"user" => $this->getOwner()->getUID(),
129+
"user" => $this->getOwner()->uid,
130130
"org" => $org,
131131
"name" => "$firstname $lastname",
132132
"email" => $email
@@ -140,7 +140,7 @@ public function requestGroup($firstname, $lastname, $email, $org, $send_mail_to_
140140
*/
141141
public function approveGroup($operator = null, $send_mail = true)
142142
{
143-
$uid = $this->getOwner()->getUID();
143+
$uid = $this->getOwner()->uid;
144144
$request = $this->SQL->getRequest($uid, UnitySQL::REQUEST_BECOME_PI);
145145

146146
// check for edge cases...
@@ -164,15 +164,15 @@ public function approveGroup($operator = null, $send_mail = true)
164164

165165
// remove the request from the sql table
166166
// this will silently fail if the request doesn't exist
167-
$this->SQL->removeRequest($this->getOwner()->getUID());
167+
$this->SQL->removeRequest($this->getOwner()->uid);
168168

169-
$operator = is_null($operator) ? $this->getOwner()->getUID() : $operator->getUID();
169+
$operator = is_null($operator) ? $this->getOwner()->uid : $operator->uid;
170170

171171
$this->SQL->addLog(
172172
$operator,
173173
$_SERVER['REMOTE_ADDR'],
174174
"approved_group",
175-
$this->getOwner()->getUID()
175+
$this->getOwner()->uid
176176
);
177177

178178
// send email to the newly approved PI
@@ -190,19 +190,19 @@ public function approveGroup($operator = null, $send_mail = true)
190190
public function denyGroup($operator = null, $send_mail = true)
191191
{
192192
// remove request - this will fail silently if the request doesn't exist
193-
$this->SQL->removeRequest($this->getOwner()->getUID());
193+
$this->SQL->removeRequest($this->getOwner()->uid);
194194

195195
if ($this->exists()) {
196196
return;
197197
}
198198

199-
$operator = is_null($operator) ? $this->getOwner()->getUID() : $operator->getUID();
199+
$operator = is_null($operator) ? $this->getOwner()->uid : $operator->uid;
200200

201201
$this->SQL->addLog(
202202
$operator,
203203
$_SERVER['REMOTE_ADDR'],
204204
"denied_group",
205-
$this->getOwner()->getUID()
205+
$this->getOwner()->uid
206206
);
207207

208208
// send email to the requestor
@@ -216,17 +216,17 @@ public function denyGroup($operator = null, $send_mail = true)
216216

217217
public function cancelGroupRequest($send_mail = true)
218218
{
219-
if (!$this->SQL->requestExists($this->getOwner()->getUID())) {
219+
if (!$this->SQL->requestExists($this->getOwner()->uid)) {
220220
return;
221221
}
222222

223-
$this->SQL->removeRequest($this->getOwner()->getUID());
223+
$this->SQL->removeRequest($this->getOwner()->uid);
224224

225225
if ($send_mail) {
226226
$this->MAILER->sendMail(
227227
"admin",
228228
"group_request_cancelled",
229-
["uid" => $this->getOwner()->getUID()],
229+
["uid" => $this->getOwner()->uid],
230230
);
231231
}
232232
}
@@ -237,14 +237,14 @@ public function cancelGroupJoinRequest($user, $send_mail = true)
237237
return;
238238
}
239239

240-
$this->SQL->removeRequest($user->getUID(), $this->pi_uid);
240+
$this->SQL->removeRequest($user->uid, $this->pi_uid);
241241

242242
if ($send_mail) {
243243
// send email to requestor
244244
$this->MAILER->sendMail(
245245
$this->getOwner()->getMail(),
246246
"group_join_request_cancelled",
247-
["uid" => $user->getUID()]
247+
["uid" => $user->uid]
248248
);
249249
}
250250
}
@@ -271,7 +271,7 @@ public function cancelGroupJoinRequest($user, $send_mail = true)
271271
// $this->entry->delete();
272272
// $this->REDIS->removeCacheArray("sorted_groups", "", $this->getPIUID());
273273
// foreach ($users as $user) {
274-
// $this->REDIS->removeCacheArray($user->getUID(), "groups", $this->getPIUID());
274+
// $this->REDIS->removeCacheArray($user->uid, "groups", $this->getPIUID());
275275
// }
276276
// }
277277

@@ -292,7 +292,7 @@ public function cancelGroupJoinRequest($user, $send_mail = true)
292292
*/
293293
public function approveUser($new_user, $send_mail = true)
294294
{
295-
$uid = $new_user->getUID();
295+
$uid = $new_user->uid;
296296
$gid = $this->getPIUID();
297297
$request = $this->SQL->getRequest($uid, $gid);
298298
// check if user exists
@@ -308,7 +308,7 @@ public function approveUser($new_user, $send_mail = true)
308308
// add user to the LDAP object
309309
$this->addUserToGroup($new_user);
310310

311-
$this->SQL->removeRequest($new_user->getUID(), $this->pi_uid);
311+
$this->SQL->removeRequest($new_user->uid, $this->pi_uid);
312312

313313
// send email to the requestor
314314
if ($send_mail) {
@@ -324,7 +324,7 @@ public function approveUser($new_user, $send_mail = true)
324324
"group_user_added_owner",
325325
array(
326326
"group" => $this->pi_uid,
327-
"user" => $new_user->getUID(),
327+
"user" => $new_user->uid,
328328
"name" => $request["firstname"] . " " . $request["lastname"],
329329
"email" => $request["email"],
330330
"org" => $request["org"],
@@ -335,12 +335,12 @@ public function approveUser($new_user, $send_mail = true)
335335

336336
public function denyUser($new_user, $send_mail = true)
337337
{
338-
$uid = $new_user->getUID();
338+
$uid = $new_user->uid;
339339
$gid = $this->getPIUID();
340340
$request = $this->SQL->getRequest($uid, $gid);
341341

342342
// remove request, this will fail silently if the request doesn't exist
343-
$this->SQL->removeRequest($new_user->getUID(), $this->pi_uid);
343+
$this->SQL->removeRequest($new_user->uid, $this->pi_uid);
344344

345345
if ($send_mail) {
346346
// send email to the user
@@ -356,7 +356,7 @@ public function denyUser($new_user, $send_mail = true)
356356
"group_user_denied_owner",
357357
array(
358358
"group" => $this->pi_uid,
359-
"user" => $new_user->getUID(),
359+
"user" => $new_user->uid,
360360
"name" => $new_user->getFullName(),
361361
"email" => $new_user->getMail(),
362362
"org" => $new_user->getOrg()
@@ -371,7 +371,7 @@ public function removeUser($new_user, $send_mail = true)
371371
return;
372372
}
373373

374-
if ($new_user->getUID() == $this->getOwner()->getUID()) {
374+
if ($new_user->uid == $this->getOwner()->uid) {
375375
throw new Exception("Cannot delete group owner from group. Disband group instead");
376376
}
377377

@@ -392,7 +392,7 @@ public function removeUser($new_user, $send_mail = true)
392392
"group_user_removed_owner",
393393
array(
394394
"group" => $this->pi_uid,
395-
"user" => $new_user->getUID(),
395+
"user" => $new_user->uid,
396396
"name" => $new_user->getFullName(),
397397
"email" => $new_user->getMail(),
398398
"org" => $new_user->getOrg()
@@ -413,12 +413,12 @@ public function newUserRequest($new_user, $firstname, $lastname, $email, $org, $
413413
return;
414414
}
415415

416-
if ($this->SQL->accDeletionRequestExists($new_user->getUID())) {
416+
if ($this->SQL->accDeletionRequestExists($new_user->uid)) {
417417
throw new Exception("user '$new_user' requested account deletion");
418418
return;
419419
}
420420

421-
$this->addRequest($new_user->getUID(), $firstname, $lastname, $email, $org);
421+
$this->addRequest($new_user->uid, $firstname, $lastname, $email, $org);
422422

423423
if ($send_mail) {
424424
// send email to user
@@ -434,7 +434,7 @@ public function newUserRequest($new_user, $firstname, $lastname, $email, $org, $
434434
"group_user_request_owner",
435435
array(
436436
"group" => $this->pi_uid,
437-
"user" => $new_user->getUID(),
437+
"user" => $new_user->uid,
438438
"name" => "$firstname $lastname",
439439
"email" => $email,
440440
"org" => $org,
@@ -477,7 +477,7 @@ public function getGroupMembers($ignorecache = false)
477477
{
478478
$members = $this->getGroupMemberUIDs($ignorecache);
479479
$out = array();
480-
$owner_uid = $this->getOwner()->getUID();
480+
$owner_uid = $this->getOwner()->uid;
481481
foreach ($members as $member) {
482482
$user_obj = new UnityUser(
483483
$member,
@@ -517,7 +517,7 @@ public function requestExists($user)
517517
$requesters = $this->getRequests();
518518
if (count($requesters) > 0) {
519519
foreach ($requesters as $requester) {
520-
if ($requester[0]->getUID() == $user->getUID()) {
520+
if ($requester[0]->uid == $user->uid) {
521521
return true;
522522
}
523523
}
@@ -540,7 +540,7 @@ private function init()
540540

541541
$this->entry->setAttribute("objectclass", UnityLDAP::POSIX_GROUP_CLASS);
542542
$this->entry->setAttribute("gidnumber", strval($nextGID));
543-
$this->entry->setAttribute("memberuid", array($owner->getUID()));
543+
$this->entry->setAttribute("memberuid", array($owner->uid));
544544
$this->entry->write();
545545
}
546546

@@ -552,24 +552,24 @@ private function init()
552552
private function addUserToGroup($new_user)
553553
{
554554
// Add to LDAP Group
555-
$this->entry->appendAttribute("memberuid", $new_user->getUID());
555+
$this->entry->appendAttribute("memberuid", $new_user->uid);
556556
$this->entry->write();
557-
$this->REDIS->appendCacheArray($this->getPIUID(), "members", $new_user->getUID());
558-
$this->REDIS->appendCacheArray($new_user->getUID(), "groups", $this->getPIUID());
557+
$this->REDIS->appendCacheArray($this->getPIUID(), "members", $new_user->uid);
558+
$this->REDIS->appendCacheArray($new_user->uid, "groups", $this->getPIUID());
559559
}
560560

561561
private function removeUserFromGroup($old_user)
562562
{
563563
// Remove from LDAP Group
564-
$this->entry->removeAttributeEntryByValue("memberuid", $old_user->getUID());
564+
$this->entry->removeAttributeEntryByValue("memberuid", $old_user->uid);
565565
$this->entry->write();
566-
$this->REDIS->removeCacheArray($this->getPIUID(), "members", $old_user->getUID());
567-
$this->REDIS->removeCacheArray($old_user->getUID(), "groups", $this->getPIUID());
566+
$this->REDIS->removeCacheArray($this->getPIUID(), "members", $old_user->uid);
567+
$this->REDIS->removeCacheArray($old_user->uid, "groups", $this->getPIUID());
568568
}
569569

570570
public function userExists($user)
571571
{
572-
return in_array($user->getUID(), $this->getGroupMemberUIDs());
572+
return in_array($user->uid, $this->getGroupMemberUIDs());
573573
}
574574

575575
private function addRequest($uid, $firstname, $lastname, $email, $org)

resources/lib/UnityOrg.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ public function getOrgID()
5757

5858
public function inOrg($user, $ignorecache = false)
5959
{
60-
return in_array($user->getUID(), $this->getOrgMemberUIDs($ignorecache));
60+
return in_array($user->uid, $this->getOrgMemberUIDs($ignorecache));
6161
}
6262

6363
public function getOrgMembers($ignorecache = false)
6464
{
6565
$members = $this->getGroupMemberUIDs($ignorecache);
6666
$out = array();
67-
$owner_uid = $this->getOwner()->getUID();
67+
$owner_uid = $this->getOwner()->uid;
6868
foreach ($members as $member) {
6969
$user_obj = new UnityUser(
7070
$member,
@@ -103,16 +103,16 @@ public function getOrgMemberUIDs($ignorecache = false)
103103
public function addUser($user)
104104
{
105105
$org_group = $this->getLDAPOrgGroup();
106-
$org_group->appendAttribute("memberuid", $user->getUID());
106+
$org_group->appendAttribute("memberuid", $user->uid);
107107
$org_group->write();
108-
$this->REDIS->appendCacheArray($this->getOrgID(), "members", $user->getUID());
108+
$this->REDIS->appendCacheArray($this->getOrgID(), "members", $user->uid);
109109
}
110110

111111
public function removeUser($user)
112112
{
113113
$org_group = $this->getLDAPOrgGroup();
114-
$org_group->removeAttributeEntryByValue("memberuid", $user->getUID());
114+
$org_group->removeAttributeEntryByValue("memberuid", $user->uid);
115115
$org_group->write();
116-
$this->REDIS->removeCacheArray($this->getOrgID(), "members", $user->getUID());
116+
$this->REDIS->removeCacheArray($this->getOrgID(), "members", $user->uid);
117117
}
118118
}

resources/lib/UnitySQL.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public function addNotice($title, $date, $content, $operator)
165165

166166
$stmt->execute();
167167

168-
$operator = $operator->getUID();
168+
$operator = $operator->uid;
169169

170170
$this->addLog(
171171
$operator,
@@ -252,7 +252,7 @@ public function editPage($id, $content, $operator)
252252

253253
$stmt->execute();
254254

255-
$operator = $operator->getUID();
255+
$operator = $operator->uid;
256256

257257
$this->addLog(
258258
$operator,

0 commit comments

Comments
 (0)