You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/user_management/managing_users.md
+28-3Lines changed: 28 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,9 @@
2
2
3
3
Since Shield uses a more complex user setup than many other systems, separating [User Identities](../getting_started/concepts.md#user-identities) from the user accounts themselves. This quick overview should help you feel more confident when working with users on a day-to-day basis.
4
4
5
-
## Creating Users
5
+
## Managing Users by Code
6
+
7
+
### Creating Users
6
8
7
9
By default, the only values stored in the users table is the username. The first step is to create the user record with the username. If you don't have a username, be sure to set the value to `null` anyway, so that it passes CodeIgniter's empty data check.
A user's data can be spread over a few different tables so you might be concerned about how to delete all of the user's data from the system. This is handled automatically at the database level for all information that Shield knows about, through the `onCascade` settings of the table's foreign keys. You can delete a user like any other entity.
> The User rows use [soft deletes](https://codeigniter.com/user_guide/models/model.html#usesoftdeletes) so they are not actually deleted from the database unless the second parameter is `true`, like above.
42
44
43
-
## Editing a User
45
+
###Editing a User
44
46
45
47
The `UserModel::save()`, `update()` and `insert()` methods have been modified to ensure that an email or password previously set on the `User` entity will be automatically updated in the correct `UserIdentity` record.
46
48
@@ -56,3 +58,26 @@ $user->fill([
56
58
]);
57
59
$users->save($user);
58
60
```
61
+
62
+
## Managing Users via CLI
63
+
64
+
Shield has a CLI command to manage users. You can do the following actions:
65
+
66
+
```text
67
+
create: Create a new user
68
+
activate: Activate a user
69
+
deactivate: Deactivate a user
70
+
changename: Change user name
71
+
changeemail: Change user email
72
+
delete: Delete a user
73
+
password: Change a user password
74
+
list: List users
75
+
addgroup: Add a user to a group
76
+
removegroup: Remove a user from a group
77
+
```
78
+
79
+
You can get help on how to use it by running the following command in a terminal:
0 commit comments