mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-21 21:30:08 +00:00
Override max user restriction for mods
This commit is contained in:
parent
4790a3ddb8
commit
c0f58a9ddb
@ -43,12 +43,12 @@ public function __toString() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the user is allowed to enter the room.
|
||||
* Returns whther the user is allowed to always enter the room.
|
||||
*
|
||||
* @param \wcf\data\user\User $user
|
||||
* @return boolean
|
||||
*/
|
||||
public function canEnter(\wcf\data\user\User $user = null) {
|
||||
public function canAlwaysEnter(\wcf\data\user\User $user = null) {
|
||||
if ($user === null) $user = WCF::getUser();
|
||||
if (!$user->userID) return false;
|
||||
$user = new \wcf\data\user\UserProfile($user);
|
||||
@ -60,6 +60,22 @@ public function canEnter(\wcf\data\user\User $user = null) {
|
||||
if ($ph->getPermission($this, 'mod.canAlwaysEnter')) return true;
|
||||
if ($ph->getPermission($this, 'mod.canBan')) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the user is allowed to enter the room.
|
||||
*
|
||||
* @param \wcf\data\user\User $user
|
||||
* @return boolean
|
||||
*/
|
||||
public function canEnter(\wcf\data\user\User $user = null) {
|
||||
if ($user === null) $user = WCF::getUser();
|
||||
if (!$user->userID) return false;
|
||||
if ($this->canAlwaysEnter($user)) return true;
|
||||
$user = new \wcf\data\user\UserProfile($user);
|
||||
|
||||
$ph = new \chat\system\permission\PermissionHandler($user->getDecoratedObject());
|
||||
if (!$ph->getPermission($this, 'user.canEnter')) return false;
|
||||
|
||||
$suspensions = Suspension::getSuspensionsForUser($user->getDecoratedObject());
|
||||
|
@ -171,7 +171,7 @@ public function validateJoin() {
|
||||
if ($room === null) throw new exception\UserInputException('roomID');
|
||||
if (!$room->canEnter()) throw new exception\PermissionDeniedException();
|
||||
|
||||
if ($room->maxUsers && count($room->getUsers()) >= $room->maxUsers) {
|
||||
if ($room->maxUsers && count($room->getUsers()) >= $room->maxUsers && !$room->canAlwaysEnter()) {
|
||||
$errorMessage = WCF::getLanguage()->getDynamicVariable('chat.global.error.join.full', array('room' => $room));
|
||||
|
||||
throw new exception\UserInputException('room', $errorMessage);
|
||||
|
@ -4,7 +4,7 @@
|
||||
<title>{if $room}{$room} - {/if}{lang}chat.global.title{/lang} - {PAGE_TITLE|language}</title>
|
||||
|
||||
{include file='headInclude'}
|
||||
{if $room && (!$room->maxUsers || $room->getUsers()|count < $room->maxUsers)}
|
||||
{if $room && (!$room->maxUsers || $room->getUsers()|count < $room->maxUsers || $room->canAlwaysEnter())}
|
||||
{include file='javascriptInclude' application='chat'}
|
||||
<script data-relocate="true">
|
||||
//<![CDATA[
|
||||
@ -97,7 +97,7 @@
|
||||
</head>
|
||||
|
||||
<body id="tpl{$templateName|ucfirst}">
|
||||
{if $room && (!$room->maxUsers || $room->getUsers()|count < $room->maxUsers)}
|
||||
{if $room && (!$room->maxUsers || $room->getUsers()|count < $room->maxUsers || $room->canAlwaysEnter())}
|
||||
{capture assign='sidebar'}{include application='chat' file='sidebar'}{/capture}
|
||||
{include file='header' sandbox=false sidebarOrientation='right'}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user