Fixed administrator user creation when Flex Users is enabled

This commit is contained in:
Matias Griese
2019-10-11 10:50:40 +03:00
parent 34a2a624c2
commit a26b313b49
2 changed files with 7 additions and 1 deletions

View File

@@ -1,3 +1,9 @@
# v1.10.0-rc.1
## mm/dd/2019
1. [](#bugfix)
* Fixed administrator user creation when `Flex Users` is enabled
# v1.10.0-beta.10 # v1.10.0-beta.10
## 10/03/2019 ## 10/03/2019

View File

@@ -326,7 +326,6 @@ class AdminPlugin extends Plugin
$data['fullname'] = $data['fullname'] ?? $inflector->titleize($username); $data['fullname'] = $data['fullname'] ?? $inflector->titleize($username);
$data['title'] = $data['title'] ?? 'Administrator'; $data['title'] = $data['title'] ?? 'Administrator';
$data['state'] = 'enabled'; $data['state'] = 'enabled';
$data['access'] = ['admin' => ['login' => true, 'super' => true], 'site' => ['login' => true]];
/** @var UserCollectionInterface $users */ /** @var UserCollectionInterface $users */
$users = $this->grav['accounts']; $users = $this->grav['accounts'];
@@ -334,6 +333,7 @@ class AdminPlugin extends Plugin
// Create user object and save it // Create user object and save it
$user = $users->load($username); $user = $users->load($username);
$user->update($data); $user->update($data);
$user->set('access', ['admin' => ['login' => true, 'super' => true], 'site' => ['login' => true]]);
$user->save(); $user->save();
//Login user //Login user