diff --git a/README.md b/README.md
index 394e692..f86d3cb 100755
--- a/README.md
+++ b/README.md
@@ -45,5 +45,5 @@ environments/ contains environment-based overrides
php yii rbac/init
php yii rbac/create-editor
php yii rbac/create-company-manager-role
- php yii rbac/create-default-access-rules
+ `php yii rbac/create-default-access-rules`
\ No newline at end of file
diff --git a/backend/config/main.php b/backend/config/main.php
index bdd19d8..90fd8e3 100755
--- a/backend/config/main.php
+++ b/backend/config/main.php
@@ -84,7 +84,7 @@ return [
'components' => [
'request' => [
'csrfParam' => '_csrf-backend',
- 'baseUrl' => '/secure',
+ 'baseUrl' => '', // /secure TODO secure
'parsers' => [
'application/json' => 'yii\web\JsonParser',
'text/xml' => 'yii/web/XmlParser',
diff --git a/backend/modules/card/models/UserCardSearch.php b/backend/modules/card/models/UserCardSearch.php
index e3998e2..e35f42c 100755
--- a/backend/modules/card/models/UserCardSearch.php
+++ b/backend/modules/card/models/UserCardSearch.php
@@ -44,6 +44,9 @@ class UserCardSearch extends UserCard
*/
public function search($params)
{
+// $userId = Yii::$app->user->;
+// $userCard = UserCard::findOne($userId);
+
$query = UserCard::find();
$query->where(['id'])->distinct()
->leftJoin('card_skill', 'card_skill.card_id=user_card.id')
diff --git a/backend/modules/employee/views/manager-employee/_form.php b/backend/modules/employee/views/manager-employee/_form.php
index 0a83f2f..ee4685d 100644
--- a/backend/modules/employee/views/manager-employee/_form.php
+++ b/backend/modules/employee/views/manager-employee/_form.php
@@ -20,8 +20,9 @@ use yii\widgets\ActiveForm;
'data' => Manager::find()->select(['fio', 'manager.id'])
->joinWith('userCard')->indexBy('manager.id')->column(),
'options' => ['placeholder' => '...','class' => 'form-control'],
+ 'hideSearch' => false,
'pluginOptions' => [
- 'allowClear' => true
+ 'allowClear' => true,
],
]) ?>
@@ -30,9 +31,11 @@ use yii\widgets\ActiveForm;
'data' => UserCard::find()->select(['fio', 'user_card.id'])
->joinWith('manager')->where(['manager.user_card_id' => null])->indexBy('user_card.id')->column(),
'options' => ['placeholder' => '...','class' => 'form-control'],
+ 'hideSearch' => false,
'pluginOptions' => [
'allowClear' => true,
'multiple' => true,
+ 'closeOnSelect' => false
],
]) ?>
diff --git a/backend/modules/employee/views/manager/view.php b/backend/modules/employee/views/manager/view.php
index 30e6838..02794ef 100644
--- a/backend/modules/employee/views/manager/view.php
+++ b/backend/modules/employee/views/manager/view.php
@@ -43,6 +43,10 @@ YiiAsset::register($this);
],
]) ?>
+
+ Сотрудники менеджера
+
+
= GridView::widget([
'dataProvider' => $managerEmployeeDataProvider,
'columns' => [
diff --git a/console/controllers/RbacController.php b/console/controllers/RbacController.php
index 33d84e1..65f2e34 100755
--- a/console/controllers/RbacController.php
+++ b/console/controllers/RbacController.php
@@ -86,112 +86,290 @@ 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);
+// }
+
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);
+ if(!$auth->getPermission('test')) {
+ echo "create permission: test\n";
+ $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);
+ if(!$auth->getPermission('questionnaire')) {
+ echo "create permission: questionnaire\n";
+ $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);
+ if(!$auth->getPermission('interview')) {
+ echo "create permission: interview\n";
+ $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);
+ if(!$auth->getPermission('options')) {
+ echo "create permission: options\n";
+ $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);
+ if(!$auth->getPermission('reports')) {
+ echo "create permission: reports\n";
+ $reports = $auth->createPermission('reports');
+ $reports->description = 'Модуль "Отчёты"';
+ $auth->add($reports);
+ $auth->addChild($admin, $reports);
+ }
+ if(!$auth->getPermission('calendar')) {
+ echo "create permission: calendar\n";
+ $calendar = $auth->createPermission('calendar');
+ $calendar->description = 'Модуль "Календарь ДР"';
+ $auth->add($calendar);
+ $auth->addChild($admin, $calendar);
+ }
- $calendar = $auth->createPermission('calendar');
- $calendar->description = 'Модуль "Календарь ДР"';
- $auth->add($calendar);
- $auth->addChild($admin, $calendar);
+ if(!$auth->getPermission('notes')) {
+ echo "create permission: notes\n";
+ $notes = $auth->createPermission('notes');
+ $notes->description = 'Модуль "Заметки"';
+ $auth->add($notes);
+ $auth->addChild($admin, $notes);
+ }
- $notes = $auth->createPermission('notes');
- $notes->description = 'Модуль "Заметки"';
- $auth->add($notes);
- $auth->addChild($admin, $notes);
+ if(!$auth->getPermission('accesses')) {
+ echo "create permission: accesses\n";
+ $accesses = $auth->createPermission('accesses');
+ $accesses->description = 'Модуль "Доступы"';
+ $auth->add($accesses);
+ $auth->addChild($admin, $accesses);
+ }
- $accesses = $auth->createPermission('accesses');
- $accesses->description = 'Модуль "Доступы"';
- $auth->add($accesses);
- $auth->addChild($admin, $accesses);
+ if(!$auth->getPermission('achievements')) {
+ echo "create permission: achievements\n";
+ $achievements = $auth->createPermission('achievements');
+ $achievements->description = 'Модуль "Достижения"';
+ $auth->add($achievements);
+ $auth->addChild($admin, $achievements);
+ }
- $achievements = $auth->createPermission('achievements');
- $achievements->description = 'Модуль "Достижения"';
- $auth->add($achievements);
- $auth->addChild($admin, $achievements);
+ if(!$auth->getPermission('holiday')) {
+ echo "create permission: holiday\n";
+ $holiday = $auth->createPermission('holiday');
+ $holiday->description = 'Модуль "Отпуска"';
+ $auth->add($holiday);
+ $auth->addChild($admin, $holiday);
+ }
+ if(!$auth->getPermission('balance')) {
+ echo "create permission: balance\n";
+ $balance = $auth->createPermission('balance');
+ $balance->description = 'Модуль "Баланс"';
+ $auth->add($balance);
+ $auth->addChild($admin, $balance);
+ }
- $holiday = $auth->createPermission('holiday');
- $holiday->description = 'Модуль "Отпуска"';
- $auth->add($holiday);
- $auth->addChild($admin, $holiday);
+ if(!$auth->getPermission('hh')) {
+ echo "create permission: hh\n";
+ $hh = $auth->createPermission('hh');
+ $hh->description = 'Модуль "Hh.ru"';
+ $auth->add($hh);
+ $auth->addChild($admin, $hh);
+ }
- $balance = $auth->createPermission('balance');
- $balance->description = 'Модуль "Баланс"';
- $auth->add($balance);
- $auth->addChild($admin, $balance);
+ if(!$auth->getPermission('company')) {
+ echo "create permission: company\n";
+ $company = $auth->createPermission('company');
+ $company->description = 'Модуль "Компании"';
+ $auth->add($company);
+ $auth->addChild($admin, $company);
+ }
- $hh = $auth->createPermission('hh');
- $hh->description = 'Модуль "Hh.ru"';
- $auth->add($hh);
- $auth->addChild($admin, $hh);
+ if(!$auth->getPermission('task')) {
+ echo "create permission: task\n";
+ $task = $auth->createPermission('task');
+ $task->description = 'Модуль "Задачи"';
+ $auth->add($task);
+ $auth->addChild($admin, $task);
+ }
- $company = $auth->createPermission('company');
- $company->description = 'Модуль "Компании"';
- $auth->add($company);
- $auth->addChild($admin, $company);
+ if(!$auth->getPermission('project')) {
+ echo "create permission: project\n";
+ $project = $auth->createPermission('project');
+ $project->description = 'Модуль "Проекты"';
+ $auth->add($project);
+ $auth->addChild($admin, $project);
+ }
- $task = $auth->createPermission('task');
- $task->description = 'Модуль "Задачи"';
- $auth->add($task);
- $auth->addChild($admin, $task);
+ if(!$auth->getPermission('document')) {
+ echo "create permission: document\n";
+ $documents = $auth->createPermission('document');
+ $documents->description = 'Модуль "Документы": Создание, редактирование документов, их полей и шаблонов';
+ $auth->add($documents);
+ $auth->addChild($admin, $documents);
+ }
- $project = $auth->createPermission('project');
- $project->description = 'Модуль "Проекты"';
- $auth->add($project);
- $auth->addChild($admin, $project);
+ if(!$auth->getPermission('employee')) {
+ echo "create permission: employee\n";
+ $employee = $auth->createPermission('employee');
+ $employee->description = 'Модуль "Сотрудники"';
+ $auth->add($employee);
+ $auth->addChild($admin, $employee);
+ }
- $documents = $auth->createPermission('document');
- $documents->description = 'Модуль "Документы": Создание, редактирование документов, их полей и шаблонов';
- $auth->add($documents);
- $auth->addChild($admin, $documents);
+ if(!$auth->getPermission('card')) {
+ echo "create permission: card\n";
+ $card = $auth->createPermission('card');
+ $card->description = 'Модуль "Профили"';
+ $auth->add($card);
+ $auth->addChild($admin, $card);
+ $auth->addChild($profileEditor, $card);
+ }
- $employee = $auth->createPermission('employee');
- $employee->description = 'Модуль "Сотрудники"';
- $auth->add($employee);
- $auth->addChild($admin, $employee);
+ if(!$auth->getPermission('settings')) {
+ echo "create permission: settings\n";
+ $settings = $auth->createPermission('settings');
+ $settings->description = 'Модуль "Настройки"';
+ $auth->add($settings);
+ $auth->addChild($admin, $settings);
+ }
- $card = $auth->createPermission('card');
- $card->description = 'Модуль "Профили"';
- $auth->add($card);
- $auth->addChild($admin, $card);
- $auth->addChild($profileEditor, $card);
+ if(!$auth->getPermission('settings/skill')) {
+ echo "create permission: settings/skill\n";
+ $skills = $auth->createPermission('settings/skill');
+ $skills->description = 'Навыки';
+ $auth->add($skills);
+ $auth->addChild($admin, $skills);
+ $auth->addChild($profileEditor, $skills);
+ }
- $settings = $auth->createPermission('settings');
- $settings->description = 'Модуль "Настройки"';
- $auth->add($settings);
- $auth->addChild($admin, $settings);
+ if(!$auth->getPermission('settings/mark')) {
+ echo "create permission: settings/mark\n";
+ $mark = $auth->createPermission('settings/mark');
+ $mark->description = 'Метки';
+ $auth->add($mark);
+ $auth->addChild($admin, $mark);
+ }
+
+// var_dump($auth->getPermission('settings/mark'));
- $skills = $auth->createPermission('settings/skill');
- $skills->description = 'Навыки';
- $auth->add($skills);
- $auth->addChild($admin, $skills);
- $auth->addChild($profileEditor, $skills);
}
}
\ No newline at end of file