/**
  * Show form with auth items for user.
  * 
  * @param int $id
  */
 public function actionAssign($id)
 {
     $model = Yii::createObject(['class' => Assignment::className(), 'user_id' => $id]);
     if ($model->load(\Yii::$app->request->post()) && $model->updateAssignments()) {
     }
     return \dektrium\rbac\widgets\Assignments::widget(['model' => $model]);
     /*$model = Yii::createObject([
           'class'   => Assignment::className(),
           'user_id' => $id,
       ]);
       
       if ($model->load(Yii::$app->request->post()) && $model->updateAssignments()) {
           
       }
       
       return $this->render('assign', [
           'model' => $model,
       ]);*/
 }
Exemple #2
0
<?php

/*
 * This file is part of the Dektrium project
 *
 * (c) Dektrium project <http://github.com/dektrium>
 *
 * For the full copyright and license information, please view the LICENSE.md
 * file that was distributed with this source code.
 */
use dektrium\rbac\widgets\Assignments;
/**
 * @var yii\web\View 				$this
 * @var dektrium\user\models\User 	$user
 */
?>

<?php 
$this->beginContent('@dektrium/user/views/admin/update.php', ['user' => $user]);
?>

<?php 
echo yii\bootstrap\Alert::widget(['options' => ['class' => 'alert-info'], 'body' => 'You can assign multiple roles or permissions to user by using the form below']);
?>

<?php 
echo Assignments::widget(['userId' => $user->id]);
?>

<?php 
$this->endContent();