Skip to content

Commit ece216f

Browse files
committed
remove $gid from PosixGroup
1 parent 0da224d commit ece216f

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

resources/lib/PosixGroup.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
class PosixGroup
1313
{
1414
protected LDAPEntry $entry;
15-
public string $gid;
1615

17-
public function __construct(LDAPEntry $entry, string $gid)
16+
public function __construct(LDAPEntry $entry)
1817
{
19-
$this->gid = $gid;
2018
$this->entry = $entry;
2119
}
2220

@@ -37,11 +35,6 @@ public function equals(PosixGroup $other_group): bool
3735
return $this->getDN() == $other_group->getDN();
3836
}
3937

40-
public function __toString(): string
41-
{
42-
return $this->gid;
43-
}
44-
4538
public function exists(): bool
4639
{
4740
return $this->entry->exists();

resources/lib/UnityGroup.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
class UnityGroup extends PosixGroup
1212
{
1313
public const string PI_PREFIX = "pi_";
14+
public string $gid;
1415
private UnityLDAP $LDAP;
1516
private UnitySQL $SQL;
1617
private UnityMailer $MAILER;
@@ -23,14 +24,18 @@ public function __construct(
2324
UnityMailer $MAILER,
2425
UnityWebhook $WEBHOOK,
2526
) {
26-
$gid = trim($gid);
27-
parent::__construct($LDAP->getPIGroupEntry($gid), $gid);
27+
parent::__construct($LDAP->getPIGroupEntry(trim($gid)));
2828
$this->LDAP = $LDAP;
2929
$this->SQL = $SQL;
3030
$this->MAILER = $MAILER;
3131
$this->WEBHOOK = $WEBHOOK;
3232
}
3333

34+
public function __toString(): string
35+
{
36+
return $this->gid;
37+
}
38+
3439
public function requestGroup(bool $send_mail_to_admins, bool $send_mail = true): void
3540
{
3641
if ($this->exists()) {

resources/lib/UnityOrg.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
class UnityOrg extends PosixGroup
77
{
8+
public string $gid;
89
private UnityLDAP $LDAP;
910
private UnitySQL $SQL;
1011
private UnityMailer $MAILER;
@@ -17,14 +18,18 @@ public function __construct(
1718
UnityMailer $MAILER,
1819
UnityWebhook $WEBHOOK,
1920
) {
20-
$gid = trim($gid);
21-
parent::__construct($LDAP->getOrgGroupEntry($gid), $gid);
21+
parent::__construct($LDAP->getOrgGroupEntry(trim($gid)));
2222
$this->LDAP = $LDAP;
2323
$this->SQL = $SQL;
2424
$this->MAILER = $MAILER;
2525
$this->WEBHOOK = $WEBHOOK;
2626
}
2727

28+
public function __toString(): string
29+
{
30+
return $this->gid;
31+
}
32+
2833
public function init(): void
2934
{
3035
\ensure(!$this->entry->exists());

0 commit comments

Comments
 (0)