Skip to content

Commit

Permalink
Allow site-wide moderators to have administrator access to Jeeves
Browse files Browse the repository at this point in the history
Requires needed endpoint to be exposed in Room-11/StackChat first.

Closes Room-11#217
  • Loading branch information
Nessworthy committed Oct 3, 2018
1 parent 528cce5 commit e02493d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Storage/File/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
});
}
Expand All @@ -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);
});
}

Expand Down

0 comments on commit e02493d

Please sign in to comment.