1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10:08 +00:00

Adding general Permissions

This commit is contained in:
Tim Düsterhus 2012-03-23 17:45:26 +01:00
parent 10c20f68c1
commit cf434b1778
9 changed files with 39 additions and 7 deletions

View File

@ -17,7 +17,7 @@ class ChatLeaveAction extends AbstractAction {
* @see \wcf\action\AbstractAction::$neededModules * @see \wcf\action\AbstractAction::$neededModules
*/ */
public $neededModules = array('CHAT_ACTIVE'); public $neededModules = array('CHAT_ACTIVE');
//public $neededPermissions = array('user.chat.canEnter'); public $neededPermissions = array('user.chat.canEnter');
public $room = null; public $room = null;
public $userData = array(); public $userData = array();

View File

@ -16,6 +16,7 @@
*/ */
class ChatForm extends AbstractForm { class ChatForm extends AbstractForm {
public $enableSmilies = 1; public $enableSmilies = 1;
public $neededPermissions = array('user.chat.canEnter');
public $message = ''; public $message = '';
public $room = null; public $room = null;
public $userData = array(); public $userData = array();

View File

@ -13,7 +13,7 @@
*/ */
class ChatCopyrightPage extends AbstractPage { class ChatCopyrightPage extends AbstractPage {
public $neededModules = array('CHAT_ACTIVE'); public $neededModules = array('CHAT_ACTIVE');
//public $neededPermissions = array('user.chat.canEnter'); public $neededPermissions = array('user.chat.canEnter');
/** /**
* @see \wcf\page\IPage::readParameters() * @see \wcf\page\IPage::readParameters()

View File

@ -15,7 +15,7 @@
class ChatMessagePage extends AbstractPage { class ChatMessagePage extends AbstractPage {
public $messages = array(); public $messages = array();
public $neededModules = array('CHAT_ACTIVE'); public $neededModules = array('CHAT_ACTIVE');
//public $neededPermissions = array('user.chat.canEnter'); public $neededPermissions = array('user.chat.canEnter');
public $room = null; public $room = null;
public $roomID = 0; public $roomID = 0;
public $users = array(); public $users = array();

View File

@ -16,7 +16,7 @@
class ChatPage extends AbstractPage { class ChatPage extends AbstractPage {
public $chatVersion = ''; public $chatVersion = '';
public $neededModules = array('CHAT_ACTIVE'); public $neededModules = array('CHAT_ACTIVE');
//public $neededPermissions = array('user.chat.canEnter'); public $neededPermissions = array('user.chat.canEnter');
public $newestMessages = array(); public $newestMessages = array();
public $room = null; public $room = null;
public $roomID = 0; public $roomID = 0;

View File

@ -15,7 +15,7 @@
*/ */
class ChatRefreshRoomListPage extends AbstractPage { class ChatRefreshRoomListPage extends AbstractPage {
public $neededModules = array('CHAT_ACTIVE'); public $neededModules = array('CHAT_ACTIVE');
//public $neededPermissions = array('user.chat.canEnter'); public $neededPermissions = array('user.chat.canEnter');
public $room = null; public $room = null;
public $roomID = 0; public $roomID = 0;
public $rooms = array(); public $rooms = array();

View File

@ -88,7 +88,8 @@ protected function init() {
*/ */
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])) { if (!isset($this->chatPermissions[$room->roomID][$permission])) {
return isset(self::$defaults[$permission]) ? self::$defaults[$permission] : false; $permission = str_replace(array('user.', 'mod.'), array('user.chat.', 'mod.chat.'), $permission);
return WCF::getUser()->getPermission($permission);
} }
return (boolean) $this->chatPermissions[$room->roomID][$permission]; return (boolean) $this->chatPermissions[$room->roomID][$permission];
} }

View File

@ -5,7 +5,7 @@
<packagedescription><![CDATA[Chat for WoltLab Community Framework™]]></packagedescription> <packagedescription><![CDATA[Chat for WoltLab Community Framework™]]></packagedescription>
<standalone>0</standalone> <standalone>0</standalone>
<isunique>1</isunique> <isunique>1</isunique>
<version>3.0.0 Alpha 8</version> <version>3.0.0 Alpha 9</version>
<date>2011-11-26</date> <date>2011-11-26</date>
<plugin>com.woltlab.wcf.message</plugin> <!-- TODO: Correct me --> <plugin>com.woltlab.wcf.message</plugin> <!-- TODO: Correct me -->
</packageinformation> </packageinformation>

View File

@ -2,12 +2,42 @@
<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/userGroupOption.xsd"> <data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/userGroupOption.xsd">
<import> <import>
<categories> <categories>
<category name="user.chat">
<parent>user</parent>
</category>
<category name="mod.chat">
<parent>mod</parent>
</category>
<category name="admin.content.chat"> <category name="admin.content.chat">
<parent>admin.content</parent> <parent>admin.content</parent>
</category> </category>
</categories> </categories>
<options> <options>
<option name="user.chat.canEnter">
<categoryname>user.chat</categoryname>
<optiontype>boolean</optiontype>
<defaultvalue>0</defaultvalue>
<admindefaultvalue>0</admindefaultvalue>
</option>
<option name="user.chat.canWrite">
<categoryname>user.chat</categoryname>
<optiontype>boolean</optiontype>
<defaultvalue>0</defaultvalue>
<admindefaultvalue>0</admindefaultvalue>
</option>
<option name="mod.chat.canAlwaysEnter">
<categoryname>mod.chat</categoryname>
<optiontype>boolean</optiontype>
<defaultvalue>0</defaultvalue>
<admindefaultvalue>0</admindefaultvalue>
</option>
<option name="mod.chat.canAlwaysWrite">
<categoryname>mod.chat</categoryname>
<optiontype>boolean</optiontype>
<defaultvalue>0</defaultvalue>
<admindefaultvalue>0</admindefaultvalue>
</option>
<option name="admin.content.chat.canAddRoom"> <option name="admin.content.chat.canAddRoom">
<categoryname>admin.content.chat</categoryname> <categoryname>admin.content.chat</categoryname>
<optiontype>boolean</optiontype> <optiontype>boolean</optiontype>