1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2025-01-10 00:30:09 +00:00

Adding array with default permission values

This commit is contained in:
Tim Düsterhus 2012-03-03 23:12:21 +01:00
parent cbde0dea50
commit 730dbd7770

View File

@ -16,6 +16,12 @@
*/ */
class ChatPermissionHandler extends \wcf\system\SingletonFactory { class ChatPermissionHandler extends \wcf\system\SingletonFactory {
protected $chatPermissions = array(); protected $chatPermissions = array();
protected static $defaults = array(
'user.canEnter' => true,
'user.canWrite' => true,
'mod.canAlwaysEnter' => false,
'mod.canAlwaysWrite' => false
);
/** /**
* @see \wcf\system\SingletonFactory::init() * @see \wcf\system\SingletonFactory::init()
@ -81,7 +87,9 @@ protected function init() {
* @return boolean * @return boolean
*/ */
public function getPermission(\wcf\data\chat\room\ChatRoom $room, $permission) { public function getPermission(\wcf\data\chat\room\ChatRoom $room, $permission) {
if (!isset($this->chatPermissions[$room->roomID][$permission])) return true; if (!isset($this->chatPermissions[$room->roomID][$permission])) {
return isset(self::$defaults[$permission]) ? self::$defaults[$permission] : false;
}
return (boolean) $this->chatPermissions[$room->roomID][$permission]; return (boolean) $this->chatPermissions[$room->roomID][$permission];
} }