Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
trntv committed Feb 26, 2021
2 parents fff4965 + 9f43357 commit 7dfdf50
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 108 deletions.
2 changes: 1 addition & 1 deletion api/config/_urlManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
'showScriptName' => false,
'rules' => [
// Api
['class' => 'yii\rest\UrlRule', 'controller' => 'api/v1/article', 'only' => ['index', 'view', 'options']],
['class' => 'yii\rest\UrlRule', 'controller' => 'v1/article', 'only' => ['index', 'view', 'options']],
]
];
36 changes: 18 additions & 18 deletions common/config/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
'itemTable' => '{{%rbac_auth_item}}',
'itemChildTable' => '{{%rbac_auth_item_child}}',
'assignmentTable' => '{{%rbac_auth_assignment}}',
'ruleTable' => '{{%rbac_auth_rule}}'
'ruleTable' => '{{%rbac_auth_rule}}',
],

'cache' => [
'class' => yii\caching\FileCache::class,
'cachePath' => '@common/runtime/cache'
'cachePath' => '@common/runtime/cache',
],

'commandBus' => [
Expand All @@ -31,12 +31,12 @@
'class' => trntv\bus\middlewares\BackgroundCommandMiddleware::class,
'backgroundHandlerPath' => '@console/yii',
'backgroundHandlerRoute' => 'command-bus/handle',
]
]
],
],
],

'formatter' => [
'class' => yii\i18n\Formatter::class
'class' => yii\i18n\Formatter::class,
],

'glide' => [
Expand All @@ -45,15 +45,15 @@
'cachePath' => '@storage/cache',
'urlManager' => 'urlManagerStorage',
'maxImageSize' => env('GLIDE_MAX_IMAGE_SIZE'),
'signKey' => env('GLIDE_SIGN_KEY')
'signKey' => env('GLIDE_SIGN_KEY'),
],

'mailer' => [
'class' => yii\swiftmailer\Mailer::class,
'messageConfig' => [
'charset' => 'UTF-8',
'from' => env('ADMIN_EMAIL')
]
'from' => env('ADMIN_EMAIL'),
],
],

'db' => [
Expand All @@ -78,8 +78,8 @@
return sprintf('[%s][%s]', Yii::$app->id, $url);
},
'logVars' => [],
'logTable' => '{{%system_log}}'
]
'logTable' => '{{%system_log}}',
],
],
],

Expand All @@ -93,7 +93,7 @@
'backend' => 'backend.php',
'frontend' => 'frontend.php',
],
'on missingTranslation' => [backend\modules\translation\Module::class, 'missingTranslation']
'on missingTranslation' => [backend\modules\translation\Module::class, 'missingTranslation'],
],
/* Uncomment this code to use DbMessageSource
'*'=> [
Expand All @@ -113,16 +113,16 @@
'baseUrl' => '@storageUrl/source',
'filesystem' => [
'class' => common\components\filesystem\LocalFlysystemBuilder::class,
'path' => '@storage/web/source'
'path' => '@storage/web/source',
],
'as log' => [
'class' => common\behaviors\FileStorageLogBehavior::class,
'component' => 'fileStorage'
]
'component' => 'fileStorage',
],
],

'keyStorage' => [
'class' => common\components\keyStorage\KeyStorage::class
'class' => common\components\keyStorage\KeyStorage::class,
],

'urlManagerBackend' => \yii\helpers\ArrayHelper::merge(
Expand Down Expand Up @@ -176,18 +176,18 @@
'class' => yii\log\EmailTarget::class,
'except' => ['yii\web\HttpException:*'],
'levels' => ['error', 'warning'],
'message' => ['from' => env('ROBOT_EMAIL'), 'to' => env('ADMIN_EMAIL')]
'message' => ['from' => env('ROBOT_EMAIL'), 'to' => env('ADMIN_EMAIL')],
];
}

if (YII_ENV_DEV) {
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = [
'class' => yii\gii\Module::class
'class' => yii\gii\Module::class,
];

$config['components']['cache'] = [
'class' => yii\caching\DummyCache::class
'class' => yii\caching\DummyCache::class,
];
$config['components']['mailer']['transport'] = [
'class' => 'Swift_SmtpTransport',
Expand Down
2 changes: 1 addition & 1 deletion common/env.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* Load application environment from .env file
*/
$dotenv = new \Dotenv\Dotenv(dirname(__DIR__));
$dotenv = \Dotenv\Dotenv::create(dirname(__DIR__));
$dotenv->load();

/**
Expand Down
4 changes: 2 additions & 2 deletions common/messages/uk/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
'Lastname' => 'Прізвище',
'Locale' => 'Локаль',
'Middlename' => 'По батькові',
'Name' => 'Им\'я',
'Name' => 'Ім\'я',
'Order' => 'Порядок',
'Page View' => 'Шаблон сторінки',
'Parent Category' => 'Батьківська категорія',
Expand All @@ -66,7 +66,7 @@
'Upload Ip' => 'IP',
'Url' => 'Url',
'User ID' => 'ID Користувача',
'Username' => 'Им’я користувача',
'Username' => 'Ім’я користувача',
'Value' => 'Значення',
'API access token' => '',
'Draft' => '',
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"trntv/cheatsheet": "^0.1@dev",
"trntv/yii2-command-bus": "^3.0",
"intervention/image": "^2.1",
"vlucas/phpdotenv": "^2.0",
"vlucas/phpdotenv": "^5.3.0",
"almasaeed2010/adminlte": "^3.0",
"npm-asset/font-awesome": "^5.0",
"npm-asset/html5shiv": "^3.0",
Expand Down
4 changes: 2 additions & 2 deletions tests/api/functional/ArticleCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ class ArticleCest extends ApiCest
// tests
public function testArticlesList(FunctionalTester $I)
{
$I->amOnPage('/v1/article');
$I->amOnPage('/v1/articles');
$I->see('Lorem ipsum');
}

public function testArticleView(FunctionalTester $I)
{
$I->amOnPage(['/v1/article', 'slug' => 'test-article-1']);
$I->amOnPage(['/v1/articles', 'slug' => 'test-article-1']);
$I->see('Lorem ipsum');
}
}
18 changes: 6 additions & 12 deletions tests/common/fixtures/data/rbac_auth_assignment.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
<?php
/**
* Created by PhpStorm.
* User: rsuarez
* Date: 8/25/15
* Time: 10:43 PM
*/

return [
[
'item_name' => "administrator",
'user_id' => "1",
'item_name' => 'administrator',
'user_id' => '1',
'created_at' => '1440552894',
],
[
'item_name' => "manager",
'user_id' => "2",
'item_name' => 'manager',
'user_id' => '2',
'created_at' => '1440552894',
],
[
'item_name' => "user",
'user_id' => "3",
'item_name' => 'user',
'user_id' => '3',
'created_at' => '1440552894',
],
];
81 changes: 37 additions & 44 deletions tests/common/fixtures/data/rbac_auth_item.php
Original file line number Diff line number Diff line change
@@ -1,56 +1,49 @@
<?php

/**
* Created by PhpStorm.
* User: Alfred
* Date: 20.10.2017
* Time: 16:03
*/

return [
[
"name" => "administrator",
"type" => "1",
"description" => "",
"rule_name" => null,
"data" => "",
"created_at" => "1508507788",
"updated_at" => "1508507788"
'name' => 'administrator',
'type' => '1',
'description' => '',
'rule_name' => null,
'data' => '',
'created_at' => '1508507788',
'updated_at' => '1508507788',
],
[
"name" => "editOwnModel",
"type" => "2",
"description" => "",
"rule_name" => "ownModelRule",
"data" => "",
"created_at" => "1508507788",
"updated_at" => "1508507788"
'name' => 'editOwnModel',
'type' => '2',
'description' => '',
'rule_name' => 'ownModelRule',
'data' => '',
'created_at' => '1508507788',
'updated_at' => '1508507788',
],
[
"name" => "loginToBackend",
"type" => "2",
"description" => "",
"rule_name" => null,
"data" => "",
"created_at" => "1508507788",
"updated_at" => "1508507788"
'name' => 'loginToBackend',
'type' => '2',
'description' => '',
'rule_name' => null,
'data' => '',
'created_at' => '1508507788',
'updated_at' => '1508507788',
],
[
"name" => "manager",
"type" => "1",
"description" => "",
"rule_name" => null,
"data" => "",
"created_at" => "1508507787",
"updated_at" => "1508507787"
'name' => 'manager',
'type' => '1',
'description' => '',
'rule_name' => null,
'data' => '',
'created_at' => '1508507787',
'updated_at' => '1508507787',
],
[
"name" => "user",
"type" => "1",
"description" => "",
"rule_name" => null,
"data" => "",
"created_at" => "1508507787",
"updated_at" => "1508507787"
]
];
'name' => 'user',
'type' => '1',
'description' => '',
'rule_name' => null,
'data' => '',
'created_at' => '1508507787',
'updated_at' => '1508507787',
],
];
26 changes: 10 additions & 16 deletions tests/common/fixtures/data/rbac_auth_item_child.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
<?php
/**
* Created by PhpStorm.
* User: Alfred
* Date: 20.10.2017
* Time: 17:03
*/

return [
[
"parent" => "user",
"child" => "editOwnModel"
'parent' => 'user',
'child' => 'editOwnModel',
],
[
"parent" => "manager",
"child" => "loginToBackend"
'parent' => 'manager',
'child' => 'loginToBackend',
],
[
"parent" => "administrator",
"child" => "manager"
'parent' => 'administrator',
'child' => 'manager',
],
[
"parent" => "manager",
"child" => "user"
]
];
'parent' => 'manager',
'child' => 'user',
],
];
16 changes: 5 additions & 11 deletions tests/common/fixtures/data/rbac_auth_rule.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
<?php
/**
* Created by PhpStorm.
* User: Alfred
* Date: 20.10.2017
* Time: 17:04
*/

return [
[
"name" => "ownModelRule",
"data" => "TzoyOToiY29tbW9uXHJiYWNccnVsZVxPd25Nb2RlbFJ1bGUiOjM6e3M6NDoibmFtZSI7czoxMjoib3duTW9kZWxSdWxlIjtzOjk6ImNyZWF0ZWRBdCI7aToxNTA4NTA3Nzg4O3M6OToidXBkYXRlZEF0IjtpOjE1MDg1MDc3ODg7fQ==",
"created_at" => "1508507788",
"updated_at" => "1508507788"
'name' => 'ownModelRule',
'data' => 'O:29:"common\rbac\rule\OwnModelRule":3:{s:4:"name";s:12:"ownModelRule";s:9:"createdAt";i:1508507788;s:9:"updatedAt";i:1508507788;}',
'created_at' => '1508507788',
'updated_at' => '1508507788'
]
];
];

0 comments on commit 7dfdf50

Please sign in to comment.