Исправления
This commit is contained in:
parent
a9259eb7dc
commit
4c61ccbb65
|
@ -25,8 +25,8 @@
|
|||
"moonlandsoft/yii2-phpexcel": ">=2.0",
|
||||
"carono/yii2-1c-exchange": "^0.3.1",
|
||||
"yiisoft/yii2-imagine": "*",
|
||||
"mirzaev/yii2-arangodb": "2.1.x-dev",
|
||||
"mirzaev/yii2-arangodb-sessions": "1.1.x-dev"
|
||||
"mirzaev/yii2-arangodb": ">=2.1.x-dev",
|
||||
"mirzaev/yii2-arangodb-sessions": ">=1.1.x-dev"
|
||||
},
|
||||
"require-dev": {
|
||||
"codeception/codeception": ">=4.1",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "75801d98410f1427be988c04697ee255",
|
||||
"content-hash": "ccecbc4681132b24e370af7c3db52dd8",
|
||||
"packages": [
|
||||
{
|
||||
"name": "bower-asset/bootstrap",
|
||||
|
@ -829,20 +829,22 @@
|
|||
},
|
||||
{
|
||||
"name": "mirzaev/yii2-arangodb-sessions",
|
||||
"version": "1.1.x-dev",
|
||||
"version": "dev-stable",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://git.hood.su/mirzaev/yii2/arangodb/sessions/",
|
||||
"reference": "8809a05c1b0d1deff2fbcb25f6fd65f851029e78"
|
||||
"reference": "80c16734945a35a0d49170b9a1a854efb322fefb"
|
||||
},
|
||||
"require": {
|
||||
"mirzaev/yii2-arangodb": "~2.1.x-dev",
|
||||
"php": "^8.0.0",
|
||||
"triagens/arangodb": "~3.2",
|
||||
"yiisoft/yii2": "2.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"yiisoft/yii2-debug": "*"
|
||||
},
|
||||
"default-branch": true,
|
||||
"type": "yii2-extension",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@ -868,7 +870,7 @@
|
|||
"DbSession",
|
||||
"yii2"
|
||||
],
|
||||
"time": "2021-03-21T18:58:00+00:00"
|
||||
"time": "2021-03-21T18:39:52+00:00"
|
||||
},
|
||||
{
|
||||
"name": "moonlandsoft/yii2-phpexcel",
|
||||
|
|
|
@ -24,9 +24,9 @@ $config = [
|
|||
// 'enableAutoLogin' => true,
|
||||
'enableSession' => true
|
||||
],
|
||||
'authManager' => [
|
||||
'class' => 'mirzaev\yii2\arangodb\rbac\DbManager',
|
||||
],
|
||||
// 'authManager' => [
|
||||
// 'class' => 'mirzaev\yii2\arangodb\rbac\DbManager',
|
||||
// ],
|
||||
'session' => [
|
||||
'class' => 'mirzaev\yii2\arangodb\sessions\ArangoDbSession',
|
||||
'document' => 'session',
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace app\controllers;
|
|||
|
||||
use app\models\AccountForm;
|
||||
|
||||
use Yii;
|
||||
use yii;
|
||||
use yii\web\Controller;
|
||||
use yii\web\Response;
|
||||
use yii\filters\AccessControl;
|
||||
|
@ -35,16 +35,16 @@ class AuthenticationController extends Controller
|
|||
|
||||
public function actionIndex()
|
||||
{
|
||||
if (Yii::$app->request->isAjax) {
|
||||
if (yii::$app->request->isAjax) {
|
||||
// AJAX-POST-запрос
|
||||
|
||||
// Инициализация
|
||||
$model = new AccountForm(Yii::$app->request->post('AccountForm'));
|
||||
$model = new AccountForm(yii::$app->request->post('AccountForm'));
|
||||
$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_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 с переадресацией
|
||||
|
||||
// Запись ответа
|
||||
|
@ -85,11 +85,11 @@ class AuthenticationController extends Controller
|
|||
// $return['main'] = (new $controller())->$action();
|
||||
|
||||
// Очистка cookie
|
||||
unset(Yii::$app->response->cookies['redirect']);
|
||||
unset(yii::$app->response->cookies['redirect']);
|
||||
} else {
|
||||
// Не найдено cookie с переадресацией
|
||||
|
||||
if (Yii::$app->request->pathInfo === 'authentication' || Yii::$app->request->pathInfo === 'registration') {
|
||||
if (yii::$app->request->pathInfo === 'authentication' || yii::$app->request->pathInfo === 'registration') {
|
||||
// Если клиент на промежуточном URI
|
||||
|
||||
// Запись ответа
|
||||
|
@ -102,18 +102,18 @@ class AuthenticationController extends Controller
|
|||
} else {
|
||||
// Аккаунт не аутентифицирован
|
||||
|
||||
Yii::$app->response->statusCode = 400;
|
||||
yii::$app->response->statusCode = 400;
|
||||
|
||||
return [
|
||||
'main' => $this->renderPartial('/account/index', compact('model')),
|
||||
'redirect' => '/authentication',
|
||||
'_csrf' => Yii::$app->request->getCsrfToken()
|
||||
'_csrf' => yii::$app->request->getCsrfToken()
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if (!Yii::$app->user->isGuest) {
|
||||
Yii::$app->response->redirect('/');
|
||||
if (!yii::$app->user->isGuest) {
|
||||
yii::$app->response->redirect('/');
|
||||
} else {
|
||||
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
|
||||
{
|
||||
$query = self::find()
|
||||
->for('product')
|
||||
->in('product_search')
|
||||
->search(['catn' => $catn])
|
||||
->limit($limit)
|
||||
|
|
|
@ -32,8 +32,9 @@ use app\models\Product;
|
|||
?>
|
||||
|
||||
<?php if (
|
||||
yii::$app->user->identity->type === 'administrator'
|
||||
|| yii::$app->user->identity->type === 'moderator'
|
||||
!yii::$app->user->isGuest
|
||||
&& (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 />
|
||||
<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="row mb-1">
|
||||
<?php if (
|
||||
yii::$app->user->identity->type === 'administrator'
|
||||
|| yii::$app->user->identity->type === 'moderator'
|
||||
!yii::$app->user->isGuest
|
||||
&& (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>
|
||||
<?php else : ?>
|
||||
|
@ -87,8 +89,9 @@ use app\models\Product;
|
|||
<?php endif ?>
|
||||
|
||||
<?php if (
|
||||
yii::$app->user->identity->type === 'administrator'
|
||||
|| yii::$app->user->identity->type === 'moderator'
|
||||
!yii::$app->user->isGuest
|
||||
&& (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);">
|
||||
<?= $model['catn'] ?>
|
||||
|
@ -110,8 +113,9 @@ use app\models\Product;
|
|||
<div class="dropdown-divider px-0 mb-3"></div>
|
||||
<div class="row mb-3 h-100 product_panel d-flex flex-column">
|
||||
<?php if (
|
||||
yii::$app->user->identity->type === 'administrator'
|
||||
|| yii::$app->user->identity->type === 'moderator'
|
||||
!yii::$app->user->isGuest
|
||||
&& (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>
|
||||
<?php else : ?>
|
||||
|
@ -174,8 +178,9 @@ use app\models\Product;
|
|||
|
||||
<script src="/js/product.js" defer></script>
|
||||
<?php if (
|
||||
yii::$app->user->identity->type === 'administrator'
|
||||
|| yii::$app->user->identity->type === 'moderator'
|
||||
!yii::$app->user->isGuest
|
||||
&& (yii::$app->user->identity->type === 'administrator'
|
||||
|| yii::$app->user->identity->type === 'moderator')
|
||||
) : ?>
|
||||
<script src="/js/product_panel.js" defer></script>
|
||||
<?php endif ?>
|
|
@ -6,7 +6,10 @@ use yii;
|
|||
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';
|
||||
} else {
|
||||
$panel ?? $panel = 'profile_panel_settings_account';
|
||||
|
@ -27,7 +30,10 @@ if (yii::$app->user->identity->agnt) {
|
|||
<div class="profile_panel_menu mb-3">
|
||||
<label class="btn button_white mb-0 mr-2" for="profile_panel_settings_account">Аккаунт</label>
|
||||
<?php
|
||||
if (yii::$app->user->identity->agnt) {
|
||||
if (
|
||||
!yii::$app->user->isGuest
|
||||
&& yii::$app->user->identity->agnt
|
||||
) {
|
||||
echo <<<HTML
|
||||
<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>
|
||||
|
@ -41,7 +47,10 @@ if (yii::$app->user->identity->agnt) {
|
|||
1
|
||||
</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 ?> />
|
||||
<div class="col">
|
||||
2
|
||||
|
@ -88,7 +97,8 @@ if (yii::$app->user->identity->agnt) {
|
|||
|
||||
<script src="/js/profile.js" defer></script>
|
||||
<?php if (
|
||||
yii::$app->user->identity->type === 'administrator'
|
||||
!yii::$app->user->isGuest
|
||||
&& yii::$app->user->identity->type === 'administrator'
|
||||
|| yii::$app->user->identity->type === 'moderator'
|
||||
) : ?>
|
||||
<script src="/js/profile_panel.js" defer></script>
|
||||
|
|
|
@ -23,12 +23,12 @@ $panel ?? $panel = 'profile_panel_monitoring_input_search_history';
|
|||
<label class="btn button_white mb-0" for="profile_panel_monitoring_input_log">Журнал действий</label>
|
||||
</div>
|
||||
<div class="profile_panel_content">
|
||||
<input type="radio" id="profile_panel_monitoring_input_orders_history" name="main_panel" <?= $panel === 'profile_panel_monitoring_input_orders_history' ? 'checked' : null ?>/>
|
||||
<input type="radio" id="profile_panel_monitoring_input_orders_history" name="main_panel" <?= $panel === 'profile_panel_monitoring_input_orders_history' ? 'checked' : null ?> />
|
||||
<div class="col p-3">
|
||||
История заказов в разработке
|
||||
</div>
|
||||
|
||||
<input type="radio" id="profile_panel_monitoring_input_search_history" name="main_panel" <?= $panel === 'profile_panel_monitoring_input_search_history' ? 'checked' : null ?>/>
|
||||
<input type="radio" id="profile_panel_monitoring_input_search_history" name="main_panel" <?= $panel === 'profile_panel_monitoring_input_search_history' ? 'checked' : null ?> />
|
||||
<div class="col rounded overflow-hidden">
|
||||
<div class="row header_blue py-2">
|
||||
<div class="col-sm-4 col-md-3">IPv4</div>
|
||||
|
@ -36,25 +36,25 @@ $panel ?? $panel = 'profile_panel_monitoring_input_search_history';
|
|||
<div class="col">Время</div>
|
||||
</div>
|
||||
<?php
|
||||
foreach ($search_history ?? [] as $row) {
|
||||
// Инициализация
|
||||
$time = $row->jrnl;
|
||||
$date = empty($row->jrnl) ? '' : date('H:i d.m.Y', end($time)['date']);
|
||||
foreach ($search_history ?? [] as $row) {
|
||||
// Инициализация
|
||||
$time = $row->jrnl;
|
||||
$date = empty($row->jrnl) ? '' : date('H:i d.m.Y', end($time)['date']);
|
||||
|
||||
echo <<<HTML
|
||||
echo <<<HTML
|
||||
<div class="row py-1">
|
||||
<div class="col-sm-4 col-md-3">$row->ipv4</div>
|
||||
<div class="col-7 col-sm-3 col-md-4 col-lg-6 pr-0 px-sm-0 px-lg-3">$row->text</div>
|
||||
<div class="col">$date</div>
|
||||
</div>
|
||||
HTML;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="mt-3">
|
||||
<?php
|
||||
$page = ($page_search_history ?? 0) + 1;
|
||||
$page = ($page_search_history ?? 0) + 1;
|
||||
|
||||
echo <<<HTML
|
||||
echo <<<HTML
|
||||
<div class="row">
|
||||
<button class="btn button_clean button_blue" onclick="return page_profile_monitoring(-1, 'profile_panel_monitoring_input_search_history');">Назад</button>
|
||||
<p>$page</p>
|
||||
|
@ -66,7 +66,7 @@ $panel ?? $panel = 'profile_panel_monitoring_input_search_history';
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<input type="radio" id="profile_panel_monitoring_input_log" name="main_panel" <?= $panel === 'profile_panel_monitoring_input_log' ? 'checked' : null ?>/>
|
||||
<input type="radio" id="profile_panel_monitoring_input_log" name="main_panel" <?= $panel === 'profile_panel_monitoring_input_log' ? 'checked' : null ?> />
|
||||
<div class="col p-3">
|
||||
Журнал в разработке
|
||||
</div>
|
||||
|
@ -79,8 +79,9 @@ $panel ?? $panel = 'profile_panel_monitoring_input_search_history';
|
|||
|
||||
<script src="/js/profile.js" defer></script>
|
||||
<?php if (
|
||||
yii::$app->user->identity->type === 'administrator'
|
||||
|| yii::$app->user->identity->type === 'moderator'
|
||||
!yii::$app->user->isGuest
|
||||
&& (yii::$app->user->identity->type === 'administrator'
|
||||
|| yii::$app->user->identity->type === 'moderator')
|
||||
) : ?>
|
||||
<script src="/js/profile_panel.js" defer></script>
|
||||
<?php endif ?>
|
|
@ -19,8 +19,9 @@ use app\models\SupplyEdgeProduct;
|
|||
<dl class="m-0">
|
||||
<?php
|
||||
if (
|
||||
yii::$app->user->identity->type === 'administrator'
|
||||
|| yii::$app->user->identity->type === 'moderator'
|
||||
!yii::$app->user->isGuest
|
||||
&& (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>
|
||||
<?php if (
|
||||
yii::$app->user->identity->type === 'administrator'
|
||||
|| yii::$app->user->identity->type === 'moderator'
|
||||
!yii::$app->user->isGuest
|
||||
&& (yii::$app->user->identity->type === 'administrator'
|
||||
|| yii::$app->user->identity->type === 'moderator')
|
||||
) : ?>
|
||||
<script src="/js/profile_panel.js" defer></script>
|
||||
<?php endif ?>
|
|
@ -150,8 +150,9 @@
|
|||
<script src="/js/cart.js" defer></script>
|
||||
<script src="/js/product.js" defer></script>
|
||||
<?php if (
|
||||
yii::$app->user->identity->type === 'administrator'
|
||||
|| yii::$app->user->identity->type === 'moderator'
|
||||
!yii::$app->user->isGuest
|
||||
&& (yii::$app->user->identity->type === 'administrator'
|
||||
|| yii::$app->user->identity->type === 'moderator')
|
||||
) : ?>
|
||||
<script src="/js/product_panel.js" defer></script>
|
||||
<?php endif ?>
|
Reference in New Issue