From e02493daf740370978e40673d7ee32fd854d7dcd Mon Sep 17 00:00:00 2001 From: Sean Nessworthy Date: Wed, 3 Oct 2018 21:21:13 +0100 Subject: [PATCH] Allow site-wide moderators to have administrator access to Jeeves Requires needed endpoint to be exposed in Room-11/StackChat first. Closes #217 --- src/Storage/File/Admin.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Storage/File/Admin.php b/src/Storage/File/Admin.php index f481b14..f1051bc 100644 --- a/src/Storage/File/Admin.php +++ b/src/Storage/File/Admin.php @@ -37,9 +37,12 @@ public function getAll(ChatRoom $room): Promise return array_values(array_diff($data, $owners)); }, $this->dataFileTemplate, $room); + $siteModerators = array_keys(yield $this->aclDataAccessor->getMainSiteModerators($room)); + return [ 'owners' => $owners, 'admins' => $admins, + 'site-moderators' => $siteModerators, ]; }); } @@ -55,8 +58,9 @@ public function isAdmin(ChatRoom $room, int $userId): Promise $administrators = yield $this->getAll($room); return ($administrators['owners'] === [] && $administrators['admins'] === []) - || in_array($userId, $administrators['owners'], true) - || in_array($userId, $administrators['admins'], true); + || \in_array($userId, $administrators['owners'], true) + || \in_array($userId, $administrators['admins'], true) + || \in_array($userId, $administrators['site-moderators'], true); }); }