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:
parent
cbde0dea50
commit
730dbd7770
@ -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];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user