Commit 24a026f7 authored by Lakr Aream's avatar Lakr Aream 👼🏽

完成用户管理

parent 9a7aad96
......@@ -276,7 +276,7 @@ TABLE `Candiay`.`users` (
<details>
<summary>Get User Info</summary>
- Requires: Root/Admin/Developer/Userself Ticket, Request Sign
- Requires: Request Sign
- Location: ./users/c?
- Tips: none
- Parameters:
......@@ -296,8 +296,7 @@ TABLE `Candiay`.`users` (
"name": "Lakr233",
"role": "admin",
"icon": "https://www.candiay.backend/users/Lakr233/icon.png",
"debs": 12
...
"info": object
}
```
</details>
......
......@@ -258,6 +258,63 @@ export class RequestManager {
})
return
}
case "info": {
if (!vaildated) {
const resolveObject: { [key: string] : any } = {
"code": 401,
"context": "Invalid Signature"
}
contextContaienr = resolveObject
return
}
if (params["to"] === undefined) {
const ro: { [key: string] : any } = {
"code": 401,
"context": "Unauthorized user performing authorized operation"
}
contextContaienr = ro
return
}
UserManager.shared.getUserFromList(params["to"], (item) => {
if (item === undefined) {
const rr: { [key: string] : any } = {
"code": 401,
"context": "User not found"
}
contextContaienr = rr
return
}
const ret: { [key: string]: any } = {
"name": item.name,
"role": item.role,
"info": item.info
}
const ro: { [key: string] : any } = {
"code": 200,
"context": JSON.stringify(ret)
}
contextContaienr = ro
return
})
return
}
case "signtest": {
if (!vaildated) {
const resolveObject: { [key: string] : any } = {
"code": 401,
"context": "Invalid Signature"
}
contextContaienr = resolveObject
return
} else {
const resolveObject: { [key: string] : any } = {
"code": 200,
"context": "Signature Validated"
}
contextContaienr = resolveObject
return
}
}
default:{
if (!vaildated) {
const ro: { [key: string] : any } = {
......
......@@ -74,7 +74,7 @@ export class UserManager {
}
}
private getUserFromList(withName: string, callback: (user: User | undefined) => void) {
public getUserFromList(withName: string, callback: (user: User | undefined) => void) {
this.readUserList((users) => {
// Look for user
for (let index = 0; index < this.userListCache.length; index++) {
......
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