Example #1
0
 public function behaviors()
 {
     $behaviors = array_merge(parent::behaviors(), ['access' => ['class' => AccessControl::className(), 'rules' => [['actions' => ['update', 'view', 'delete', 'available-groups', 'ajax-update'], 'allow' => true, 'roles' => ['@']], ['actions' => ['list', 'create'], 'allow' => true, 'roles' => [RbacController::create_profile]], ['actions' => ['beacons'], 'allow' => true, 'roles' => [RbacController::admin]]]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]]]);
     $behaviors['layout'] = Yii::$app->user->can(RbacController::admin) ? ['class' => AdminUserLayout::className(), 'only' => ['list', 'create']] : ['class' => UserLayout::className()];
     if (Yii::$app->user->can(RbacController::admin)) {
         $behaviors['manage-layout'] = ['class' => AdminUserManageLayout::className(), 'except' => ['list', 'create']];
     }
     return $behaviors;
 }
 public static function getLeftSubTabs(array $active = [])
 {
     $tabs = [['label' => Yii::t('user_layout', ':update_user'), 'url' => Url::to(['user/update'] + self::getParams()), 'active' => self::getActive($active, AdminUserManageLayout::update())], ['label' => Yii::t('user_layout', ':view_user'), 'url' => Url::to(['user/view'] + $_GET), 'active' => self::getActive($active, TabbedLayout::view())], ['label' => Yii::t('user_layout', ':user_beacons'), 'url' => Url::to(['user/beacons'] + self::getParams()), 'active' => self::getActive($active, AdminUserManageLayout::beacons())]];
     return $tabs;
 }