Exemplo n.º 1
0
 public function beforeAction($action)
 {
     parent::beforeAction($action);
     $view = Yii::$app->view;
     $view->params['sub_menu'] = Yii::$app->params['sub_menu'][__CLASS__];
     return true;
 }
Exemplo n.º 2
0
 public function __construct($id, Module $module, array $config = [])
 {
     $this->categoryService = Yii::createObject('CategoryService');
     $this->brandService = Yii::createObject('BrandService');
     $this->productService = Yii::createObject('ProductService');
     parent::__construct($id, $module, $config);
 }
Exemplo n.º 3
0
 public function beforeAction($action)
 {
     parent::beforeAction($action);
     if (!in_array(Yii::$app->user->identity->username, ['ming.lin', 'wuying.hai'])) {
         $AuthManagerModel = new AuthManager();
         $userid = Yii::$app->user->identity->id;
         $route = strtolower(Yii::$app->controller->route);
         $routeArr = explode('/', $route);
         $controller = !empty($routeArr[0]) ? $routeArr[0] : 'welcome';
         $ac = !empty($routeArr[1]) ? $routeArr[1] : 'index';
         $permission = strtolower($controller . '_' . $ac);
         if (!$AuthManagerModel->checkAccess($userid, $permission)) {
             $this->redirect(['site/sys-error']);
         }
     }
     return true;
 }
Exemplo n.º 4
0
 public function init()
 {
     parent::init();
     $this->layout = 'layoutstyle';
 }
Exemplo n.º 5
0
 public function __construct($id, Module $module, array $config = [])
 {
     $this->userService = Yii::createObject('UserService');
     parent::__construct($id, $module, $config);
 }