Fix: Space module permission configuration of non installed space modules visible in permission grid

This commit is contained in:
buddh4 2018-11-15 12:25:14 +01:00
parent 83277c95fa
commit 85ade5aed2
4 changed files with 19 additions and 2 deletions

View File

@ -48,7 +48,7 @@ class Module extends \yii\base\Module
// Set settings component
$this->set('settings', [
'class' => SettingsManager::className(),
'class' => SettingsManager::class,
'moduleId' => $this->id
]);
}

View File

@ -244,6 +244,21 @@ class ModuleManager extends Component
return (array_key_exists($id, $this->modules));
}
/**
* Returns weather or not the given module id belongs to an core module.
*
* @return bool
* @since 1.3.8
*/
public function isCoreModule($id)
{
if(!$this->hasModule($id)) {
return false;
}
return (in_array(get_class($this->getModule($id)), $this->coreModules));
}
/**
* Returns a module instance by id
*

View File

@ -7,6 +7,7 @@ HumHub Change Log
---------------------------
- Fix #3359: Weekly summary e-mails are not sent in default configuration
- Fix: Space module permission configuration of non installed space modules visible in permission grid
1.3.7 (October 23, 2018)

View File

@ -11,6 +11,7 @@ namespace humhub\modules\content\components;
use humhub\modules\user\components\PermissionManager;
use humhub\modules\content\models\ContentContainerPermission;
use humhub\libs\BasePermission;
use Yii;
/**
* @inheritdoc
@ -42,7 +43,7 @@ class ContentContainerPermissionManager extends PermissionManager
*/
protected function getModulePermissions(\yii\base\Module $module)
{
if ($module instanceof \humhub\components\Module) {
if ($module instanceof \humhub\components\Module && (Yii::$app->moduleManager->isCoreModule($module->id) || $this->contentContainer->isModuleEnabled($module->id))) {
return $module->getPermissions($this->contentContainer);
}
return [];