Исправления
This commit is contained in:
parent
a9259eb7dc
commit
4c61ccbb65
|
@ -25,8 +25,8 @@
|
||||||
"moonlandsoft/yii2-phpexcel": ">=2.0",
|
"moonlandsoft/yii2-phpexcel": ">=2.0",
|
||||||
"carono/yii2-1c-exchange": "^0.3.1",
|
"carono/yii2-1c-exchange": "^0.3.1",
|
||||||
"yiisoft/yii2-imagine": "*",
|
"yiisoft/yii2-imagine": "*",
|
||||||
"mirzaev/yii2-arangodb": "2.1.x-dev",
|
"mirzaev/yii2-arangodb": ">=2.1.x-dev",
|
||||||
"mirzaev/yii2-arangodb-sessions": "1.1.x-dev"
|
"mirzaev/yii2-arangodb-sessions": ">=1.1.x-dev"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"codeception/codeception": ">=4.1",
|
"codeception/codeception": ">=4.1",
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "75801d98410f1427be988c04697ee255",
|
"content-hash": "ccecbc4681132b24e370af7c3db52dd8",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "bower-asset/bootstrap",
|
"name": "bower-asset/bootstrap",
|
||||||
|
@ -829,20 +829,22 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "mirzaev/yii2-arangodb-sessions",
|
"name": "mirzaev/yii2-arangodb-sessions",
|
||||||
"version": "1.1.x-dev",
|
"version": "dev-stable",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.hood.su/mirzaev/yii2/arangodb/sessions/",
|
"url": "https://git.hood.su/mirzaev/yii2/arangodb/sessions/",
|
||||||
"reference": "8809a05c1b0d1deff2fbcb25f6fd65f851029e78"
|
"reference": "80c16734945a35a0d49170b9a1a854efb322fefb"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"mirzaev/yii2-arangodb": "~2.1.x-dev",
|
"mirzaev/yii2-arangodb": "~2.1.x-dev",
|
||||||
"php": "^8.0.0",
|
"php": "^8.0.0",
|
||||||
|
"triagens/arangodb": "~3.2",
|
||||||
"yiisoft/yii2": "2.*"
|
"yiisoft/yii2": "2.*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"yiisoft/yii2-debug": "*"
|
"yiisoft/yii2-debug": "*"
|
||||||
},
|
},
|
||||||
|
"default-branch": true,
|
||||||
"type": "yii2-extension",
|
"type": "yii2-extension",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
@ -868,7 +870,7 @@
|
||||||
"DbSession",
|
"DbSession",
|
||||||
"yii2"
|
"yii2"
|
||||||
],
|
],
|
||||||
"time": "2021-03-21T18:58:00+00:00"
|
"time": "2021-03-21T18:39:52+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "moonlandsoft/yii2-phpexcel",
|
"name": "moonlandsoft/yii2-phpexcel",
|
||||||
|
|
|
@ -24,9 +24,9 @@ $config = [
|
||||||
// 'enableAutoLogin' => true,
|
// 'enableAutoLogin' => true,
|
||||||
'enableSession' => true
|
'enableSession' => true
|
||||||
],
|
],
|
||||||
'authManager' => [
|
// 'authManager' => [
|
||||||
'class' => 'mirzaev\yii2\arangodb\rbac\DbManager',
|
// 'class' => 'mirzaev\yii2\arangodb\rbac\DbManager',
|
||||||
],
|
// ],
|
||||||
'session' => [
|
'session' => [
|
||||||
'class' => 'mirzaev\yii2\arangodb\sessions\ArangoDbSession',
|
'class' => 'mirzaev\yii2\arangodb\sessions\ArangoDbSession',
|
||||||
'document' => 'session',
|
'document' => 'session',
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace app\controllers;
|
||||||
|
|
||||||
use app\models\AccountForm;
|
use app\models\AccountForm;
|
||||||
|
|
||||||
use Yii;
|
use yii;
|
||||||
use yii\web\Controller;
|
use yii\web\Controller;
|
||||||
use yii\web\Response;
|
use yii\web\Response;
|
||||||
use yii\filters\AccessControl;
|
use yii\filters\AccessControl;
|
||||||
|
@ -35,16 +35,16 @@ class AuthenticationController extends Controller
|
||||||
|
|
||||||
public function actionIndex()
|
public function actionIndex()
|
||||||
{
|
{
|
||||||
if (Yii::$app->request->isAjax) {
|
if (yii::$app->request->isAjax) {
|
||||||
// AJAX-POST-запрос
|
// AJAX-POST-запрос
|
||||||
|
|
||||||
// Инициализация
|
// Инициализация
|
||||||
$model = new AccountForm(Yii::$app->request->post('AccountForm'));
|
$model = new AccountForm(yii::$app->request->post('AccountForm'));
|
||||||
$model->scenario = $model::SCENARIO_AUTHENTICATION;
|
$model->scenario = $model::SCENARIO_AUTHENTICATION;
|
||||||
|
|
||||||
Yii::$app->response->format = Response::FORMAT_JSON;
|
yii::$app->response->format = Response::FORMAT_JSON;
|
||||||
|
|
||||||
if (!Yii::$app->user->isGuest || $model->authentication()) {
|
if (!yii::$app->user->isGuest || $model->authentication()) {
|
||||||
// Аккаунт аутентифицирован
|
// Аккаунт аутентифицирован
|
||||||
|
|
||||||
// Создание сессии
|
// Создание сессии
|
||||||
|
@ -62,10 +62,10 @@ class AuthenticationController extends Controller
|
||||||
'notifications_panel',
|
'notifications_panel',
|
||||||
'notifications_panel_full'
|
'notifications_panel_full'
|
||||||
)),
|
)),
|
||||||
'_csrf' => Yii::$app->request->getCsrfToken()
|
'_csrf' => yii::$app->request->getCsrfToken()
|
||||||
];
|
];
|
||||||
|
|
||||||
if (($cookies = Yii::$app->request->cookies)->has('redirect')) {
|
if (($cookies = yii::$app->request->cookies)->has('redirect')) {
|
||||||
// Найдено cookie с переадресацией
|
// Найдено cookie с переадресацией
|
||||||
|
|
||||||
// Запись ответа
|
// Запись ответа
|
||||||
|
@ -85,11 +85,11 @@ class AuthenticationController extends Controller
|
||||||
// $return['main'] = (new $controller())->$action();
|
// $return['main'] = (new $controller())->$action();
|
||||||
|
|
||||||
// Очистка cookie
|
// Очистка cookie
|
||||||
unset(Yii::$app->response->cookies['redirect']);
|
unset(yii::$app->response->cookies['redirect']);
|
||||||
} else {
|
} else {
|
||||||
// Не найдено cookie с переадресацией
|
// Не найдено cookie с переадресацией
|
||||||
|
|
||||||
if (Yii::$app->request->pathInfo === 'authentication' || Yii::$app->request->pathInfo === 'registration') {
|
if (yii::$app->request->pathInfo === 'authentication' || yii::$app->request->pathInfo === 'registration') {
|
||||||
// Если клиент на промежуточном URI
|
// Если клиент на промежуточном URI
|
||||||
|
|
||||||
// Запись ответа
|
// Запись ответа
|
||||||
|
@ -102,18 +102,18 @@ class AuthenticationController extends Controller
|
||||||
} else {
|
} else {
|
||||||
// Аккаунт не аутентифицирован
|
// Аккаунт не аутентифицирован
|
||||||
|
|
||||||
Yii::$app->response->statusCode = 400;
|
yii::$app->response->statusCode = 400;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'main' => $this->renderPartial('/account/index', compact('model')),
|
'main' => $this->renderPartial('/account/index', compact('model')),
|
||||||
'redirect' => '/authentication',
|
'redirect' => '/authentication',
|
||||||
'_csrf' => Yii::$app->request->getCsrfToken()
|
'_csrf' => yii::$app->request->getCsrfToken()
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Yii::$app->user->isGuest) {
|
if (!yii::$app->user->isGuest) {
|
||||||
Yii::$app->response->redirect('/');
|
yii::$app->response->redirect('/');
|
||||||
} else {
|
} else {
|
||||||
return $this->render('/account/index');
|
return $this->render('/account/index');
|
||||||
}
|
}
|
||||||
|
|
|
@ -460,6 +460,7 @@ class Product extends Document
|
||||||
public static function searchByPartialCatn(string $catn, int $limit = 1, array $select = []): static|array|null
|
public static function searchByPartialCatn(string $catn, int $limit = 1, array $select = []): static|array|null
|
||||||
{
|
{
|
||||||
$query = self::find()
|
$query = self::find()
|
||||||
|
->for('product')
|
||||||
->in('product_search')
|
->in('product_search')
|
||||||
->search(['catn' => $catn])
|
->search(['catn' => $catn])
|
||||||
->limit($limit)
|
->limit($limit)
|
||||||
|
|
|
@ -32,8 +32,9 @@ use app\models\Product;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php if (
|
<?php if (
|
||||||
yii::$app->user->identity->type === 'administrator'
|
!yii::$app->user->isGuest
|
||||||
|| yii::$app->user->identity->type === 'moderator'
|
&& (yii::$app->user->identity->type === 'administrator'
|
||||||
|
|| yii::$app->user->identity->type === 'moderator')
|
||||||
) : ?>
|
) : ?>
|
||||||
<input id="product_slider_image_new" type="file" class="d-none" onchange="return product_panel_images_write('<?= $model['catn'] ?>', this);" multiple />
|
<input id="product_slider_image_new" type="file" class="d-none" onchange="return product_panel_images_write('<?= $model['catn'] ?>', this);" multiple />
|
||||||
<label class="p-0 mb-2" for="product_slider_image_new" role="button">
|
<label class="p-0 mb-2" for="product_slider_image_new" role="button">
|
||||||
|
@ -78,8 +79,9 @@ use app\models\Product;
|
||||||
<div class="col ml-4 d-flex flex-column">
|
<div class="col ml-4 d-flex flex-column">
|
||||||
<div class="row mb-1">
|
<div class="row mb-1">
|
||||||
<?php if (
|
<?php if (
|
||||||
yii::$app->user->identity->type === 'administrator'
|
!yii::$app->user->isGuest
|
||||||
|| yii::$app->user->identity->type === 'moderator'
|
&& (yii::$app->user->identity->type === 'administrator'
|
||||||
|
|| yii::$app->user->identity->type === 'moderator')
|
||||||
) : ?>
|
) : ?>
|
||||||
<h3 id="title_<?= $model['catn'] ?>" class="my-auto pointer-event" role="button" onclick="return product_panel_title_edit('<?= $model['catn'] ?>', this);"><?= $model['name'] ?? 'Без названия' ?></h3>
|
<h3 id="title_<?= $model['catn'] ?>" class="my-auto pointer-event" role="button" onclick="return product_panel_title_edit('<?= $model['catn'] ?>', this);"><?= $model['name'] ?? 'Без названия' ?></h3>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
|
@ -87,8 +89,9 @@ use app\models\Product;
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if (
|
<?php if (
|
||||||
yii::$app->user->identity->type === 'administrator'
|
!yii::$app->user->isGuest
|
||||||
|| yii::$app->user->identity->type === 'moderator'
|
&& (yii::$app->user->identity->type === 'administrator'
|
||||||
|
|| yii::$app->user->identity->type === 'moderator')
|
||||||
) : ?>
|
) : ?>
|
||||||
<h5 id="catn_<?= $model['catn'] ?>" class="ml-auto my-auto d-flex pointer-event" role="button" onclick="return product_panel_catn_edit('<?= $model['catn'] ?>', this, true);">
|
<h5 id="catn_<?= $model['catn'] ?>" class="ml-auto my-auto d-flex pointer-event" role="button" onclick="return product_panel_catn_edit('<?= $model['catn'] ?>', this, true);">
|
||||||
<?= $model['catn'] ?>
|
<?= $model['catn'] ?>
|
||||||
|
@ -110,8 +113,9 @@ use app\models\Product;
|
||||||
<div class="dropdown-divider px-0 mb-3"></div>
|
<div class="dropdown-divider px-0 mb-3"></div>
|
||||||
<div class="row mb-3 h-100 product_panel d-flex flex-column">
|
<div class="row mb-3 h-100 product_panel d-flex flex-column">
|
||||||
<?php if (
|
<?php if (
|
||||||
yii::$app->user->identity->type === 'administrator'
|
!yii::$app->user->isGuest
|
||||||
|| yii::$app->user->identity->type === 'moderator'
|
&& (yii::$app->user->identity->type === 'administrator'
|
||||||
|
|| yii::$app->user->identity->type === 'moderator')
|
||||||
) : ?>
|
) : ?>
|
||||||
<p id="description_<?= $model['catn'] ?>" class="mt-0 ml-0 text-break pointer-event product_description" role="button" onclick="return product_panel_description_edit('<?= $model['catn'] ?>', this);"><?= $model['desc'] ?? 'Без описания' ?></p>
|
<p id="description_<?= $model['catn'] ?>" class="mt-0 ml-0 text-break pointer-event product_description" role="button" onclick="return product_panel_description_edit('<?= $model['catn'] ?>', this);"><?= $model['desc'] ?? 'Без описания' ?></p>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
|
@ -174,8 +178,9 @@ use app\models\Product;
|
||||||
|
|
||||||
<script src="/js/product.js" defer></script>
|
<script src="/js/product.js" defer></script>
|
||||||
<?php if (
|
<?php if (
|
||||||
yii::$app->user->identity->type === 'administrator'
|
!yii::$app->user->isGuest
|
||||||
|| yii::$app->user->identity->type === 'moderator'
|
&& (yii::$app->user->identity->type === 'administrator'
|
||||||
|
|| yii::$app->user->identity->type === 'moderator')
|
||||||
) : ?>
|
) : ?>
|
||||||
<script src="/js/product_panel.js" defer></script>
|
<script src="/js/product_panel.js" defer></script>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
|
@ -6,7 +6,10 @@ use yii;
|
||||||
use yii\bootstrap\ActiveForm;
|
use yii\bootstrap\ActiveForm;
|
||||||
|
|
||||||
// Инициализация
|
// Инициализация
|
||||||
if (yii::$app->user->identity->agnt) {
|
if (
|
||||||
|
!yii::$app->user->isGuest
|
||||||
|
&& yii::$app->user->identity->agnt
|
||||||
|
) {
|
||||||
$panel ?? $panel = 'profile_panel_settings_import';
|
$panel ?? $panel = 'profile_panel_settings_import';
|
||||||
} else {
|
} else {
|
||||||
$panel ?? $panel = 'profile_panel_settings_account';
|
$panel ?? $panel = 'profile_panel_settings_account';
|
||||||
|
@ -27,7 +30,10 @@ if (yii::$app->user->identity->agnt) {
|
||||||
<div class="profile_panel_menu mb-3">
|
<div class="profile_panel_menu mb-3">
|
||||||
<label class="btn button_white mb-0 mr-2" for="profile_panel_settings_account">Аккаунт</label>
|
<label class="btn button_white mb-0 mr-2" for="profile_panel_settings_account">Аккаунт</label>
|
||||||
<?php
|
<?php
|
||||||
if (yii::$app->user->identity->agnt) {
|
if (
|
||||||
|
!yii::$app->user->isGuest
|
||||||
|
&& yii::$app->user->identity->agnt
|
||||||
|
) {
|
||||||
echo <<<HTML
|
echo <<<HTML
|
||||||
<label class="btn button_white mb-0 mr-2" for="profile_panel_settings_company">Компания</label>
|
<label class="btn button_white mb-0 mr-2" for="profile_panel_settings_company">Компания</label>
|
||||||
<label class="btn button_white mb-0" for="profile_panel_settings_import">Импорт</label>
|
<label class="btn button_white mb-0" for="profile_panel_settings_import">Импорт</label>
|
||||||
|
@ -41,7 +47,10 @@ if (yii::$app->user->identity->agnt) {
|
||||||
1
|
1
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if (yii::$app->user->identity->agnt) : ?>
|
<?php if (
|
||||||
|
!yii::$app->user->isGuest
|
||||||
|
&& yii::$app->user->identity->agnt
|
||||||
|
) : ?>
|
||||||
<input type="radio" id="profile_panel_settings_company" name="main_panel" <?= $panel === 'profile_panel_settings_company' ? 'checked' : null ?> />
|
<input type="radio" id="profile_panel_settings_company" name="main_panel" <?= $panel === 'profile_panel_settings_company' ? 'checked' : null ?> />
|
||||||
<div class="col">
|
<div class="col">
|
||||||
2
|
2
|
||||||
|
@ -88,7 +97,8 @@ if (yii::$app->user->identity->agnt) {
|
||||||
|
|
||||||
<script src="/js/profile.js" defer></script>
|
<script src="/js/profile.js" defer></script>
|
||||||
<?php if (
|
<?php if (
|
||||||
yii::$app->user->identity->type === 'administrator'
|
!yii::$app->user->isGuest
|
||||||
|
&& yii::$app->user->identity->type === 'administrator'
|
||||||
|| yii::$app->user->identity->type === 'moderator'
|
|| yii::$app->user->identity->type === 'moderator'
|
||||||
) : ?>
|
) : ?>
|
||||||
<script src="/js/profile_panel.js" defer></script>
|
<script src="/js/profile_panel.js" defer></script>
|
||||||
|
|
|
@ -79,8 +79,9 @@ $panel ?? $panel = 'profile_panel_monitoring_input_search_history';
|
||||||
|
|
||||||
<script src="/js/profile.js" defer></script>
|
<script src="/js/profile.js" defer></script>
|
||||||
<?php if (
|
<?php if (
|
||||||
yii::$app->user->identity->type === 'administrator'
|
!yii::$app->user->isGuest
|
||||||
|| yii::$app->user->identity->type === 'moderator'
|
&& (yii::$app->user->identity->type === 'administrator'
|
||||||
|
|| yii::$app->user->identity->type === 'moderator')
|
||||||
) : ?>
|
) : ?>
|
||||||
<script src="/js/profile_panel.js" defer></script>
|
<script src="/js/profile_panel.js" defer></script>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
|
@ -19,8 +19,9 @@ use app\models\SupplyEdgeProduct;
|
||||||
<dl class="m-0">
|
<dl class="m-0">
|
||||||
<?php
|
<?php
|
||||||
if (
|
if (
|
||||||
yii::$app->user->identity->type === 'administrator'
|
!yii::$app->user->isGuest
|
||||||
|| yii::$app->user->identity->type === 'moderator'
|
&& (yii::$app->user->identity->type === 'administrator'
|
||||||
|
|| yii::$app->user->identity->type === 'moderator')
|
||||||
) {
|
) {
|
||||||
// Пользователь является доверенным
|
// Пользователь является доверенным
|
||||||
|
|
||||||
|
|
|
@ -65,8 +65,9 @@ $panel ?? $panel = 'profile_panel_supplies_input_import';
|
||||||
|
|
||||||
<script src="/js/profile.js" defer></script>
|
<script src="/js/profile.js" defer></script>
|
||||||
<?php if (
|
<?php if (
|
||||||
yii::$app->user->identity->type === 'administrator'
|
!yii::$app->user->isGuest
|
||||||
|| yii::$app->user->identity->type === 'moderator'
|
&& (yii::$app->user->identity->type === 'administrator'
|
||||||
|
|| yii::$app->user->identity->type === 'moderator')
|
||||||
) : ?>
|
) : ?>
|
||||||
<script src="/js/profile_panel.js" defer></script>
|
<script src="/js/profile_panel.js" defer></script>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
|
@ -150,8 +150,9 @@
|
||||||
<script src="/js/cart.js" defer></script>
|
<script src="/js/cart.js" defer></script>
|
||||||
<script src="/js/product.js" defer></script>
|
<script src="/js/product.js" defer></script>
|
||||||
<?php if (
|
<?php if (
|
||||||
yii::$app->user->identity->type === 'administrator'
|
!yii::$app->user->isGuest
|
||||||
|| yii::$app->user->identity->type === 'moderator'
|
&& (yii::$app->user->identity->type === 'administrator'
|
||||||
|
|| yii::$app->user->identity->type === 'moderator')
|
||||||
) : ?>
|
) : ?>
|
||||||
<script src="/js/product_panel.js" defer></script>
|
<script src="/js/product_panel.js" defer></script>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
Reference in New Issue