Enh: Added ContentContainerModuleManager::flushCache()

This commit is contained in:
buddh4 2019-02-26 13:24:11 +01:00
parent 3dd1757c3c
commit 2e88efbba9
2 changed files with 56 additions and 1 deletions

View File

@ -5,8 +5,9 @@ HumHub Change Log
- Fix: Disabled module notification category visible in notification settings.
- Enh: Added `ModuleManager::getEnabledModules()`
- Enh: `LikeAsset` is now part of `AppAsset` and does not need further registration
- Fix: Reflective XSS in file post upload (thanks to **Rubal Jain** for testing and reporting)
- Fix (CVE-2019-9093) and (CVE-2019-9094): Reflective XSS in file post upload and cfiles upload (thanks to **Rubal Jain** for testing and reporting)
- Enh: Added further upload file name validation
- Enh: Added `ContentContainerModuleManager::flushCache()`
1.3.10 (February 22, 2019)
---------------------------

View File

@ -163,4 +163,58 @@ class ContentContainerModule extends Module
return [];
}
/**
* This function enhances the default [[Module::getPermissions()]] behaviour by automatically checking
* the installation state of this module on the provided [[ContentContainerActiveRecord]].
*
* In case a container object was provided which this module is installed on we forward the call to [[getContainerPermissions()]].
* If a container is given which this module is not installed on we return an empty array.
* If no container was provided we forward the call to [[getGlobalPermissions()]].
*
* Sub classes should overwrite [[getContainerPermissions()]] and/or [[getGlobalPermissions()]] unless a special
* permission behaviour is required.
*
* @param ContentContainerActiveRecord $contentContainer
* @see Module::getPermissions()
* @return array
* @since 1.3.11
*/
public function getPermissions($contentContainer = null)
{
if($contentContainer && $contentContainer->moduleManager->isEnabled($this->id)) {
return $this->getContainerPermissions($contentContainer);
}
if($contentContainer) {
return parent::getPermissions($contentContainer);
}
return $this->getGlobalPermissions();
}
/**
* This method is called to determine available permissions only for containers this module is enabled on.
*
* @param null $contentContainer
* @see ContentContainerModule::getPermissions()
* @return array
* @since 1.3.11
*/
protected function getContainerPermissions($contentContainer = null)
{
return [];
}
/**
* This method is called to determine only global (no container related) permissions of this module.
*
* @see ContentContainerModule::getPermissions()
* @return array
* @since 1.3.11
*/
protected function getGlobalPermissions()
{
return [];
}
}