Skip to content

Commit 540cc9c

Browse files
authored
Add User Management Guide for UltimateAuth client
This document provides a comprehensive guide on user management using the UltimateAuth client, covering user operations, profile management, lifecycle, and admin functionalities.
1 parent d37bf77 commit 540cc9c

File tree

1 file changed

+175
-0
lines changed

1 file changed

+175
-0
lines changed
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# 👤 User Management Guide
2+
3+
This section explains how to manage users using the UltimateAuth client.
4+
5+
## 🧠 Overview
6+
7+
User operations are handled via:
8+
9+
```csharp
10+
UAuthClient.Users...
11+
```
12+
13+
This includes:
14+
15+
- Profile management
16+
- User lifecycle
17+
- Admin operations
18+
19+
<br>
20+
21+
## 🙋 Get Current User
22+
23+
```csharp
24+
var me = await UAuthClient.Users.GetMeAsync();
25+
```
26+
27+
👉 Returns:
28+
29+
- User profile
30+
- Status
31+
- Basic identity data
32+
33+
<br>
34+
35+
## ✏️ Update Profile
36+
37+
```csharp
38+
await UAuthClient.Users.UpdateMeAsync(new UpdateProfileRequest
39+
{
40+
DisplayName = "John Doe"
41+
});
42+
```
43+
44+
👉 Triggers:
45+
46+
- Profile update
47+
- State event (ProfileChanged)
48+
49+
<br>
50+
51+
## ❌ Delete Current User
52+
53+
```csharp
54+
await UAuthClient.Users.DeleteMeAsync();
55+
```
56+
57+
👉 This:
58+
59+
- Deletes user (based on configured mode)
60+
- Ends session
61+
- Triggers state update
62+
63+
<br>
64+
65+
## 👑 Admin: Query Users
66+
67+
```csharp
68+
var result = await UAuthClient.Users.QueryAsync(new UserQuery
69+
{
70+
Search = "john",
71+
PageNumber = 1,
72+
PageSize = 10
73+
});
74+
```
75+
76+
👉 Supports:
77+
78+
- search
79+
- pagination
80+
- filtering (status, etc.)
81+
82+
<br>
83+
84+
## ➕ Create User
85+
86+
```csharp
87+
await UAuthClient.Users.CreateAsync(new CreateUserRequest
88+
{
89+
UserName = "john",
90+
Email = "john@mail.com",
91+
Password = "123456"
92+
});
93+
```
94+
95+
## 🛠 Admin Create
96+
97+
```csharp
98+
await UAuthClient.Users.CreateAsAdminAsync(request);
99+
```
100+
101+
<br>
102+
103+
## 🔄 Change Status
104+
105+
### Self
106+
107+
```csharp
108+
await UAuthClient.Users.ChangeMyStatusAsync(new ChangeUserStatusSelfRequest
109+
{
110+
Status = UserStatus.SelfSuspended
111+
});
112+
```
113+
114+
### Admin
115+
116+
```csharp
117+
await UAuthClient.Users.ChangeUserStatusAsync(userKey, new ChangeUserStatusAdminRequest
118+
{
119+
Status = UserStatus.Suspended
120+
});
121+
```
122+
123+
<br>
124+
125+
## ❌ Delete User (Admin)
126+
127+
```csharp
128+
await UAuthClient.Users.DeleteUserAsync(userKey, new DeleteUserRequest
129+
{
130+
Mode = DeleteMode.Soft
131+
});
132+
```
133+
134+
## 🔍 Get User
135+
136+
```csharp
137+
var user = await UAuthClient.Users.GetUserAsync(userKey);
138+
```
139+
140+
## ✏️ Update User (Admin)
141+
142+
```csharp
143+
await UAuthClient.Users.UpdateUserAsync(userKey, request);
144+
```
145+
146+
## 🧠 Lifecycle Model
147+
148+
Users have a lifecycle:
149+
150+
- Active
151+
- Suspended
152+
- Disabled
153+
- Deleted (soft/hard)
154+
155+
👉 Status impacts:
156+
157+
- login ability
158+
- session validity
159+
- authorization
160+
161+
<br>
162+
163+
## 🔐 Security Notes
164+
165+
- Status changes may invalidate sessions
166+
- Delete may trigger cleanup across domains
167+
- Admin actions are policy-protected
168+
169+
## 🎯 Summary
170+
171+
User management in UltimateAuth:
172+
173+
- is lifecycle-aware
174+
- supports self + admin flows
175+
- integrates with session & security model

0 commit comments

Comments
 (0)