Merge pull request #105 from apuc/configure_accesses

configure accesses rule
This commit is contained in:
kavalar 2023-01-17 13:12:16 +03:00 committed by GitHub
commit ef9705ded0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
51 changed files with 236 additions and 362 deletions

View File

@ -43,5 +43,7 @@ environments/ contains environment-based overrides
php yii migrate --migrationPath=@yii/rbac/migrations <br>
и выполнить консольный скрипт <br>
php yii rbac/init <br>
php yii rbac/create-company-manager-role
php yii rbac/create-editor <br>
php yii rbac/create-company-manager-role <br>
php yii rbac/create-default-access-rules <br>
</p>

View File

@ -33,14 +33,8 @@ class AccessesController extends Controller
'delete' => ['POST'],
],
],
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['admin'],
],
],
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
];
}

View File

@ -1,20 +0,0 @@
<?php
namespace app\modules\accesses\controllers;
use yii\web\Controller;
/**
* Default controller for the `accesses` module
*/
class DefaultController extends Controller
{
/**
* Renders the index view for the module
* @return string
*/
public function actionIndex()
{
return $this->render('index');
}
}

View File

@ -1,12 +0,0 @@
<div class="accesses-default-index">
<h1><?= $this->context->action->uniqueId ?></h1>
<p>
This is the view content for action "<?= $this->context->action->id ?>".
The action belongs to the controller "<?= get_class($this->context) ?>"
in the "<?= $this->context->module->id ?>" module.
</p>
<p>
You may customize this page by editing the following file:<br>
<code><?= __FILE__ ?></code>
</p>
</div>

View File

@ -30,14 +30,8 @@ class AchievementsController extends Controller
'delete' => ['POST'],
],
],
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['admin'],
],
],
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
];
}

View File

@ -30,14 +30,8 @@ class BalanceController extends Controller
'delete' => ['POST'],
],
],
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['admin'],
],
],
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
];
}

View File

@ -26,14 +26,8 @@ class CalendarController extends Controller
'delete' => ['POST'],
],
],
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['admin'],
],
],
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
];
}

View File

@ -21,6 +21,9 @@ class ResumeTemplateController extends Controller
public function behaviors()
{
return [
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [

View File

@ -36,14 +36,8 @@ class UserCardController extends Controller
'delete' => ['POST'],
],
],
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['admin', 'profileEditor'],
],
],
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
];
}

View File

@ -29,14 +29,8 @@ class CompanyController extends Controller
'delete' => ['POST'],
],
],
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['admin'],
],
],
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
'log' => [
'class' => \common\behaviors\LogBehavior::class,

View File

@ -21,6 +21,9 @@ class CompanyManagerController extends Controller
public function behaviors()
{
return [
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
@ -135,7 +138,6 @@ class CompanyManagerController extends Controller
*/
public function actionDismiss($id)
{
// Debug::dd('fff');
$model = $this->findModel($id);
$model->company_id = null;
$model->update(false);

View File

@ -25,6 +25,9 @@ class DocumentController extends Controller
public function behaviors()
{
return [
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [

View File

@ -20,6 +20,9 @@ class DocumentFieldController extends Controller
public function behaviors()
{
return [
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [

View File

@ -23,6 +23,9 @@ class DocumentFieldValueController extends Controller
public function behaviors()
{
return [
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [

View File

@ -20,6 +20,9 @@ class DocumentTemplateController extends Controller
public function behaviors()
{
return [
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [

View File

@ -1,20 +0,0 @@
<?php
namespace backend\modules\employee\controllers;
use yii\web\Controller;
/**
* Default controller for the `employee` module
*/
class DefaultController extends Controller
{
/**
* Renders the index view for the module
* @return string
*/
public function actionIndex()
{
return $this->render('index');
}
}

View File

@ -22,6 +22,9 @@ class ManagerController extends Controller
public function behaviors()
{
return [
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [

View File

@ -21,6 +21,9 @@ class ManagerEmployeeController extends Controller
public function behaviors()
{
return [
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [

View File

@ -1,20 +0,0 @@
<?php
namespace backend\modules\hh\controllers;
use yii\web\Controller;
/**
* Default controller for the `hh` module
*/
class DefaultController extends Controller
{
/**
* Renders the index view for the module
* @return string
*/
public function actionIndex()
{
return $this->render('index');
}
}

View File

@ -31,14 +31,8 @@ class HhController extends Controller
'delete' => ['POST'],
],
],
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['admin'],
],
],
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
];
}

View File

@ -29,14 +29,8 @@ class HhJobController extends Controller
'delete' => ['POST'],
],
],
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['admin'],
],
],
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
];
}

View File

@ -1,12 +0,0 @@
<div class="hh-default-index">
<h1><?= $this->context->action->uniqueId ?></h1>
<p>
This is the view content for action "<?= $this->context->action->id ?>".
The action belongs to the controller "<?= get_class($this->context) ?>"
in the "<?= $this->context->module->id ?>" module.
</p>
<p>
You may customize this page by editing the following file:<br>
<code><?= __FILE__ ?></code>
</p>
</div>

View File

@ -27,14 +27,8 @@ class HolidayController extends Controller
'delete' => ['POST'],
],
],
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['admin'],
],
],
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
];
}

View File

@ -1,20 +0,0 @@
<?php
namespace backend\modules\interview\controllers;
use yii\web\Controller;
/**
* Default controller for the `interview` module
*/
class DefaultController extends Controller
{
/**
* Renders the index view for the module
* @return string
*/
public function actionIndex()
{
return $this->render('index');
}
}

View File

@ -1,12 +0,0 @@
<div class="interview-default-index">
<h1><?= $this->context->action->uniqueId ?></h1>
<p>
This is the view content for action "<?= $this->context->action->id ?>".
The action belongs to the controller "<?= get_class($this->context) ?>"
in the "<?= $this->context->module->id ?>" module.
</p>
<p>
You may customize this page by editing the following file:<br>
<code><?= __FILE__ ?></code>
</p>
</div>

View File

@ -29,14 +29,8 @@ class NotesController extends Controller
'delete' => ['POST'],
],
],
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['admin'],
],
],
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
];
}

View File

@ -5,7 +5,7 @@ namespace backend\modules\notes\models;
use Yii;
use common\models\FieldsValueNew;
class kNote extends \common\models\Note
class Note extends \common\models\Note
{
public $fields;

View File

@ -1,20 +0,0 @@
<?php
namespace backend\modules\options\controllers;
use yii\web\Controller;
/**
* Default controller for the `options` module
*/
class DefaultController extends Controller
{
/**
* Renders the index view for the module
* @return string
*/
public function actionIndex()
{
return $this->render('index');
}
}

View File

@ -1,12 +0,0 @@
<div class="options-default-index">
<h1><?= $this->context->action->uniqueId ?></h1>
<p>
This is the view content for action "<?= $this->context->action->id ?>".
The action belongs to the controller "<?= get_class($this->context) ?>"
in the "<?= $this->context->module->id ?>" module.
</p>
<p>
You may customize this page by editing the following file:<br>
<code><?= __FILE__ ?></code>
</p>
</div>

View File

@ -33,14 +33,8 @@ class ProjectController extends Controller
'delete' => ['POST'],
],
],
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['admin'],
],
],
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
];
}

View File

@ -24,6 +24,9 @@ class ProjectUserController extends Controller
public function behaviors()
{
return [
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [

View File

@ -23,6 +23,9 @@ class AnswerController extends Controller
public function behaviors()
{
return [
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [

View File

@ -1,20 +0,0 @@
<?php
namespace backend\modules\questionnaire\controllers;
use yii\web\Controller;
/**
* Default controller for the `questionnaire` module
*/
class DefaultController extends Controller
{
/**
* Renders the index view for the module
* @return string
*/
public function actionIndex()
{
return $this->render('index');
}
}

View File

@ -22,6 +22,9 @@ class QuestionController extends Controller
public function behaviors()
{
return [
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [

View File

@ -22,6 +22,9 @@ class QuestionTypeController extends Controller
public function behaviors()
{
return [
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [

View File

@ -22,6 +22,9 @@ class QuestionnaireCategoryController extends Controller
public function behaviors()
{
return [
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [

View File

@ -23,6 +23,9 @@ class QuestionnaireController extends Controller
public function behaviors()
{
return [
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [

View File

@ -26,6 +26,9 @@ class UserQuestionnaireController extends Controller
public function behaviors()
{
return [
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [

View File

@ -23,6 +23,9 @@ class UserResponseController extends Controller
public function behaviors()
{
return [
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [

View File

@ -1,12 +0,0 @@
<div class="questionnaire-default-index">
<h1><?= $this->context->action->uniqueId ?></h1>
<p>
This is the view content for action "<?= $this->context->action->id ?>".
The action belongs to the controller "<?= get_class($this->context) ?>"
in the "<?= $this->context->module->id ?>" module.
</p>
<p>
You may customize this page by editing the following file:<br>
<code><?= __FILE__ ?></code>
</p>
</div>

View File

@ -30,14 +30,8 @@ class AdditionalFieldsController extends Controller
'delete' => ['POST'],
],
],
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['admin'],
],
],
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
];
}

View File

@ -27,14 +27,8 @@ class PositionController extends Controller
'delete' => ['POST'],
],
],
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['admin'],
],
],
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
];
}

View File

@ -30,15 +30,18 @@ class SkillController extends Controller
'delete' => ['POST'],
],
],
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['admin', 'profileEditor'],
],
],
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
// 'access' => [
// 'class' => AccessControl::className(),
// 'rules' => [
// [
// 'allow' => true,
// 'roles' => ['admin', 'profileEditor'],
// ],
// ],
// ],
];
}

View File

@ -29,14 +29,8 @@ class StatusController extends Controller
'delete' => ['POST'],
],
],
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['admin'],
],
],
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
];
}

View File

@ -1,20 +0,0 @@
<?php
namespace backend\modules\task\controllers;
use yii\web\Controller;
/**
* Default controller for the `task` module
*/
class DefaultController extends Controller
{
/**
* Renders the index view for the module
* @return string
*/
public function actionIndex()
{
return $this->render('index');
}
}

View File

@ -24,6 +24,9 @@ class TaskController extends Controller
public function behaviors()
{
return [
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [

View File

@ -24,6 +24,9 @@ class TaskUserController extends Controller
public function behaviors()
{
return [
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [

View File

@ -1,12 +0,0 @@
<div class="task-default-index">
<h1><?= $this->context->action->uniqueId ?></h1>
<p>
This is the view content for action "<?= $this->context->action->id ?>".
The action belongs to the controller "<?= get_class($this->context) ?>"
in the "<?= $this->context->module->id ?>" module.
</p>
<p>
You may customize this page by editing the following file:<br>
<code><?= __FILE__ ?></code>
</p>
</div>

View File

@ -20,6 +20,9 @@ class TestTaskController extends Controller
public function behaviors()
{
return [
'as AccessBehavior' => [
'class' => \developeruz\db_rbac\behaviors\AccessBehavior::className(),
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [

View File

@ -27,27 +27,27 @@
[
'label' => 'Настройки', 'icon' => 'gears', 'url' => '#',
'items' => [
['label' => 'Статусы', 'icon' => 'anchor', 'url' => ['/settings/status'], 'active' => \Yii::$app->controller->id == 'status'],
['label' => 'Доп. поля', 'icon' => 'file-text-o', 'url' => ['/settings/additional-fields'], 'active' => \Yii::$app->controller->id == 'additional-fields'],
['label' => 'Должность', 'icon' => 'spotify', 'url' => ['/settings/position'], 'active' => \Yii::$app->controller->id == 'position'],
['label' => 'Навыки', 'icon' => 'flask', 'url' => ['/settings/skill'], 'active' => \Yii::$app->controller->id == 'skill'],
['label' => 'Шаблоны резюме', 'icon' => 'address-card ', 'url' => ['/card/resume-template'], 'active' => \Yii::$app->controller->id == 'resume-template'],
['label' => 'Шаблоны документов', 'icon' => 'file', 'url' => ['/document/document-template'], 'active' => \Yii::$app->controller->id == 'document-template'],
['label' => 'Поля документов', 'icon' => 'file-text', 'url' => ['/document/document-field'], 'active' => \Yii::$app->controller->id == 'document-field'],
['label' => 'Статусы', 'icon' => 'anchor', 'url' => ['/settings/status'], 'active' => \Yii::$app->controller->id == 'status', 'visible' => Yii::$app->user->can('settings')],
['label' => 'Доп. поля', 'icon' => 'file-text-o', 'url' => ['/settings/additional-fields'], 'active' => \Yii::$app->controller->id == 'additional-fields', 'visible' => Yii::$app->user->can('settings')],
['label' => 'Должность', 'icon' => 'spotify', 'url' => ['/settings/position'], 'active' => \Yii::$app->controller->id == 'position', 'visible' => Yii::$app->user->can('settings')],
['label' => 'Навыки', 'icon' => 'flask', 'url' => ['/settings/skill'], 'active' => \Yii::$app->controller->id == 'skill', 'visible' => Yii::$app->user->can('settings/skill')],
['label' => 'Шаблоны резюме', 'icon' => 'address-card ', 'url' => ['/card/resume-template'], 'active' => \Yii::$app->controller->id == 'resume-template', 'visible' => Yii::$app->user->can('card')],
['label' => 'Шаблоны документов', 'icon' => 'file', 'url' => ['/document/document-template'], 'active' => \Yii::$app->controller->id == 'document-template', 'visible' => Yii::$app->user->can('document')],
['label' => 'Поля документов', 'icon' => 'file-text', 'url' => ['/document/document-field'], 'active' => \Yii::$app->controller->id == 'document-field', 'visible' => Yii::$app->user->can('document')],
[
'label' => 'Роли', 'icon' => 'users', 'url' => '#',
'items' => [
['label' => 'Управление ролями', 'icon' => ' fa-sort-amount-asc', 'url' => ['/permit/access/role'], 'active' => \Yii::$app->controller->id == 'access'],
['label' => 'Правила доступа', 'icon' => 'list-alt', 'url' => ['/permit/access/permission'], 'active' => \Yii::$app->controller->id == 'access'],
]
],
'visible' => Yii::$app->user->can('confidential_information')
]
],
'visible' => Yii::$app->user->can('confidential_information')
],
[
'label' => 'Профили', 'icon' => 'address-book-o', 'url' => '#',
'items' => $menuItems,
'visible' => Yii::$app->user->can('confidential_information')
'visible' => Yii::$app->user->can('card')
],
[
'label' => 'Сотрудники', 'icon' => 'users', 'url' => '#',
@ -55,13 +55,13 @@
['label' => 'Менеджеры', 'icon' => 'user-circle-o', 'url' => ['/employee/manager'], 'active' => \Yii::$app->controller->id == 'manager'],
['label' => 'Работники', 'icon' => 'user', 'url' => ['/employee/manager-employee'], 'active' => \Yii::$app->controller->id == 'manager-employee'],
],
'visible' => Yii::$app->user->can('confidential_information')
'visible' => Yii::$app->user->can('employee')
],
['label' => 'Документы', 'icon' => 'archive', 'url' => ['/document/document'], 'active' => \Yii::$app->controller->id == 'document', 'visible' => Yii::$app->user->can('confidential_information')],
['label' => 'Документы', 'icon' => 'archive', 'url' => ['/document/document'], 'active' => \Yii::$app->controller->id == 'document', 'visible' => Yii::$app->user->can('document')],
[
'label' => 'Проекты', 'icon' => 'cubes', 'url' => ['#'],
'items' => $projectItems,
'visible' => Yii::$app->user->can('confidential_information')
'visible' => Yii::$app->user->can('project')
],
[
'label' => 'Задачи', 'icon' => 'tasks', 'url' => '#',
@ -69,7 +69,7 @@
['label' => 'Задачи', 'icon' => 'minus', 'url' => ['/task/task'], 'active' => \Yii::$app->controller->id == 'task'],
['label' => 'Исполнители задачи', 'icon' => 'users', 'url' => ['/task/task-user'], 'active' => \Yii::$app->controller->id == 'task-user'],
],
'visible' => Yii::$app->user->can('confidential_information')
'visible' => Yii::$app->user->can('task')
],
[
'label' => 'Компании', 'icon' => 'building', 'url' => '#',
@ -77,7 +77,7 @@
['label' => 'Компании', 'icon' => 'building-o', 'url' => ['/company/company'], 'active' => \Yii::$app->controller->id == 'company'],
['label' => 'Менеджеры компаний', 'icon' => 'user-circle-o', 'url' => ['/company/company-manager'], 'active' => \Yii::$app->controller->id == 'company-manager'],
],
'visible' => Yii::$app->user->can('confidential_information')
'visible' => Yii::$app->user->can('company')
],
[
'label' => 'Hh.ru', 'icon' => 'user-circle', 'url' => '#',
@ -85,22 +85,22 @@
['label' => 'Компании', 'icon' => 'building', 'url' => ['/hh/hh'], 'active' => \Yii::$app->controller->id == 'hh'],
['label' => 'Вакансии', 'icon' => 'user-md', 'url' => ['/hh/hh-job'], 'active' => \Yii::$app->controller->id == 'hh-job'],
],
'visible' => Yii::$app->user->can('confidential_information')
'visible' => Yii::$app->user->can('hh')
],
['label' => 'Баланс', 'icon' => 'dollar', 'url' => ['/balance/balance'], 'active' => \Yii::$app->controller->id == 'balance', 'visible' => Yii::$app->user->can('confidential_information')],
['label' => 'Отпуска', 'icon' => 'plane', 'url' => ['/holiday/holiday'], 'active' => \Yii::$app->controller->id == 'holiday', 'visible' => Yii::$app->user->can('confidential_information')],
['label' => 'Достижения', 'icon' => 'trophy', 'url' => ['/achievements/achievements'], 'active' => \Yii::$app->controller->id == 'achievements', 'visible' => Yii::$app->user->can('confidential_information')],
['label' => 'Доступы', 'icon' => 'key', 'url' => ['/accesses/accesses'], 'active' => \Yii::$app->controller->id == 'accesses', 'visible' => Yii::$app->user->can('confidential_information')],
['label' => 'Заметки', 'icon' => 'sticky-note', 'url' => ['/notes/notes'], 'active' => \Yii::$app->controller->id == 'notes', 'visible' => Yii::$app->user->can('confidential_information')],
['label' => 'Календарь ДР', 'icon' => 'calendar-check-o', 'url' => ['/calendar/calendar'], 'active' => \Yii::$app->controller->id == 'calendar', 'visible' => Yii::$app->user->can('confidential_information')],
['label' => 'Отчеты', 'icon' => 'calendar', 'url' => ['/reports/reports'], 'active' => \Yii::$app->controller->id == 'reports', ], // 'visible' => Yii::$app->user->can('confidential_information')
['label' => 'Опции', 'icon' => 'list-alt', 'url' => ['/options/options'], 'active' => \Yii::$app->controller->id == 'options', 'visible' => Yii::$app->user->can('confidential_information')],
['label' => 'Баланс', 'icon' => 'dollar', 'url' => ['/balance/balance'], 'active' => \Yii::$app->controller->id == 'balance', 'visible' => Yii::$app->user->can('balance')],
['label' => 'Отпуска', 'icon' => 'plane', 'url' => ['/holiday/holiday'], 'active' => \Yii::$app->controller->id == 'holiday', 'visible' => Yii::$app->user->can('holiday')],
['label' => 'Достижения', 'icon' => 'trophy', 'url' => ['/achievements/achievements'], 'active' => \Yii::$app->controller->id == 'achievements', 'visible' => Yii::$app->user->can('achievements')],
['label' => 'Доступы', 'icon' => 'key', 'url' => ['/accesses/accesses'], 'active' => \Yii::$app->controller->id == 'accesses', 'visible' => Yii::$app->user->can('accesses')],
['label' => 'Заметки', 'icon' => 'sticky-note', 'url' => ['/notes/notes'], 'active' => \Yii::$app->controller->id == 'notes', 'visible' => Yii::$app->user->can('notes')],
['label' => 'Календарь ДР', 'icon' => 'calendar-check-o', 'url' => ['/calendar/calendar'], 'active' => \Yii::$app->controller->id == 'calendar', 'visible' => Yii::$app->user->can('calendar')],
['label' => 'Отчеты', 'icon' => 'calendar', 'url' => ['/reports/reports'], 'active' => \Yii::$app->controller->id == 'reports', 'visible' => Yii::$app->user->can('reports')],
['label' => 'Опции', 'icon' => 'list-alt', 'url' => ['/options/options'], 'active' => \Yii::$app->controller->id == 'options', 'visible' => Yii::$app->user->can('options')],
[
'label' => 'Запрос интервью (' . \common\models\InterviewRequest::getNewCount() . ')',
'icon' => 'list-alt',
'url' => ['/interview/interview'],
'active' => \Yii::$app->controller->id == 'interview',
'visible' => Yii::$app->user->can('confidential_information'),
'visible' => Yii::$app->user->can('interview'),
'badge' => '<span class="badge badge-info right">4</span>'
],
[
@ -114,9 +114,9 @@
['label' => 'Анкеты пользователей', 'icon' => 'drivers-license', 'url' => ['/questionnaire/user-questionnaire'], 'active' => \Yii::$app->controller->id == 'user-questionnaire'],
['label' => 'Ответы пользователей', 'icon' => 'comments', 'url' => ['/questionnaire/user-response'], 'active' => \Yii::$app->controller->id == 'user-response'],
],
'visible' => Yii::$app->user->can('confidential_information')
'visible' => Yii::$app->user->can('questionnaire')
],
['label' => 'Тестовые задания', 'icon' => 'file-text-o', 'url' => ['/test/test-task'], 'active' => \Yii::$app->controller->id == 'options', 'visible' => Yii::$app->user->can('confidential_information')],
['label' => 'Тестовые задания', 'icon' => 'file-text-o', 'url' => ['/test/test-task'], 'active' => \Yii::$app->controller->id == 'options', 'visible' => Yii::$app->user->can('test')],
/*['label' => 'Gii', 'icon' => 'file-code-o', 'url' => ['/gii']],

View File

@ -85,4 +85,113 @@ class RbacController extends Controller
return $user;
}
public function actionCreateDefaultAccessRules()
{
$auth = Yii::$app->authManager;
$admin = $auth->getRole('admin');
$profileEditor = $auth->getRole('profileEditor');
$test = $auth->createPermission('test');
$test->description = 'Модуль "Тестовые задания"';
$auth->add($test);
$auth->addChild($admin, $test);
$questionnaire = $auth->createPermission('questionnaire');
$questionnaire->description = 'Модуль "Анкеты": Создание, редактирование анкет, категорий анкет, вопросов, проверка ответов пользователей';
$auth->add($questionnaire);
$auth->addChild($admin, $questionnaire);
$interview = $auth->createPermission('interview');
$interview->description = 'Модуль "Запрос интервью"';
$auth->add($interview);
$auth->addChild($admin, $interview);
$options = $auth->createPermission('options');
$options->description = 'Модуль "Опции"';
$auth->add($options);
$auth->addChild($admin, $options);
$reports = $auth->createPermission('reports');
$reports->description = 'Модуль "Отчёты"';
$auth->add($reports);
$auth->addChild($admin, $reports);
$calendar = $auth->createPermission('calendar');
$calendar->description = 'Модуль "Календарь ДР"';
$auth->add($calendar);
$auth->addChild($admin, $calendar);
$notes = $auth->createPermission('notes');
$notes->description = 'Модуль "Заметки"';
$auth->add($notes);
$auth->addChild($admin, $notes);
$accesses = $auth->createPermission('accesses');
$accesses->description = 'Модуль "Доступы"';
$auth->add($accesses);
$auth->addChild($admin, $accesses);
$achievements = $auth->createPermission('achievements');
$achievements->description = 'Модуль "Достижения"';
$auth->add($achievements);
$auth->addChild($admin, $achievements);
$holiday = $auth->createPermission('holiday');
$holiday->description = 'Модуль "Отпуска"';
$auth->add($holiday);
$auth->addChild($admin, $holiday);
$balance = $auth->createPermission('balance');
$balance->description = 'Модуль "Баланс"';
$auth->add($balance);
$auth->addChild($admin, $balance);
$hh = $auth->createPermission('hh');
$hh->description = 'Модуль "Hh.ru"';
$auth->add($hh);
$auth->addChild($admin, $hh);
$company = $auth->createPermission('company');
$company->description = 'Модуль "Компании"';
$auth->add($company);
$auth->addChild($admin, $company);
$task = $auth->createPermission('task');
$task->description = 'Модуль "Задачи"';
$auth->add($task);
$auth->addChild($admin, $task);
$project = $auth->createPermission('project');
$project->description = 'Модуль "Проекты"';
$auth->add($project);
$auth->addChild($admin, $project);
$documents = $auth->createPermission('document');
$documents->description = 'Модуль "Документы": Создание, редактирование документов, их полей и шаблонов';
$auth->add($documents);
$auth->addChild($admin, $documents);
$employee = $auth->createPermission('employee');
$employee->description = 'Модуль "Сотрудники"';
$auth->add($employee);
$auth->addChild($admin, $employee);
$card = $auth->createPermission('card');
$card->description = 'Модуль "Профили"';
$auth->add($card);
$auth->addChild($admin, $card);
$auth->addChild($profileEditor, $card);
$settings = $auth->createPermission('settings');
$settings->description = 'Модуль "Настройки"';
$auth->add($settings);
$auth->addChild($admin, $settings);
$skills = $auth->createPermission('settings/skill');
$skills->description = 'Навыки';
$auth->add($skills);
$auth->addChild($admin, $skills);
$auth->addChild($profileEditor, $skills);
}
}