Commit 85cdf995 authored by Shakarim Sapa's avatar Shakarim Sapa

Merge remote-tracking branch 'origin/master'

parents 73ab82c5 7a795c36
...@@ -30,5 +30,36 @@ abstract class AdminController extends \common\components\BaseController ...@@ -30,5 +30,36 @@ abstract class AdminController extends \common\components\BaseController
{ {
throw new NotSupportedException('The requested page does not exist.'); throw new NotSupportedException('The requested page does not exist.');
} }
$module = $this->getModuleName();
if($module && !Yii::$app->authManager->checkAccess(Yii::$app->user->id, $module))
{
throw new \Exception('There is no access to this page', 403);
}
}
private function getModuleName()
{
if(isset($this->module) && $this->module->id)
{
if($this->module->id == Yii::$app->id)
{
return null;
}
switch ($this->module->id)
{
case 'users':
return 'rbac';
break;
default:
return $this->module->id;
break;
}
}
return null;
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment