@@ -7,17 +7,17 @@ |
||
7 | 7 | { |
8 | 8 | public function safeUp() |
9 | 9 | { |
10 | - $this->createTable(UserInvite::tableName(), [ |
|
11 | - 'token'=>'varchar(255) CHARACTER SET latin1 COLLATE latin1_general_cs PRIMARY KEY COMMENT "The token"', |
|
12 | - 'user_id'=> $this->uuid64( 'foreign key of the user who owns this token')->notNull(), |
|
13 | - // timestamps |
|
14 | - 'expires_at' => $this->dateTime(), |
|
15 | - 'created_at' => $this->createdAt(), |
|
16 | - 'updated_at' => $this->updatedAt(), |
|
17 | - // blames |
|
18 | - 'created_by' => $this->createdBy(), |
|
19 | - 'updated_by' => $this->updatedBy() |
|
20 | - ]); |
|
10 | + $this->createTable(UserInvite::tableName(), [ |
|
11 | + 'token'=>'varchar(255) CHARACTER SET latin1 COLLATE latin1_general_cs PRIMARY KEY COMMENT "The token"', |
|
12 | + 'user_id'=> $this->uuid64( 'foreign key of the user who owns this token')->notNull(), |
|
13 | + // timestamps |
|
14 | + 'expires_at' => $this->dateTime(), |
|
15 | + 'created_at' => $this->createdAt(), |
|
16 | + 'updated_at' => $this->updatedAt(), |
|
17 | + // blames |
|
18 | + 'created_by' => $this->createdBy(), |
|
19 | + 'updated_by' => $this->updatedBy() |
|
20 | + ]); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | public function safeDown() |
@@ -9,7 +9,7 @@ |
||
9 | 9 | { |
10 | 10 | $this->createTable(UserInvite::tableName(), [ |
11 | 11 | 'token'=>'varchar(255) CHARACTER SET latin1 COLLATE latin1_general_cs PRIMARY KEY COMMENT "The token"', |
12 | - 'user_id'=> $this->uuid64( 'foreign key of the user who owns this token')->notNull(), |
|
12 | + 'user_id'=> $this->uuid64('foreign key of the user who owns this token')->notNull(), |
|
13 | 13 | // timestamps |
14 | 14 | 'expires_at' => $this->dateTime(), |
15 | 15 | 'created_at' => $this->createdAt(), |
@@ -71,22 +71,22 @@ |
||
71 | 71 | 'created_at' => $this->integer(), |
72 | 72 | 'updated_at' => $this->integer(), |
73 | 73 | 'PRIMARY KEY (name)', |
74 | - 'FOREIGN KEY (rule_name) REFERENCES ' . neon()->authManager->ruleTable . ' (name) ON DELETE SET NULL ON UPDATE CASCADE' |
|
74 | + 'FOREIGN KEY (rule_name) REFERENCES '.neon()->authManager->ruleTable.' (name) ON DELETE SET NULL ON UPDATE CASCADE' |
|
75 | 75 | ]); |
76 | 76 | $this->createIndex('idx-auth_item-type', AuthItem::tableName(), 'type'); |
77 | 77 | $this->createTable(AuthItemChild::tableName(), [ |
78 | 78 | 'parent' => $this->string(64)->notNull(), |
79 | 79 | 'child' => $this->string(64)->notNull(), |
80 | 80 | 'PRIMARY KEY (parent, child)', |
81 | - 'FOREIGN KEY (parent) REFERENCES ' . neon()->authManager->itemTable . ' (name) ON DELETE CASCADE ON UPDATE CASCADE', |
|
82 | - 'FOREIGN KEY (child) REFERENCES ' . neon()->authManager->itemTable . ' (name) ON DELETE CASCADE ON UPDATE CASCADE' |
|
81 | + 'FOREIGN KEY (parent) REFERENCES '.neon()->authManager->itemTable.' (name) ON DELETE CASCADE ON UPDATE CASCADE', |
|
82 | + 'FOREIGN KEY (child) REFERENCES '.neon()->authManager->itemTable.' (name) ON DELETE CASCADE ON UPDATE CASCADE' |
|
83 | 83 | ]); |
84 | 84 | $this->createTable(AuthAssignment::tableName(), [ |
85 | 85 | 'item_name' => $this->string(64)->notNull(), |
86 | 86 | 'user_id' => $this->string(64)->notNull(), |
87 | 87 | 'created_at' => $this->integer(), |
88 | 88 | 'PRIMARY KEY (item_name, user_id)', |
89 | - 'FOREIGN KEY (item_name) REFERENCES ' . neon()->authManager->itemTable . ' (name) ON DELETE CASCADE ON UPDATE CASCADE', |
|
89 | + 'FOREIGN KEY (item_name) REFERENCES '.neon()->authManager->itemTable.' (name) ON DELETE CASCADE ON UPDATE CASCADE', |
|
90 | 90 | ]); |
91 | 91 | $this->createTable(Session::tableName(), [ |
92 | 92 | 'id' => 'CHAR(64) NOT NULL PRIMARY KEY', |
@@ -25,7 +25,7 @@ |
||
25 | 25 | public function safeDown() |
26 | 26 | { |
27 | 27 | $auth = neon()->authManager; |
28 | - $auth->removeAll(); |
|
28 | + $auth->removeAll(); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | } |
32 | 32 | \ No newline at end of file |
@@ -17,8 +17,9 @@ |
||
17 | 17 | $this->addColumn(User::tableName(), 'uuid', 'char(22) AFTER `id`'); |
18 | 18 | // fetch 50 users at a time and iterate them one by one |
19 | 19 | // save call will automatically create the uuid if it currently does not exist |
20 | - foreach (User::find()->each(50) as $user) |
|
21 | - $user->save(false, [User::UUID]); |
|
20 | + foreach (User::find()->each(50) as $user) { |
|
21 | + $user->save(false, [User::UUID]); |
|
22 | + } |
|
22 | 23 | // create a unique index |
23 | 24 | $this->createIndex('uuid', User::tableName(), 'uuid', true); |
24 | 25 | } |
@@ -5,23 +5,23 @@ |
||
5 | 5 | class m161211_160816_user_correct_current_field extends Migration |
6 | 6 | { |
7 | 7 | |
8 | - public function safeUp() |
|
9 | - { |
|
8 | + public function safeUp() |
|
9 | + { |
|
10 | 10 | /** |
11 | 11 | * fix an incorrect definition of current in the code and make the name more meaningful |
12 | 12 | */ |
13 | 13 | $table = \neon\user\models\Session::tableName(); |
14 | 14 | $this->dropColumn($table, 'current'); |
15 | 15 | $this->addColumn($table, 'current_url', $this->string(1000)->comment('The current url the user requested in this session')); |
16 | - } |
|
16 | + } |
|
17 | 17 | |
18 | - public function safeDown() |
|
19 | - { |
|
18 | + public function safeDown() |
|
19 | + { |
|
20 | 20 | /** |
21 | 21 | * revert back to the broken definition |
22 | 22 | */ |
23 | 23 | $table = \neon\user\models\Session::tableName(); |
24 | 24 | $this->dropColumn($table, 'current_url'); |
25 | 25 | $this->addColumn($table, 'current', $this->dateTime()->comment('The current url the user requested in this session')); |
26 | - } |
|
26 | + } |
|
27 | 27 | } |
@@ -5,17 +5,17 @@ |
||
5 | 5 | class m170104_161200_use_baseclass_timestamps extends Migration |
6 | 6 | { |
7 | 7 | |
8 | - public function safeUp() |
|
9 | - { |
|
8 | + public function safeUp() |
|
9 | + { |
|
10 | 10 | $table = \neon\user\models\User::tableName(); |
11 | 11 | $this->renameColumn($table, 'created_on', 'created_at'); |
12 | 12 | $this->renameColumn($table, 'updated_on', 'updated_at'); |
13 | - } |
|
13 | + } |
|
14 | 14 | |
15 | - public function safeDown() |
|
16 | - { |
|
15 | + public function safeDown() |
|
16 | + { |
|
17 | 17 | $table = \neon\user\models\User::tableName(); |
18 | 18 | $this->renameColumn($table, 'created_at', 'created_on'); |
19 | 19 | $this->renameColumn($table, 'updated_at', 'updated_on'); |
20 | - } |
|
20 | + } |
|
21 | 21 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | /** |
126 | 126 | * @inheritdoc |
127 | 127 | */ |
128 | - public function getDataMap($key, $query='', $filters=[], $fields=[], $start=0, $length=100) |
|
128 | + public function getDataMap($key, $query = '', $filters = [], $fields = [], $start = 0, $length = 100) |
|
129 | 129 | { |
130 | 130 | if ($key === 'users') { |
131 | 131 | return User::getUserList($query, $filters, $fields, $start, $length); |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @param array &$roles the roles that matched |
277 | 277 | * @return boolean whether it matched any roles |
278 | 278 | */ |
279 | - public function routeHasRoles($route, &$roles=null) |
|
279 | + public function routeHasRoles($route, &$roles = null) |
|
280 | 280 | { |
281 | 281 | $roles = []; |
282 | 282 | foreach ($this->_routes as $r) { |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | } |
286 | 286 | } |
287 | 287 | // allow guest access if this is the only allowed role |
288 | - if (count($roles)==1 && isset($roles['?'])) |
|
288 | + if (count($roles) == 1 && isset($roles['?'])) |
|
289 | 289 | return false; |
290 | 290 | // otherwise restrict to requiring a role if one matched |
291 | 291 | return (count($roles) > 0); |
@@ -144,8 +144,9 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function getMapResults($requestKey) |
146 | 146 | { |
147 | - if (!isset($this->_mapRequestKey[$requestKey])) |
|
148 | - throw new \InvalidArgumentException('The provided request key "'.$requestKey.'" does not exist'); |
|
147 | + if (!isset($this->_mapRequestKey[$requestKey])) { |
|
148 | + throw new \InvalidArgumentException('The provided request key "'.$requestKey.'" does not exist'); |
|
149 | + } |
|
149 | 150 | list($key, $ids, $fields) = $this->_mapRequestKey[$requestKey]; |
150 | 151 | if ($key === 'users') { |
151 | 152 | return User::getUserList('', ['uuid' => $ids]); |
@@ -255,15 +256,17 @@ discard block |
||
255 | 256 | public function setRoles(array $roles) |
256 | 257 | { |
257 | 258 | foreach ($roles as $role => $details) { |
258 | - if (!array_key_exists($role, $this->_roles)) |
|
259 | - $this->_roles[$role] = ['routes'=>[]]; |
|
259 | + if (!array_key_exists($role, $this->_roles)) { |
|
260 | + $this->_roles[$role] = ['routes'=>[]]; |
|
261 | + } |
|
260 | 262 | if (array_key_exists('routes', $details)) { |
261 | 263 | foreach ($details['routes'] as $r) { |
262 | 264 | $this->_roles[$role]['routes'][$r] = $r; |
263 | 265 | $this->_routes2Roles[$r][$role] = $role; |
264 | 266 | } |
265 | - if (array_key_exists('homeUrl', $details)) |
|
266 | - $this->_roles[$role]['homeUrl'] = $details['homeUrl']; |
|
267 | + if (array_key_exists('homeUrl', $details)) { |
|
268 | + $this->_roles[$role]['homeUrl'] = $details['homeUrl']; |
|
269 | + } |
|
267 | 270 | $this->_roles[$role]['label'] = (array_key_exists('label', $details) ? $details['label'] : $role); |
268 | 271 | } |
269 | 272 | } |
@@ -285,8 +288,9 @@ discard block |
||
285 | 288 | } |
286 | 289 | } |
287 | 290 | // allow guest access if this is the only allowed role |
288 | - if (count($roles)==1 && isset($roles['?'])) |
|
289 | - return false; |
|
291 | + if (count($roles)==1 && isset($roles['?'])) { |
|
292 | + return false; |
|
293 | + } |
|
290 | 294 | // otherwise restrict to requiring a role if one matched |
291 | 295 | return (count($roles) > 0); |
292 | 296 | } |
@@ -32,8 +32,9 @@ |
||
32 | 32 | $menu = $app->getMenu(); |
33 | 33 | if ($menu !== null) { |
34 | 34 | if (is_int(key($menu))) { |
35 | - foreach ($menu as $menuItem) |
|
36 | - $this->add('admin', $menuItem); |
|
35 | + foreach ($menu as $menuItem) { |
|
36 | + $this->add('admin', $menuItem); |
|
37 | + } |
|
37 | 38 | } else { |
38 | 39 | $this->add('admin', $app->getMenu()); |
39 | 40 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | ['class'=>'email'], |
32 | 32 | ['class'=>'required'] |
33 | 33 | ], |
34 | - 'placeholder' => 'e.g. robot@' . strtolower(setting('core', 'site_name', neon()->name)) . '.com' |
|
34 | + 'placeholder' => 'e.g. robot@'.strtolower(setting('core', 'site_name', neon()->name)).'.com' |
|
35 | 35 | ], |
36 | 36 | 'fromEmailName' => [ |
37 | 37 | 'name' => 'fromEmailName', |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | 'name' => 'sslOnly', |
44 | 44 | 'class' => '\neon\core\form\fields\SwitchButton', |
45 | 45 | 'label' => 'Force SSL (https) everywhere', |
46 | - 'hint' => 'The application will redirect all requests to secure https requests. ' . |
|
46 | + 'hint' => 'The application will redirect all requests to secure https requests. '. |
|
47 | 47 | (neon()->isDevMode() ? 'Note: You are currently in dev mode so the redirects to https will not happen' : '') |
48 | 48 | ], |
49 | 49 | ]; |