Blame view

backend/config/main.php 7.59 KB
5c2eb7c8   Yarik   Big commit almost...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
  <?php
      use common\behaviors\ArtBoxAccessBehavior;
      $params = array_merge(
          require(__DIR__ . '/../../common/config/params.php'),
          require(__DIR__ . '/../../common/config/params-local.php'),
          require(__DIR__ . '/params.php'),
          require(__DIR__ . '/params-local.php')
      );
      
      return [
          'id' => 'app-backend',
          'basePath' => dirname(__DIR__),
          'controllerMap' => [
              'elfinder' => [
                  'class' => 'mihaildev\elfinder\Controller',
                  'access' => ['@'], //глобальный доступ к фаил менеджеру @ - для авторизорованных , ? - для гостей , чтоб открыть всем ['@', '?']
                  'disabledCommands' => ['netmount'], //отключение ненужных команд https://github.com/Studio-42/elFinder/wiki/Client-configuration-options#commands
                  'roots' => [
                      [
                          'class' => 'mihaildev\elfinder\volume\UserPath',
                          'path'  => '../../storage/user_{id}',
                          'name'  => 'My Documents'
                      ],
                  ],
                  'watermark' => [
                      'source'         => __DIR__.'/logo.png', // Path to Water mark image
                      'marginRight'    => 5,          // Margin right pixel
                      'marginBottom'   => 5,          // Margin bottom pixel
                      'quality'        => 95,         // JPEG image save quality
                      'transparency'   => 70,         // Water mark image transparency ( other than PNG )
                      'targetType'     => IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP, // Target image formats ( bit-field )
                      'targetMinPixel' => 200         // Target image minimum pixel size
                  ]
              ],
              'artbox-comments' => [
                  'class' => 'common\modules\comment\controllers\ManageController',
                  'viewPath' => '@common/modules/comment/views/manage',
              ],
          ],
          'layout' => 'admin',
          'controllerNamespace' => 'backend\controllers',
          'bootstrap' => ['log'],
          'as AccessBehavior' => [
              'class' => ArtBoxAccessBehavior::className(),
              'rules' =>
                  [
                      'permit/access' =>
                          [
                              [
                                  'actions' => ['role', 'permission','add-role', 'update-role','add-permission', 'update-permission' ],
                                  'allow' => true,
                              ]
                          ],
                      'site' =>
                          [
                              [
                                  'actions' => ['login', 'error','logout',],
                                  'allow' => true,
                              ],
                              [
                                  'actions' => ['index'],
                                  'allow' => true,
                                  'roles' => ['@'],
                              ],
                              [
                                  'actions' => ['images'],
                                  'allow' => true,
                                  'roles' => ['@'],
                              ]
                          
                          ],
                      'file/uploader' =>[
                          [
                              'actions' => ['images-upload'],
                              'allow' => true,
                          ]
                      ],
                      'elfinder' => [
                          [
                              'actions' => ['manager','connect'],
                              'allow' => true,
                          ]
                      ]
                  
                  
                  ]
          ],
          'modules' => [
              'permit' => [
                  'class' => 'developeruz\db_rbac\Yii2DbRbac',
                  'params' => [
                      'userClass' => 'backend\models\User'
                  ]
              ],
              
              'rubrication' => [
                  'class' => 'common\modules\rubrication\Module',
              ],
              'product' => [
                  'class' => 'common\modules\product\Module'
              ],
              'gridview' =>  [
                  'class' => '\kartik\grid\Module'
              ],
              'artbox-comment' => [
                  'class' => 'common\modules\comment\Module',
                  'userIdentityClass' => 'common\models\Customer',
              ],
          ],
          'components' => [
              'authManager' => [
                  'class' => 'yii\rbac\DbManager',
              ],
              'user' => [
                  'identityClass' => 'common\models\User',
                  'enableAutoLogin' => true,
              ],
              'log' => [
                  'traceLevel' => YII_DEBUG ? 3 : 0,
                  'targets' => [
                      [
                          'class' => 'yii\log\FileTarget',
                          'levels' => ['error', 'warning'],
                      ],
                  ],
              ],
              'imageCache' => [
                  'class' => 'iutbay\yii2imagecache\ImageCache',
                  'sourcePath' => '@storage',
                  'sourceUrl' => '/storage',
                  'thumbsPath' => '@storage/thumbs',
                  'thumbsUrl' => '/storage/thumbs',
                  'sizes' => [
                      'slider' => [720, 340],
                  ],
              ],
              'errorHandler' => [
                  'errorAction' => 'site/error',
              ],
              'request'=>[
                  'cookieValidationKey' => 'j4iuot9u5894e7tu8reyh78g9y54sy7i',
                  'csrfParam' => '_backendCSRF',
                  'class' => 'common\components\Request',
                  'web'=> '/backend/web',
                  'adminUrl' => '/admin'
              ],
              'urlManager' => [
                  'baseUrl' => '/admin',
                  'enablePrettyUrl' => true,
                  'showScriptName' => false,
                  'rules' => [
                      'slider-image/<action>/<slider_id:[A-Za-z0-9_-]+>/<id:[A-Za-z0-9_-]+>' => 'slider-image/<action>',
                      'slider-image/<action>/<slider_id:[A-Za-z0-9_-]+>' => 'slider-image/<action>',
                      'rubrication/tax-group/<level:[0-9]+>' => 'rubrication/tax-group',
                      'rubrication/tax-group/<action>/<level:[0-9]+>/<id:[A-Za-z0-9_-]+>' => 'rubrication/tax-group/<action>',
                      'rubrication/tax-group/<action>/<level:[0-9]+>' => 'rubrication/tax-group/<action>',
                      'product/manage/<action>' => 'product/manage/<action>',
                      'product/<controller>/<action>/<product_id:[A-Za-z0-9_-]+>/<id:[A-Za-z0-9_-]+>' => 'product/<controller>/<action>',
                      'product/<controller>/<action>/<product_id:[A-Za-z0-9_-]+>/' => 'product/<controller>/<action>',
                      'seo-dynamic/<action>/<seo_category_id:[A-Za-z0-9_-]+>/<id:[A-Za-z0-9_-]+>' => 'seo-dynamic/<action>',
                      'seo-dynamic/<action>/<seo_category_id:[A-Za-z0-9_-]+>' => 'seo-dynamic/<action>',
                  ]
              ],
              'urlManagerFrontend'   => [
                  'baseUrl' => '/',
                  'enablePrettyUrl' => true,
                  'showScriptName'  => false,
                  'class'=>'common\modules\language\components\LanguageUrlManager',
                  'rules'           => [
                      '/' => 'site/index',
                      '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
                  ],
              ],
          
          ],
          'params' => $params,
      ];