mirror of
https://github.com/openvk/openvk
synced 2024-12-23 00:51:03 +03:00
Fix re-adding to Chandler-group (#938)
This commit is contained in:
parent
71c59023cf
commit
dcf3631d89
2 changed files with 9 additions and 2 deletions
|
@ -45,4 +45,9 @@ class ChandlerGroups
|
||||||
{
|
{
|
||||||
foreach($this->perms->where("group", $UUID) as $perm) yield $perm;
|
foreach($this->perms->where("group", $UUID) as $perm) yield $perm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isUserAMember(string $GID, string $UID): bool
|
||||||
|
{
|
||||||
|
return ($this->context->query("SELECT * FROM `ChandlerACLRelations` WHERE `group` = ? AND `user` = ?", $GID, $UID)) !== NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,9 +110,11 @@ final class AdminPresenter extends OpenVKPresenter
|
||||||
if($user->onlineStatus() != $this->postParam("online")) $user->setOnline(intval($this->postParam("online")));
|
if($user->onlineStatus() != $this->postParam("online")) $user->setOnline(intval($this->postParam("online")));
|
||||||
$user->setVerified(empty($this->postParam("verify") ? 0 : 1));
|
$user->setVerified(empty($this->postParam("verify") ? 0 : 1));
|
||||||
if($this->postParam("add-to-group")) {
|
if($this->postParam("add-to-group")) {
|
||||||
|
if (!(new ChandlerGroups)->isUserAMember($user->getChandlerGUID(), $this->postParam("add-to-group"))) {
|
||||||
$query = "INSERT INTO `ChandlerACLRelations` (`user`, `group`) VALUES ('" . $user->getChandlerGUID() . "', '" . $this->postParam("add-to-group") . "')";
|
$query = "INSERT INTO `ChandlerACLRelations` (`user`, `group`) VALUES ('" . $user->getChandlerGUID() . "', '" . $this->postParam("add-to-group") . "')";
|
||||||
DatabaseConnection::i()->getConnection()->query($query);
|
DatabaseConnection::i()->getConnection()->query($query);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if($this->postParam("password")) {
|
if($this->postParam("password")) {
|
||||||
$user->getChandlerUser()->updatePassword($this->postParam("password"));
|
$user->getChandlerUser()->updatePassword($this->postParam("password"));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue