add mark to project
This commit is contained in:
@ -92,106 +92,154 @@ class RbacController extends Controller
|
||||
$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')) {
|
||||
$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')) {
|
||||
$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')) {
|
||||
$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')) {
|
||||
$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')) {
|
||||
$reports = $auth->createPermission('reports');
|
||||
$reports->description = 'Модуль "Отчёты"';
|
||||
$auth->add($reports);
|
||||
$auth->addChild($admin, $reports);
|
||||
}
|
||||
if(!$auth->getPermission('calendar')) {
|
||||
$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')) {
|
||||
$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')) {
|
||||
$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')) {
|
||||
$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')) {
|
||||
$holiday = $auth->createPermission('holiday');
|
||||
$holiday->description = 'Модуль "Отпуска"';
|
||||
$auth->add($holiday);
|
||||
$auth->addChild($admin, $holiday);
|
||||
}
|
||||
if(!$auth->getPermission('balance')) {
|
||||
$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')) {
|
||||
$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')) {
|
||||
$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')) {
|
||||
$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')) {
|
||||
$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')) {
|
||||
$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')) {
|
||||
$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')) {
|
||||
$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')) {
|
||||
$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')) {
|
||||
$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')) {
|
||||
$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);
|
||||
}
|
||||
}
|
28
console/migrations/m230123_084421_create_mark_table.php
Normal file
28
console/migrations/m230123_084421_create_mark_table.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Handles the creation of table `{{%mark}}`.
|
||||
*/
|
||||
class m230123_084421_create_mark_table extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$this->createTable('{{%mark}}', [
|
||||
'id' => $this->primaryKey(),
|
||||
'title' => $this->string()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
$this->dropTable('{{%mark}}');
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Handles the creation of table `{{%project_mark}}`.
|
||||
*/
|
||||
class m230123_084629_create_project_mark_table extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$this->createTable('{{%project_mark}}', [
|
||||
'id' => $this->primaryKey(),
|
||||
'project_id' => $this->integer(),
|
||||
'mark_id' => $this->integer(),
|
||||
]);
|
||||
$this->addForeignKey('project_mark_project', 'project_mark', 'project_id', 'project', 'id');
|
||||
$this->addForeignKey('project_mark_mark', 'project_mark', 'mark_id', 'mark', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
$this->dropForeignKey('project_mark_project', 'project_mark');
|
||||
$this->dropForeignKey('project_mark_mark', 'project_mark');
|
||||
$this->dropTable('{{%project_mark}}');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user