feat(user): add user creation endpoint for superusers
- Add new `/userMgr/create` endpoint for superusers to create users with specified types - Update AddUser function to accept user type parameter - Add documentation for the new endpoint in api.md - Remove debug log comment in auth.go
This commit is contained in:
+52
-5
@@ -33,6 +33,7 @@ All API responses are returned in JSON format:
|
||||
**Endpoint:** `/register`
|
||||
**Method:** POST
|
||||
**Content-Type:** application/json
|
||||
**Permission Level:** None
|
||||
|
||||
**Request Headers:**
|
||||
```
|
||||
@@ -77,7 +78,8 @@ X-Timestamp: 1704067200000
|
||||
|
||||
**Endpoint:** `/login`
|
||||
**Method:** POST
|
||||
**Content-Type:** application/json
|
||||
**Content-Type:** application/json
|
||||
**Permission Level:** None
|
||||
|
||||
**Request Headers:**
|
||||
```
|
||||
@@ -122,6 +124,7 @@ X-Timestamp: 1704067200000
|
||||
**Endpoint:** `/logout`
|
||||
**Method:** GET
|
||||
**Auth Required:** Yes (token)
|
||||
**Permission Level:** None
|
||||
|
||||
**Request Headers:**
|
||||
```
|
||||
@@ -143,12 +146,51 @@ X-Timestamp: 1704067200000
|
||||
|
||||
---
|
||||
|
||||
## Create User
|
||||
|
||||
**Endpoint**: `/userMgr/create`
|
||||
**Method**: POST
|
||||
**Content-Type**: application/json
|
||||
**Auth Required**: Yes (token)
|
||||
**Permission Level**: Superuser
|
||||
|
||||
**Request Headers**:
|
||||
```
|
||||
X-Token: your_token
|
||||
X-Timestamp: 1704067200000
|
||||
```
|
||||
|
||||
**Request Body**:
|
||||
```json
|
||||
{
|
||||
"username": "new_user",
|
||||
"passwd": "NewPass123!",
|
||||
"type": "admin"
|
||||
}
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"message": "user created successfully",
|
||||
"data": {
|
||||
"userID": 2,
|
||||
"username": "new_user",
|
||||
"type": "admin"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Create frpc Instance
|
||||
|
||||
**Endpoint:** `/frpcAct/instanceMgr/create`
|
||||
**Method:** POST
|
||||
**Content-Type:** application/json
|
||||
**Auth Required:** Yes (token)
|
||||
**Auth Required:** Yes (token)
|
||||
**Permission Level:** Admin
|
||||
|
||||
**Request Headers:**
|
||||
```
|
||||
@@ -208,7 +250,8 @@ X-Timestamp: 1704067200000
|
||||
**Endpoint:** `/frpcAct/instanceMgr/delete`
|
||||
**Method:** POST
|
||||
**Content-Type:** application/json
|
||||
**Auth Required:** Yes (token)
|
||||
**Auth Required:** Yes (token)
|
||||
**Permission Level:** Admin
|
||||
|
||||
**Request Headers:**
|
||||
```
|
||||
@@ -241,7 +284,8 @@ X-Timestamp: 1704067200000
|
||||
**Endpoint:** `/frpcAct/instanceMgr/modify`
|
||||
**Method:** POST
|
||||
**Content-Type:** application/json
|
||||
**Auth Required:** Yes (token)
|
||||
**Auth Required:** Yes (token)
|
||||
**Permission Level:** Admin
|
||||
|
||||
Modify instance configuration. Supports two modification types: `configFile` (modify frpc config file) and `systemConfig` (modify system-level settings).
|
||||
|
||||
@@ -365,7 +409,10 @@ Modify system-level settings such as instance name, boot-at-start configuration,
|
||||
|
||||
**Endpoint:** `/frpcAct/instanceMgr/list`
|
||||
**Method:** GET
|
||||
**Auth Required:** Yes (token)
|
||||
**Auth Required:** Yes (token)
|
||||
**Permission Level:** Admin
|
||||
|
||||
Retrieve a list of all frpc instances.
|
||||
|
||||
**Request Headers:**
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user