Commit 98cb715d authored by Lakr Aream's avatar Lakr Aream 👼🏽

完成用户API设想

parent 0b8a4a6a
......@@ -29,6 +29,8 @@ app:
# changed it to 00000 to disable root sign after setup
accept: # accept connection from
- 0.0.0.0
use_development_ticket: true # if true
# accept any request
# Database Config For Backend Application
database:
......@@ -55,7 +57,7 @@ Time stamp should be time intercal since 1970 to now.
### Signing Request With Ticket
<details>
<summary>SHOW</summary>
<summary>Signing Details</summary>
For management usage like settin up application or add admin user will require root ticket signed request.
......@@ -131,10 +133,28 @@ echo $signStr;
</details>
### API Timeline
```
-> Request # Read request and apply filter
-> Vaildate Sign # Calculates sign and match
-> Check User Permission # Check if fromUser has the permission
-> Match User # Check if the ticket match the user
-> Process Request # Do operations
<- Check Return Status # Check operation returns
<- Preparing Callback # Preparing call back parmeters
<- Callback # Send callback
```
### API Record -- User Management
#### Action Summary
- Located At: users/c
- Actions: create, delete, modify.element, list, info
<details>
<summary>Create</summary>
<summary>Create User</summary>
- Requires: Root/Admin Ticket, Request Sign
- Location: ./users/c?
......@@ -142,7 +162,7 @@ echo $signStr;
- Parameters:
```
{
"action": "user.create", # action
"action": "create", # action
"from": "root", # user name
"name": "Lakr233", # any name with a-z A-Z 0-9
"password": "base64editems==", # password could be any
......@@ -151,7 +171,7 @@ echo $signStr;
}
```
- Examples:
> http://www.candiay.backend/users/c?action=user.create&from=root&name=Lakr233&password=base64editems==&role=admin&timestamp=1585910739
> http://www.candiay.backend/users/c?action=create&from=root&name=Lakr233&password=base64editems==&role=admin&timestamp=1585910739
- Call Back Example
```
{
......@@ -162,7 +182,7 @@ echo $signStr;
</details>
<details>
<summary>Delete</summary>
<summary>Delete User</summary>
- Requires: Root/Admin Ticket, Request Sign
- Location: ./users/c?
......@@ -170,14 +190,14 @@ echo $signStr;
- Parameters:
```
{
"action": "user.delete", # action
"action": "delete", # action
"from": "root", # user name
"name": "Lakr233", # any name with a-z A-Z 0-9
"timestamp": 1585910739 # timestamp since 1970
}
```
- Examples:
> http://www.candiay.backend/users/c?action=user.delete&from=root&name=Lakr233&timestamp=1585910739
> http://www.candiay.backend/users/c?action=delete&from=root&name=Lakr233&timestamp=1585910739
- Call Back Example
```
{
......@@ -195,14 +215,14 @@ echo $signStr;
- Parameters:
```
{
"action": "user.modify.name", # .name, .password
"action": "modify.name", # .name, .password
"from": "Lakr233", # user name
"meta": "QAQ", # change to
"timestamp": 1585910739 # timestamp since 1970
}
```
- Examples:
> http://www.candiay.backend/users/c?action=user.modify.name&from=Lakr233&meta=QAQ&timestamp=1585910739
> http://www.candiay.backend/users/c?action=modify.name&from=Lakr233&meta=QAQ&timestamp=1585910739
- Call Back Example
```
{
......@@ -212,7 +232,7 @@ echo $signStr;
</details>
<details>
<summary>List User Info</summary>
<summary>List All Users</summary>
- Requires: Root/Admin/Developer Ticket, Request Sign
- Location: ./users/c?
......@@ -220,13 +240,13 @@ echo $signStr;
- Parameters:
```
{
"action": "user.list", # action
"action": "list", # action
"from": "Lakr233", # user name
"timestamp": 1585910739 # timestamp since 1970
}
```
- Examples:
> http://www.candiay.backend/users/c?action=user.list&from=Lakr233&timestamp=1585910739
> http://www.candiay.backend/users/c?action=list&from=Lakr233&timestamp=1585910739
- Call Back Example
```
{
......@@ -245,14 +265,14 @@ echo $signStr;
- Parameters:
```
{
"action": "user.info", # action
"action": "info", # action
"from": "Lakr233", # user name
"to": "Lakr233", # user to be checked
"timestamp": 1585910739 # timestamp since 1970
}
```
- Examples:
> http://www.candiay.backend/users/c?action=user.list&from=Lakr233&to=Lakr233&timestamp=1585910739
> http://www.candiay.backend/users/c?action=info&from=Lakr233&to=Lakr233&timestamp=1585910739
- Call Back Example
```
{
......
# For Future Use
required:
- version: 0.0
- level: 0.0
# Application Config For Backend
app:
port: 3030
port: 3030 # listening at
root: "591F4FF9-D355-44E6-9817-1196F452BB30" # root signing ticket
# changed it to 00000 to disable root sign after setup
accept: # accept connection from
- 0.0.0.0
use_development_ticket: true # if true
# accept any request
# Database Config For Backend Application
database:
host: "db"
port: 3306
user: "root"
table: "Candiay"
pass: "6FAE553E-20AF-49FB-8C34-B76509CABA44"
\ No newline at end of file
host: "db" # database host name
port: 3306 # database port
user: "root" # database user name
table: "Candiay" # database table name
pass: "6FAE553E-20AF-49FB-8C34-B76509CABA44" # database password for your user
\ No newline at end of file
......@@ -15,7 +15,7 @@
},
"scripts": {
"build": "tsc",
"start": "tsc && node dist/main.js",
"start": "cp -f ./config/config.yml /etc/Candiay/coreBackend/config/config.yml && tsc && node dist/main.js",
"docker": "cd docker && ./start.sh"
},
"repository": {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment