added RBAC
This commit is contained in:
@ -5,6 +5,7 @@ use Da\User\Widget\AssignmentsWidget;
|
||||
/**
|
||||
* @var yii\web\View $this
|
||||
* @var \Da\User\Model\User $user
|
||||
* @var string[] $params
|
||||
*/
|
||||
|
||||
?>
|
||||
@ -20,6 +21,6 @@ use Da\User\Widget\AssignmentsWidget;
|
||||
]
|
||||
) ?>
|
||||
|
||||
<?= AssignmentsWidget::widget(['userId' => $user->id]) ?>
|
||||
<?= AssignmentsWidget::widget(['userId' => $user->id, 'params' => $params]) ?>
|
||||
|
||||
<?php $this->endContent() ?>
|
||||
|
||||
@ -14,7 +14,7 @@ $this->params['breadcrumbs'][] = ['label' => Yii::t('user', 'Users'), 'url' => [
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
?>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
<?= $this->render(
|
||||
'/shared/_alert',
|
||||
[
|
||||
@ -22,69 +22,86 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
]
|
||||
) ?>
|
||||
|
||||
<?= $this->render('_menu') ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<?= Nav::widget(
|
||||
[
|
||||
'options' => [
|
||||
'class' => 'nav-pills nav-stacked',
|
||||
],
|
||||
'items' => [
|
||||
['label' => Yii::t('user', 'Account details'), 'url' => ['/user/admin/create']],
|
||||
[
|
||||
'label' => Yii::t('user', 'Profile details'),
|
||||
'options' => [
|
||||
'class' => 'disabled',
|
||||
'onclick' => 'return false;',
|
||||
]
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('user', 'Information'),
|
||||
'options' => [
|
||||
'class' => 'disabled',
|
||||
'onclick' => 'return false;',
|
||||
]
|
||||
],
|
||||
],
|
||||
]
|
||||
) ?>
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title"><?= Html::encode($this->title) ?></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<div class="alert alert-info">
|
||||
<?= Yii::t('user', 'Credentials will be sent to the user by email') ?>.
|
||||
<?= Yii::t('user', 'A password will be generated automatically if not provided') ?>.
|
||||
</div>
|
||||
<?php $form = ActiveForm::begin(
|
||||
[
|
||||
'layout' => 'horizontal',
|
||||
'enableAjaxValidation' => true,
|
||||
'enableClientValidation' => false,
|
||||
'fieldConfig' => [
|
||||
'horizontalCssClasses' => [
|
||||
'wrapper' => 'col-sm-9',
|
||||
],
|
||||
],
|
||||
]
|
||||
); ?>
|
||||
<?= $this->render('/shared/_menu') ?>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<?= Nav::widget(
|
||||
[
|
||||
'options' => [
|
||||
'class' => 'nav-pills nav-stacked',
|
||||
],
|
||||
'items' => [
|
||||
[
|
||||
'label' => Yii::t('user', 'Account details'),
|
||||
'url' => ['/user/admin/create']
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('user', 'Profile details'),
|
||||
'options' => [
|
||||
'class' => 'disabled',
|
||||
'onclick' => 'return false;',
|
||||
]
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('user', 'Information'),
|
||||
'options' => [
|
||||
'class' => 'disabled',
|
||||
'onclick' => 'return false;',
|
||||
]
|
||||
],
|
||||
],
|
||||
]
|
||||
) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<div class="alert alert-info">
|
||||
<?= Yii::t('user', 'Credentials will be sent to the user by email') ?>.
|
||||
<?= Yii::t('user', 'A password will be generated automatically if not provided') ?>.
|
||||
</div>
|
||||
<?php $form = ActiveForm::begin(
|
||||
[
|
||||
'layout' => 'horizontal',
|
||||
'enableAjaxValidation' => true,
|
||||
'enableClientValidation' => false,
|
||||
'fieldConfig' => [
|
||||
'horizontalCssClasses' => [
|
||||
'wrapper' => 'col-sm-9',
|
||||
],
|
||||
],
|
||||
]
|
||||
); ?>
|
||||
|
||||
<?= $this->render('_user', ['form' => $form, 'user' => $user]) ?>
|
||||
<?= $this->render('_user', ['form' => $form, 'user' => $user]) ?>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-lg-offset-3 col-lg-9">
|
||||
<?= Html::submitButton(Yii::t('user', 'Save'), ['class' => 'btn btn-block btn-success']) ?>
|
||||
<div class="form-group">
|
||||
<div class="col-lg-offset-3 col-lg-9">
|
||||
<?= Html::submitButton(
|
||||
Yii::t('user', 'Save'),
|
||||
['class' => 'btn btn-block btn-success']
|
||||
) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -17,14 +17,7 @@ $this->title = Yii::t('user', 'Manage users');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
|
||||
<?= $this->render(
|
||||
'/shared/_alert',
|
||||
[
|
||||
'module' => Yii::$app->getModule('user'),
|
||||
]
|
||||
) ?>
|
||||
|
||||
<?= $this->render('/admin/_menu') ?>
|
||||
<?php $this->beginContent('@Da/User/resources/views/shared/admin_layout.php') ?>
|
||||
|
||||
<?php Pjax::begin() ?>
|
||||
|
||||
@ -113,3 +106,5 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
); ?>
|
||||
|
||||
<?php Pjax::end() ?>
|
||||
|
||||
<?php $this->endContent() ?>
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
use Da\User\Model\User;
|
||||
use yii\bootstrap\Nav;
|
||||
use yii\web\View;
|
||||
use yii\helpers\Html;
|
||||
|
||||
/**
|
||||
* @var View $this
|
||||
@ -15,7 +16,7 @@ $this->params['breadcrumbs'][] = ['label' => Yii::t('user', 'Users'), 'url' => [
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
?>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
<?= $this->render(
|
||||
'/shared/_alert',
|
||||
[
|
||||
@ -23,84 +24,106 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
]
|
||||
) ?>
|
||||
|
||||
<?= $this->render('_menu') ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<?= Nav::widget(
|
||||
[
|
||||
'options' => [
|
||||
'class' => 'nav-pills nav-stacked',
|
||||
],
|
||||
'items' => [
|
||||
[
|
||||
'label' => Yii::t('user', 'Account details'),
|
||||
'url' => ['/user/admin/update', 'id' => $user->id]
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('user', 'Profile details'),
|
||||
'url' => ['/user/admin/update-profile', 'id' => $user->id]
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('user', 'Information'),
|
||||
'url' => ['/user/admin/info', 'id' => $user->id]
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('user', 'Assignments'),
|
||||
'url' => ['/user/admin/assignments', 'id' => $user->id],
|
||||
],
|
||||
'<hr>',
|
||||
[
|
||||
'label' => Yii::t('user', 'Confirm'),
|
||||
'url' => ['/user/admin/confirm', 'id' => $user->id],
|
||||
'visible' => !$user->isConfirmed,
|
||||
'linkOptions' => [
|
||||
'class' => 'text-success',
|
||||
'data-method' => 'post',
|
||||
'data-confirm' => Yii::t('user', 'Are you sure you want to confirm this user?'),
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('user', 'Block'),
|
||||
'url' => ['/user/admin/block', 'id' => $user->id],
|
||||
'visible' => !$user->isBlocked,
|
||||
'linkOptions' => [
|
||||
'class' => 'text-danger',
|
||||
'data-method' => 'post',
|
||||
'data-confirm' => Yii::t('user', 'Are you sure you want to block this user?'),
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('user', 'Unblock'),
|
||||
'url' => ['/user/admin/block', 'id' => $user->id],
|
||||
'visible' => $user->isBlocked,
|
||||
'linkOptions' => [
|
||||
'class' => 'text-success',
|
||||
'data-method' => 'post',
|
||||
'data-confirm' => Yii::t('user', 'Are you sure you want to unblock this user?'),
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('user', 'Delete'),
|
||||
'url' => ['/user/admin/delete', 'id' => $user->id],
|
||||
'linkOptions' => [
|
||||
'class' => 'text-danger',
|
||||
'data-method' => 'post',
|
||||
'data-confirm' => Yii::t('user', 'Are you sure you want to delete this user?'),
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
) ?>
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title"><?= Html::encode($this->title) ?></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<?= $content ?>
|
||||
<?= $this->render('/shared/_menu') ?>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<?= Nav::widget(
|
||||
[
|
||||
'options' => [
|
||||
'class' => 'nav-pills nav-stacked',
|
||||
],
|
||||
'items' => [
|
||||
[
|
||||
'label' => Yii::t('user', 'Account details'),
|
||||
'url' => ['/user/admin/update', 'id' => $user->id]
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('user', 'Profile details'),
|
||||
'url' => ['/user/admin/update-profile', 'id' => $user->id]
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('user', 'Information'),
|
||||
'url' => ['/user/admin/info', 'id' => $user->id]
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('user', 'Assignments'),
|
||||
'url' => ['/user/admin/assignments', 'id' => $user->id],
|
||||
],
|
||||
'<hr>',
|
||||
[
|
||||
'label' => Yii::t('user', 'Confirm'),
|
||||
'url' => ['/user/admin/confirm', 'id' => $user->id],
|
||||
'visible' => !$user->isConfirmed,
|
||||
'linkOptions' => [
|
||||
'class' => 'text-success',
|
||||
'data-method' => 'post',
|
||||
'data-confirm' => Yii::t(
|
||||
'user',
|
||||
'Are you sure you want to confirm this user?'
|
||||
),
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('user', 'Block'),
|
||||
'url' => ['/user/admin/block', 'id' => $user->id],
|
||||
'visible' => !$user->isBlocked,
|
||||
'linkOptions' => [
|
||||
'class' => 'text-danger',
|
||||
'data-method' => 'post',
|
||||
'data-confirm' => Yii::t(
|
||||
'user',
|
||||
'Are you sure you want to block this user?'
|
||||
),
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('user', 'Unblock'),
|
||||
'url' => ['/user/admin/block', 'id' => $user->id],
|
||||
'visible' => $user->isBlocked,
|
||||
'linkOptions' => [
|
||||
'class' => 'text-success',
|
||||
'data-method' => 'post',
|
||||
'data-confirm' => Yii::t(
|
||||
'user',
|
||||
'Are you sure you want to unblock this user?'
|
||||
),
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('user', 'Delete'),
|
||||
'url' => ['/user/admin/delete', 'id' => $user->id],
|
||||
'linkOptions' => [
|
||||
'class' => 'text-danger',
|
||||
'data-method' => 'post',
|
||||
'data-confirm' => Yii::t(
|
||||
'user',
|
||||
'Are you sure you want to delete this user?'
|
||||
),
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<?= $content ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
36
lib/User/resources/views/permission/_form.php
Normal file
36
lib/User/resources/views/permission/_form.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @var $this yii\web\View
|
||||
* @var $model \Da\User\Model\Permission
|
||||
* @var $unassignedItems string[]
|
||||
*/
|
||||
|
||||
use kartik\select2\Select2;
|
||||
use yii\widgets\ActiveForm;
|
||||
use yii\helpers\Html;
|
||||
|
||||
?>
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'enableClientValidation' => false,
|
||||
'enableAjaxValidation' => true,
|
||||
]) ?>
|
||||
|
||||
<?= $form->field($model, 'name') ?>
|
||||
|
||||
<?= $form->field($model, 'description') ?>
|
||||
|
||||
<?= $form->field($model, 'rule') ?>
|
||||
|
||||
<?= $form->field($model, 'children')->widget(Select2::className(), [
|
||||
'data' => $unassignedItems,
|
||||
'options' => [
|
||||
'id' => 'children',
|
||||
'multiple' => true
|
||||
],
|
||||
]) ?>
|
||||
|
||||
<?= Html::submitButton(Yii::t('user', 'Save'), ['class' => 'btn btn-success btn-block']) ?>
|
||||
|
||||
<?php ActiveForm::end() ?>
|
||||
24
lib/User/resources/views/permission/create.php
Normal file
24
lib/User/resources/views/permission/create.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @var $model \Da\User\Model\Permission
|
||||
* @var $this yii\web\View
|
||||
* @var $unassignedItems string[]
|
||||
*/
|
||||
|
||||
$this->title = Yii::t('user', 'Create new permission');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
?>
|
||||
|
||||
<?php $this->beginContent('@Da/User/resources/views/shared/admin_layout.php') ?>
|
||||
|
||||
<?= $this->render(
|
||||
'_form',
|
||||
[
|
||||
'model' => $model,
|
||||
'unassignedItems' => $unassignedItems
|
||||
]
|
||||
) ?>
|
||||
|
||||
<?php $this->endContent() ?>
|
||||
60
lib/User/resources/views/permission/index.php
Normal file
60
lib/User/resources/views/permission/index.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @var $dataProvider array
|
||||
* @var $this yii\web\View
|
||||
* @var $searchModel \Da\User\Search\PermissionSearch
|
||||
*/
|
||||
|
||||
use yii\grid\ActionColumn;
|
||||
use yii\grid\GridView;
|
||||
use yii\helpers\Url;
|
||||
|
||||
$this->title = Yii::t('user', 'Permissions');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
?>
|
||||
|
||||
<?php $this->beginContent('@Da/User/resources/views/shared/admin_layout.php') ?>
|
||||
|
||||
<?= GridView::widget(
|
||||
[
|
||||
'dataProvider' => $dataProvider,
|
||||
'filterModel' => $searchModel,
|
||||
'layout' => "{items}\n{pager}",
|
||||
'columns' => [
|
||||
[
|
||||
'attribute' => 'name',
|
||||
'header' => Yii::t('user', 'Name'),
|
||||
'options' => [
|
||||
'style' => 'width: 20%'
|
||||
],
|
||||
],
|
||||
[
|
||||
'attribute' => 'description',
|
||||
'header' => Yii::t('user', 'Description'),
|
||||
'options' => [
|
||||
'style' => 'width: 55%'
|
||||
],
|
||||
],
|
||||
[
|
||||
'attribute' => 'rule_name',
|
||||
'header' => Yii::t('user', 'Rule name'),
|
||||
'options' => [
|
||||
'style' => 'width: 20%'
|
||||
],
|
||||
],
|
||||
[
|
||||
'class' => ActionColumn::className(),
|
||||
'template' => '{update} {delete}',
|
||||
'urlCreator' => function ($action, $model) {
|
||||
return Url::to(['/user/permission/' . $action, 'name' => $model['name']]);
|
||||
},
|
||||
'options' => [
|
||||
'style' => 'width: 5%'
|
||||
],
|
||||
]
|
||||
],
|
||||
]
|
||||
) ?>
|
||||
<?php $this->endContent() ?>
|
||||
25
lib/User/resources/views/permission/update.php
Normal file
25
lib/User/resources/views/permission/update.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @var $model \Da\User\Model\Permission
|
||||
* @var $this yii\web\View
|
||||
* @var $unassignedItems string[]
|
||||
*/
|
||||
|
||||
$this->title = Yii::t('user', 'Update permission');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
?>
|
||||
|
||||
<?php $this->beginContent('@Da/User/resources/views/shared/admin_layout.php') ?>
|
||||
|
||||
<?= $this->render(
|
||||
'_form',
|
||||
[
|
||||
'model' => $model,
|
||||
'unassignedItems' => $unassignedItems
|
||||
]
|
||||
) ?>
|
||||
|
||||
<?php $this->endContent() ?>
|
||||
|
||||
@ -1,14 +1,5 @@
|
||||
<?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 yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
|
||||
41
lib/User/resources/views/role/_form.php
Normal file
41
lib/User/resources/views/role/_form.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @var $this yii\web\View
|
||||
* @var $model \Da\User\Model\Role
|
||||
*/
|
||||
use Da\User\Helper\AuthHelper;
|
||||
use kartik\select2\Select2;
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
$unassignedItems = Yii::$container->get(AuthHelper::class)->getUnassignedItems($model);
|
||||
?>
|
||||
|
||||
<?php $form = ActiveForm::begin(
|
||||
[
|
||||
'enableClientValidation' => false,
|
||||
'enableAjaxValidation' => true,
|
||||
]
|
||||
) ?>
|
||||
|
||||
<?= $form->field($model, 'name') ?>
|
||||
|
||||
<?= $form->field($model, 'description') ?>
|
||||
|
||||
<?= $form->field($model, 'rule') ?>
|
||||
|
||||
<?= $form->field($model, 'children')->widget(
|
||||
Select2::className(),
|
||||
[
|
||||
'data' => $unassignedItems,
|
||||
'options' => [
|
||||
'id' => 'children',
|
||||
'multiple' => true
|
||||
],
|
||||
]
|
||||
) ?>
|
||||
|
||||
<?= Html::submitButton(Yii::t('user', 'Save'), ['class' => 'btn btn-success btn-block']) ?>
|
||||
|
||||
<?php ActiveForm::end() ?>
|
||||
24
lib/User/resources/views/role/create.php
Normal file
24
lib/User/resources/views/role/create.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @var $model \Da\User\Model\Role
|
||||
* @var $this yii\web\View
|
||||
* @var $unassignedItems string[]
|
||||
*/
|
||||
|
||||
$this->title = Yii::t('user', 'Create new role');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
?>
|
||||
|
||||
<?php $this->beginContent('@Da/User/resources/views/shared/admin_layout.php') ?>
|
||||
|
||||
<?= $this->render(
|
||||
'_form',
|
||||
[
|
||||
'model' => $model,
|
||||
'unassignedItems' => $unassignedItems
|
||||
]
|
||||
) ?>
|
||||
|
||||
<?php $this->endContent() ?>
|
||||
61
lib/User/resources/views/role/index.php
Normal file
61
lib/User/resources/views/role/index.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
use yii\grid\ActionColumn;
|
||||
use yii\grid\GridView;
|
||||
use yii\helpers\Url;
|
||||
|
||||
/**
|
||||
* @var $dataProvider array
|
||||
* @var $searchModel \Da\User\Search\RoleSearch
|
||||
* @var $this yii\web\View
|
||||
*/
|
||||
|
||||
|
||||
$this->title = Yii::t('user', 'Roles');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
?>
|
||||
|
||||
<?php $this->beginContent('@Da/User/resources/views/shared/admin_layout.php') ?>
|
||||
|
||||
<?= GridView::widget(
|
||||
[
|
||||
'dataProvider' => $dataProvider,
|
||||
'filterModel' => $searchModel,
|
||||
'layout' => "{items}\n{pager}",
|
||||
'columns' => [
|
||||
[
|
||||
'attribute' => 'name',
|
||||
'header' => Yii::t('user', 'Name'),
|
||||
'options' => [
|
||||
'style' => 'width: 20%'
|
||||
],
|
||||
],
|
||||
[
|
||||
'attribute' => 'description',
|
||||
'header' => Yii::t('user', 'Description'),
|
||||
'options' => [
|
||||
'style' => 'width: 55%'
|
||||
],
|
||||
],
|
||||
[
|
||||
'attribute' => 'rule_name',
|
||||
'header' => Yii::t('user', 'Rule name'),
|
||||
'options' => [
|
||||
'style' => 'width: 20%'
|
||||
],
|
||||
],
|
||||
[
|
||||
'class' => ActionColumn::className(),
|
||||
'template' => '{update} {delete}',
|
||||
'urlCreator' => function ($action, $model) {
|
||||
return Url::to(['/user/role/' . $action, 'name' => $model['name']]);
|
||||
},
|
||||
'options' => [
|
||||
'style' => 'width: 5%'
|
||||
],
|
||||
]
|
||||
],
|
||||
]
|
||||
) ?>
|
||||
|
||||
<?php $this->endContent() ?>
|
||||
24
lib/User/resources/views/role/update.php
Normal file
24
lib/User/resources/views/role/update.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @var $model \Da\User\Model\Role
|
||||
* @var $this yii\web\View
|
||||
* @var $unassignedItems string[]
|
||||
*/
|
||||
|
||||
$this->title = Yii::t('user', 'Update role');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
?>
|
||||
|
||||
<?php $this->beginContent('@Da/User/resources/views/shared/admin_layout.php') ?>
|
||||
|
||||
<?= $this->render(
|
||||
'_form',
|
||||
[
|
||||
'model' => $model,
|
||||
'unassignedItems' => $unassignedItems
|
||||
]
|
||||
) ?>
|
||||
|
||||
<?php $this->endContent() ?>
|
||||
@ -12,6 +12,7 @@ use yii\widgets\ActiveForm;
|
||||
$this->title = Yii::t('user', 'Account settings');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<?= $this->render('/shared/_alert', ['module' => Yii::$app->getModule('user')]) ?>
|
||||
|
||||
|
||||
@ -13,6 +13,8 @@ $this->title = Yii::t('user', 'Networks');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<?= $this->render('/shared/_alert', ['module' => Yii::$app->getModule('user')]) ?>
|
||||
|
||||
<div class="row">
|
||||
@ -28,12 +30,14 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
<div class="alert alert-info">
|
||||
<p><?= Yii::t('user', 'You can connect multiple accounts to be able to log in using them') ?>.</p>
|
||||
</div>
|
||||
<?php $auth = ConnectWidget::begin([
|
||||
'baseAuthUrl' => ['/user/security/auth'],
|
||||
'accounts' => $user->socialNetworkAccounts,
|
||||
'autoRender' => false,
|
||||
'popupMode' => false,
|
||||
]) ?>
|
||||
<?php $auth = ConnectWidget::begin(
|
||||
[
|
||||
'baseAuthUrl' => ['/user/security/auth'],
|
||||
'accounts' => $user->socialNetworkAccounts,
|
||||
'autoRender' => false,
|
||||
'popupMode' => false,
|
||||
]
|
||||
) ?>
|
||||
<table class="table">
|
||||
<?php foreach ($auth->getClients() as $client): ?>
|
||||
<tr>
|
||||
@ -45,13 +49,21 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
</td>
|
||||
<td style="width: 120px">
|
||||
<?= $auth->isConnected($client) ?
|
||||
Html::a(Yii::t('user', 'Disconnect'), $auth->createClientUrl($client), [
|
||||
'class' => 'btn btn-danger btn-block',
|
||||
'data-method' => 'post',
|
||||
]) :
|
||||
Html::a(Yii::t('user', 'Connect'), $auth->createClientUrl($client), [
|
||||
'class' => 'btn btn-success btn-block',
|
||||
])
|
||||
Html::a(
|
||||
Yii::t('user', 'Disconnect'),
|
||||
$auth->createClientUrl($client),
|
||||
[
|
||||
'class' => 'btn btn-danger btn-block',
|
||||
'data-method' => 'post',
|
||||
]
|
||||
) :
|
||||
Html::a(
|
||||
Yii::t('user', 'Connect'),
|
||||
$auth->createClientUrl($client),
|
||||
[
|
||||
'class' => 'btn btn-success btn-block',
|
||||
]
|
||||
)
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -1,26 +1,24 @@
|
||||
<?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 yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use Da\User\Helper\TimezoneHelper;
|
||||
|
||||
/**
|
||||
* @var yii\web\View $this
|
||||
* @var yii\widgets\ActiveForm $form
|
||||
* @var dektrium\user\models\Profile $profile
|
||||
* @var \Da\User\Model\Profile $model
|
||||
* @var TimezoneHelper $timezoneHelper
|
||||
*/
|
||||
|
||||
$this->title = Yii::t('user', 'Profile settings');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
$timezoneHelper = $model->make(TimezoneHelper::class);
|
||||
?>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<?= $this->render('/shared/_alert', ['module' => Yii::$app->getModule('user')]) ?>
|
||||
|
||||
<div class="row">
|
||||
@ -33,17 +31,19 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
<?= Html::encode($this->title) ?>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<?php $form = \yii\widgets\ActiveForm::begin([
|
||||
'id' => 'profile-form',
|
||||
'options' => ['class' => 'form-horizontal'],
|
||||
'fieldConfig' => [
|
||||
'template' => "{label}\n<div class=\"col-lg-9\">{input}</div>\n<div class=\"col-sm-offset-3 col-lg-9\">{error}\n{hint}</div>",
|
||||
'labelOptions' => ['class' => 'col-lg-3 control-label'],
|
||||
],
|
||||
'enableAjaxValidation' => true,
|
||||
'enableClientValidation' => false,
|
||||
'validateOnBlur' => false,
|
||||
]); ?>
|
||||
<?php $form = ActiveForm::begin(
|
||||
[
|
||||
'id' => $model->formName(),
|
||||
'options' => ['class' => 'form-horizontal'],
|
||||
'fieldConfig' => [
|
||||
'template' => "{label}\n<div class=\"col-lg-9\">{input}</div>\n<div class=\"col-sm-offset-3 col-lg-9\">{error}\n{hint}</div>",
|
||||
'labelOptions' => ['class' => 'col-lg-3 control-label'],
|
||||
],
|
||||
'enableAjaxValidation' => true,
|
||||
'enableClientValidation' => false,
|
||||
'validateOnBlur' => false,
|
||||
]
|
||||
); ?>
|
||||
|
||||
<?= $form->field($model, 'name') ?>
|
||||
|
||||
@ -55,18 +55,12 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
<?= $form
|
||||
->field($model, 'timezone')
|
||||
->dropDownList(
|
||||
\yii\helpers\ArrayHelper::map(
|
||||
\dektrium\user\helpers\Timezone::getAll(),
|
||||
'timezone',
|
||||
'name'
|
||||
)
|
||||
); ?>
|
||||
|
||||
->dropDownList(ArrayHelper::map($timezoneHelper->getAll(),'timezone','name'));
|
||||
?>
|
||||
<?= $form
|
||||
->field($model, 'gravatar_email')
|
||||
->hint(
|
||||
\yii\helpers\Html::a(
|
||||
Html::a(
|
||||
Yii::t('user', 'Change your avatar at Gravatar.com'),
|
||||
'http://gravatar.com'
|
||||
)
|
||||
@ -76,14 +70,12 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-lg-offset-3 col-lg-9">
|
||||
<?= \yii\helpers\Html::submitButton(
|
||||
Yii::t('user', 'Save'),
|
||||
['class' => 'btn btn-block btn-success']
|
||||
) ?><br>
|
||||
<?= Html::submitButton(Yii::t('user', 'Save'), ['class' => 'btn btn-block btn-success']) ?>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php \yii\widgets\ActiveForm::end(); ?>
|
||||
<?php ActiveForm::end(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -17,11 +17,11 @@ use yii\bootstrap\Nav;
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('user', 'Roles'),
|
||||
'url' => ['/rbac/role/index']
|
||||
'url' => ['/user/role/index']
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('user', 'Permissions'),
|
||||
'url' => ['/rbac/permission/index']
|
||||
'url' => ['/user/permission/index']
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('user', 'Create'),
|
||||
@ -32,11 +32,11 @@ use yii\bootstrap\Nav;
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('user', 'New role'),
|
||||
'url' => ['/rbac/role/create']
|
||||
'url' => ['/user/role/create']
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('user', 'New permission'),
|
||||
'url' => ['/rbac/permission/create']
|
||||
'url' => ['/user/permission/create']
|
||||
],
|
||||
],
|
||||
],
|
||||
25
lib/User/resources/views/shared/admin_layout.php
Normal file
25
lib/User/resources/views/shared/admin_layout.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
?>
|
||||
<div class="clearfix"></div>
|
||||
<?= $this->render(
|
||||
'/shared/_alert',
|
||||
[
|
||||
'module' => Yii::$app->getModule('user'),
|
||||
]
|
||||
) ?>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title"><?= Html::encode($this->title) ?></h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<?= $this->render('_menu') ?>
|
||||
<?= $content ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,22 +1,13 @@
|
||||
<?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\models\Assignment;
|
||||
use kartik\select2\Select2;
|
||||
use yii\bootstrap\Alert;
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/**
|
||||
* @var $model Assignment
|
||||
* @var $model \Da\User\Model\Assignment
|
||||
* @var $availableItems string[]
|
||||
*/
|
||||
|
||||
?>
|
||||
@ -27,7 +18,7 @@ use yii\widgets\ActiveForm;
|
||||
'options' => [
|
||||
'class' => 'alert-success'
|
||||
],
|
||||
'body' => Yii::t('rbac', 'Assignments have been updated'),
|
||||
'body' => Yii::t('user', 'Assignments have been updated'),
|
||||
]) ?>
|
||||
|
||||
<?php endif ?>
|
||||
@ -40,14 +31,14 @@ use yii\widgets\ActiveForm;
|
||||
<?= Html::activeHiddenInput($model, 'user_id') ?>
|
||||
|
||||
<?= $form->field($model, 'items')->widget(Select2::className(), [
|
||||
'data' => $model->getAvailableItems(),
|
||||
'data' => $availableItems,
|
||||
'options' => [
|
||||
'id' => 'items',
|
||||
'multiple' => true
|
||||
],
|
||||
]) ?>
|
||||
|
||||
<?= Html::submitButton(Yii::t('rbac', 'Update assignments'), ['class' => 'btn btn-success btn-block']) ?>
|
||||
<?= Html::submitButton(Yii::t('user', 'Update assignments'), ['class' => 'btn btn-success btn-block']) ?>
|
||||
|
||||
<?php ActiveForm::end() ?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user