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

Include ACL-group-permissions as well

This commit is contained in:
Tim Düsterhus 2012-02-26 18:16:28 +01:00
parent dbd4e7b849
commit 4152462ade
3 changed files with 10 additions and 4 deletions

View File

@ -14,7 +14,7 @@
'wcf.icon.users': '{@$__wcf->getPath('wcf')}icon/users1.svg' 'wcf.icon.users': '{@$__wcf->getPath('wcf')}icon/users1.svg'
}); });
new WCF.ACL.List($('#groupPermissions'), {@$objectTypeID}{if $groupID|isset}, {@$groupID}{/if}); new WCF.ACL.List($('#groupPermissions'), {@$objectTypeID});
}); });
//]]> //]]>
</script> </script>

View File

@ -21,8 +21,7 @@ class ChatRoomEditor extends \wcf\data\DatabaseObjectEditor implements \wcf\data
* Clears the room cache. * Clears the room cache.
*/ */
public static function resetCache() { public static function resetCache() {
ChatRoom::getCache(); \wcf\system\cache\CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.chatrooms.php');
\wcf\system\cache\CacheHandler::getInstance()->clearResource('chatrooms');
} }
/** /**

View File

@ -1,6 +1,7 @@
<?php <?php
namespace wcf\system\chat\permission; namespace wcf\system\chat\permission;
use \wcf\system\acl\ACLHandler; use \wcf\system\acl\ACLHandler;
use \wcf\system\cache\CacheHandler;
use \wcf\system\package\PackageDependencyHandler; use \wcf\system\package\PackageDependencyHandler;
use \wcf\system\WCF; use \wcf\system\WCF;
@ -22,7 +23,12 @@ class ChatPermissionHandler extends \wcf\system\SingletonFactory {
protected function init() { protected function init() {
$packageID = PackageDependencyHandler::getPackageID('timwolla.wcf.chat'); $packageID = PackageDependencyHandler::getPackageID('timwolla.wcf.chat');
$ush = \wcf\system\user\storage\UserStorageHandler::getInstance(); $ush = \wcf\system\user\storage\UserStorageHandler::getInstance();
// TODO: get groups permissions
// get groups permissions
$groups = implode(',', WCF::getUser()->getGroupIDs());
$groupsFileName = \wcf\util\StringUtil::getHash(implode('-', WCF::getUser()->getGroupIDs()));
CacheHandler::getInstance()->addResource('chatPermission-'.$groups, WCF_DIR.'cache/cache.chatPermission-'.$groupsFileName.'.php', 'wcf\system\cache\builder\ChatPermissionCacheBuilder');
$this->chatPermissions = CacheHandler::getInstance()->get('chatPermission-'.$groups);
// get user permissions // get user permissions
if (WCF::getUser()->userID) { if (WCF::getUser()->userID) {
@ -87,5 +93,6 @@ public static function clearCache() {
$ush = \wcf\system\user\storage\UserStorageHandler::getInstance(); $ush = \wcf\system\user\storage\UserStorageHandler::getInstance();
$ush->resetAll('chatUserPermissions', $packageID); $ush->resetAll('chatUserPermissions', $packageID);
\wcf\system\cache\CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.chatPermission-[a-f0-9]{40}.php');
} }
} }