@@ -6,7 +6,7 @@ |
||
| 6 | 6 | * @var yii\web\View $this |
| 7 | 7 | * @var yii2mod\rbac\models\AuthItem $model |
| 8 | 8 | */ |
| 9 | -$this->title = 'Update BizRule: ' . $model->name; |
|
| 9 | +$this->title = 'Update BizRule: '.$model->name; |
|
| 10 | 10 | $this->params['breadcrumbs'][] = [ |
| 11 | 11 | 'label' => 'BizRules', |
| 12 | 12 | 'url' => ['index'] |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | ['class' => 'yii\grid\SerialColumn'], |
| 31 | 31 | 'name', |
| 32 | 32 | 'expression:ntext', |
| 33 | - ['class' => 'yii\grid\ActionColumn',], |
|
| 33 | + ['class' => 'yii\grid\ActionColumn', ], |
|
| 34 | 34 | ], |
| 35 | 35 | ]); |
| 36 | 36 | ?> |
@@ -93,7 +93,7 @@ |
||
| 93 | 93 | if ($this->load($params) && $this->validate() && (trim($this->name) !== '' || trim($this->description) !== '')) { |
| 94 | 94 | $search = strtolower(trim($this->name)); |
| 95 | 95 | $desc = strtolower(trim($this->description)); |
| 96 | - $items = array_filter($items, function ($item) use ($search, $desc) { |
|
| 96 | + $items = array_filter($items, function($item) use ($search, $desc) { |
|
| 97 | 97 | return (empty($search) || strpos(strtolower($item->name), $search) !== false) && (empty($desc) || strpos(strtolower($item->description), $desc) !== false); |
| 98 | 98 | }); |
| 99 | 99 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $this->_item = $item; |
| 63 | 63 | if ($item !== null) { |
| 64 | 64 | $this->name = $item->name; |
| 65 | - $this->type = (int)$item->type; |
|
| 65 | + $this->type = (int) $item->type; |
|
| 66 | 66 | $this->description = $item->description; |
| 67 | 67 | $this->ruleName = $item->ruleName; |
| 68 | 68 | $this->data = $item->data === null ? null : VarDumper::export($item->data); |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $this->_item->name = $this->name; |
| 181 | 181 | $this->_item->description = $this->description; |
| 182 | 182 | $this->_item->ruleName = $this->ruleName; |
| 183 | - $this->_item->data = $this->data === null || $this->data === '' ? null : @eval('return ' . $this->data . ';'); |
|
| 183 | + $this->_item->data = $this->data === null || $this->data === '' ? null : @eval('return '.$this->data.';'); |
|
| 184 | 184 | if ($isNew) { |
| 185 | 185 | $manager->add($this->_item); |
| 186 | 186 | } else { |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | { |
| 41 | 41 | $manager = \Yii::$app->getAuthManager(); |
| 42 | 42 | foreach ($routes as $route) { |
| 43 | - $manager->add($manager->createPermission('/' . trim($route, ' /'))); |
|
| 43 | + $manager->add($manager->createPermission('/'.trim($route, ' /'))); |
|
| 44 | 44 | } |
| 45 | 45 | return true; |
| 46 | 46 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | Yii::$app->session->setFlash('success', 'Permission has been saved.'); |
| 105 | 105 | return $this->redirect(['view', 'id' => $model->name]); |
| 106 | 106 | } else { |
| 107 | - return $this->render('create', ['model' => $model,]); |
|
| 107 | + return $this->render('create', ['model' => $model, ]); |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | Yii::$app->session->setFlash('success', 'Permission has been saved.'); |
| 124 | 124 | return $this->redirect(['view', 'id' => $model->name]); |
| 125 | 125 | } |
| 126 | - return $this->render('update', ['model' => $model,]); |
|
| 126 | + return $this->render('update', ['model' => $model, ]); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | $basePath = Yii::getAlias($this->configPath); |
| 44 | 44 | FileHelper::createDirectory($basePath); |
| 45 | - $this->authItemConfig = $basePath . DIRECTORY_SEPARATOR . $this->authItemConfig; |
|
| 46 | - $this->authItemChildConfig = $basePath . DIRECTORY_SEPARATOR . $this->authItemChildConfig; |
|
| 47 | - $this->authRuleConfig = $basePath . DIRECTORY_SEPARATOR . $this->authRuleConfig; |
|
| 45 | + $this->authItemConfig = $basePath.DIRECTORY_SEPARATOR.$this->authItemConfig; |
|
| 46 | + $this->authItemChildConfig = $basePath.DIRECTORY_SEPARATOR.$this->authItemChildConfig; |
|
| 47 | + $this->authRuleConfig = $basePath.DIRECTORY_SEPARATOR.$this->authRuleConfig; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | $out .= " [\n"; |
| 75 | 75 | foreach (array_values($item) as $value) { |
| 76 | 76 | if (is_string($value)) { |
| 77 | - $value = '\'' . str_replace('\'', '\\\'', str_replace('\\', '\\\\', $value)) . '\''; |
|
| 77 | + $value = '\''.str_replace('\'', '\\\'', str_replace('\\', '\\\\', $value)).'\''; |
|
| 78 | 78 | } elseif (is_int($value) || is_float($value)) { |
| 79 | - $value = (string)$value; |
|
| 79 | + $value = (string) $value; |
|
| 80 | 80 | } elseif (is_bool($value)) { |
| 81 | 81 | $value = $value ? 'true' : 'false'; |
| 82 | 82 | } elseif (is_null($value)) { |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | $assignmentTable = Yii::$app->authManager->assignmentTable; |
| 173 | 173 | $time = microtime(true); |
| 174 | 174 | Yii::$app->db->createCommand("DELETE FROM {$assignmentTable} WHERE user_id NOT IN (SELECT id FROM {$userTable})")->execute(); |
| 175 | - echo "Command finished (time: " . sprintf('%.3f', microtime(true) - $time) . "s)\n"; |
|
| 175 | + echo "Command finished (time: ".sprintf('%.3f', microtime(true) - $time)."s)\n"; |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /** |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | if (!Yii::$app->db->createCommand("SELECT COUNT(*) FROM \"{$assignmentTable}\" WHERE \"item_name\"='admin' AND \"user_id\"=1")->queryScalar()) { |
| 187 | 187 | Yii::$app->db->createCommand("INSERT INTO \"{$assignmentTable}\" (\"item_name\", \"user_id\") VALUES ('admin', '1');")->execute(); |
| 188 | 188 | } |
| 189 | - Yii::$app->db->createCommand('DELETE FROM ' . $assignmentTable . ' WHERE item_name IN (SELECT item_name FROM ' . $assignmentTable . ' aa LEFT JOIN ' . $authItemTable . ' ai ON aa.item_name = ai.name WHERE ai.name IS NULL)')->execute(); |
|
| 189 | + Yii::$app->db->createCommand('DELETE FROM '.$assignmentTable.' WHERE item_name IN (SELECT item_name FROM '.$assignmentTable.' aa LEFT JOIN '.$authItemTable.' ai ON aa.item_name = ai.name WHERE ai.name IS NULL)')->execute(); |
|
| 190 | 190 | } else { |
| 191 | 191 | Yii::$app->db->createCommand("INSERT IGNORE INTO {$assignmentTable} (`item_name`, `user_id`) VALUES ('admin', '1');")->execute(); |
| 192 | 192 | Yii::$app->db->createCommand("DELETE aa FROM {$assignmentTable} aa LEFT JOIN {$authItemTable} ai ON(aa.item_name = ai.name) WHERE ai.name IS NULL;")->execute(); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | Yii::$app->session->setFlash('success', 'Permission has been saved.'); |
| 105 | 105 | return $this->redirect(['view', 'id' => $model->name]); |
| 106 | 106 | } else { |
| 107 | - return $this->render('create', ['model' => $model,]); |
|
| 107 | + return $this->render('create', ['model' => $model, ]); |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | Yii::$app->session->setFlash('success', 'Permission has been saved.'); |
| 124 | 124 | return $this->redirect(['view', 'id' => $model->name]); |
| 125 | 125 | } |
| 126 | - return $this->render('update', ['model' => $model,]); |
|
| 126 | + return $this->render('update', ['model' => $model, ]); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | Yii::$app->session->setFlash('success', 'Permission has been saved.'); |
| 105 | 105 | return $this->redirect(['view', 'id' => $model->name]); |
| 106 | 106 | } else { |
| 107 | - return $this->render('create', ['model' => $model,]); |
|
| 107 | + return $this->render('create', ['model' => $model, ]); |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | Yii::$app->session->setFlash('success', 'Permission has been saved.'); |
| 124 | 124 | return $this->redirect(['view', 'id' => $model->name]); |
| 125 | 125 | } |
| 126 | - return $this->render('update', ['model' => $model,]); |
|
| 126 | + return $this->render('update', ['model' => $model, ]); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |