Exemplo n.º 1
0
 /**
  * Lists all Relation models.
  * @return mixed
  */
 public function actionIndex($role)
 {
     if (\Yii::$app->request->isPost) {
         $selectedPermissions = LuLu::getPostValue('Permission');
         Relation::AddBatchItems($role, $selectedPermissions);
         return $this->redirect(['index', 'role' => $role]);
     }
     $allPermissions = Permission::getAllPermissionsGroupedByCategory();
     $rolePermissions = Relation::find()->select(['permission', 'value'])->where(['role' => $role])->indexBy('permission')->all();
     $categories = Permission::getCategoryItems();
     $role = Role::findOne(['id' => $role]);
     return $this->render('index', ['rolePermissions' => $rolePermissions, 'allPermissions' => $allPermissions, 'categories' => $categories, 'role' => $role]);
 }
Exemplo n.º 2
0
<?php

use source\helpers\Html;
use yii\grid\GridView;
use source\LsYii;
use source\modules\rbac\models\Permission;
/* @var $this yii\web\View */
/* @var $model source\modules\rbac\models\Role */
$category = LsYii::getGetValue('category');
$this->title = "修改" . Permission::getCategoryItems($category);
?>
<div class="permission-update">
    <?php 
echo $this->render('_form', ['model' => $model]);
?>

</div>
Exemplo n.º 3
0
?>

<?php 
$this->toolbars([Html::a('返回', ['index'], ['class' => 'btn btn-xs btn-primary mod-site-save'])]);
?>

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'id')->textInput(['maxlength' => 64]);
?>

    <?php 
echo $form->field($model, 'category')->dropDownList(Permission::getCategoryItems());
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => 64]);
?>

    <?php 
echo $form->field($model, 'form')->radioList(Permission::getFormItems());
?>

    <?php 
echo $form->field($model, 'default_value')->textarea();
?>
    
    <?php