Skip to content

Commit 2214a7a

Browse files
committed
Revert "Merge branch 'codeigniter4:develop' into multilevel-permissions"
This reverts commit 8e47138, reversing changes made to cd5f021.
1 parent 8e47138 commit 2214a7a

File tree

7 files changed

+8
-35
lines changed

7 files changed

+8
-35
lines changed

.github/workflows/no-merge-commits.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ jobs:
1919
uses: actions/checkout@v4
2020

2121
- name: Run test
22-
uses: NexusPHP/no-merge-commits@v2.2.1
22+
uses: NexusPHP/no-merge-commits@v2.1.0
2323
with:
2424
token: ${{ secrets.GITHUB_TOKEN }}

docs/customization/user_provider.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,3 @@ class UserModel extends ShieldUserModel
5454
}
5555
}
5656
```
57-
58-
## Creating a Custom User Entity
59-
60-
Starting from v1.2.0, `UserModel` in Shield has the `createNewUser()` method to
61-
create a new User Entity.
62-
63-
```php
64-
$user = $userModel->createNewUser($data);
65-
```
66-
67-
It takes an optional user data array as the first argument, and passes it to the
68-
constructor of the `$returnType` class.
69-
70-
If your custom User entity cannot be instantiated in this way, override this method.

docs/references/authentication/hmac.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@ permissions the token grants to the user. Scopes are provided when the token is
119119
cannot be modified afterword.
120120

121121
```php
122-
$token = $user->generateHmacToken('Work Laptop', ['posts.manage', 'forums.manage']);
122+
$token = $user->gererateHmacToken('Work Laptop', ['posts.manage', 'forums.manage']);
123123
```
124124

125125
By default, a user is granted a wildcard scope which provides access to all scopes. This is the
126126
same as:
127127

128128
```php
129-
$token = $user->generateHmacToken('Work Laptop', ['*']);
129+
$token = $user->gererateHmacToken('Work Laptop', ['*']);
130130
```
131131

132132
During authentication, the HMAC Keys the user used is stored on the user. Once authenticated, you

docs/user_management/forcing_password_reset.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ if ($user->requiresPasswordReset()) {
3838

3939
!!! note
4040

41-
You can use the [force-reset](../references/controller_filters.md/#forcing-password-reset)
41+
You can use the [force-reset](../references/controller_filters/#forcing-password-reset)
4242
filter to check.
4343

4444
### Force Password Reset On a User

src/Collectors/Auth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function display(): string
8383

8484
$html = '<h3>Current User</h3>';
8585
$html .= '<table><tbody>';
86-
$html .= "<tr><td width=\"150\">User ID</td><td>#{$user->id}</td></tr>";
86+
$html .= "<tr><td style='width:150px;'>User ID</td><td>#{$user->id}</td></tr>";
8787
$html .= "<tr><td>Username</td><td>{$user->username}</td></tr>";
8888
$html .= "<tr><td>Email</td><td>{$user->email}</td></tr>";
8989
$html .= "<tr><td>Groups</td><td>{$groupsForUser}</td></tr>";

src/Controllers/RegisterController.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ public function registerAction(): RedirectResponse
103103

104104
// Save the user
105105
$allowedPostFields = array_keys($rules);
106-
$user = $users->createNewUser($this->request->getPost($allowedPostFields));
106+
$user = $this->getUserEntity();
107+
$user->fill($this->request->getPost($allowedPostFields));
107108

108109
// Workaround for email only registration/login
109110
if ($user->username === null) {
@@ -159,14 +160,10 @@ protected function getUserProvider(): UserModel
159160

160161
/**
161162
* Returns the Entity class that should be used
162-
*
163-
* @deprecated 1.2.0 No longer used.
164163
*/
165164
protected function getUserEntity(): User
166165
{
167-
$userProvider = $this->getUserProvider();
168-
169-
return $userProvider->createNewUser();
166+
return new User();
170167
}
171168

172169
/**

src/Models/UserModel.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -397,14 +397,4 @@ private function checkReturnType(): void
397397
throw new LogicException('Return type must be a subclass of ' . User::class);
398398
}
399399
}
400-
401-
/**
402-
* Returns a new User Entity.
403-
*
404-
* @param array<string, array<array-key, mixed>|bool|float|int|object|string|null> $data (Optional) user data
405-
*/
406-
public function createNewUser(array $data = []): User
407-
{
408-
return new $this->returnType($data);
409-
}
410400
}

0 commit comments

Comments
 (0)