mirror of
https://github.com/tinode/chat.git
synced 2026-05-07 20:12:42 +00:00
add support for Trusted to rest-auth
This commit is contained in:
@@ -120,8 +120,9 @@ add logical renaming and disable `rest` at the original name:
|
||||
// Default access mode
|
||||
"auth": "JRWPS",
|
||||
"anon": "N",
|
||||
"public": {...}, // user's public data, see /docs/API.md#public-and-private-fields
|
||||
"private": {...} // user's private data, see /docs/API.md#public-and-private-fields
|
||||
"public": {...}, // user's public data, see /docs/API.md#trusted-public-and-private-fields
|
||||
"trusted": {...}, // user's trusted data, see /docs/API.md#trusted-public-and-private-fields
|
||||
"private": {...} // user's private data, see /docs/API.md#trusted-public-and-private-fields
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -222,8 +223,9 @@ be used by client (Tinode) to create the account. The server may optionally retu
|
||||
"newacc": {
|
||||
"auth": "JRWPS",
|
||||
"anon": "N",
|
||||
"public": {/* see /docs/API.md#public-and-private-fields */},
|
||||
"private": {/* see /docs/API.md#public-and-private-fields */}
|
||||
"public": {/* see /docs/API.md#trusted-public-and-private-fields */},
|
||||
"trusted": {/* see /docs/API.md#trusted-public-and-private-fields */},
|
||||
"private": {/* see /docs/API.md#trusted-public-and-private-fields */}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -50,6 +50,8 @@ type newAccount struct {
|
||||
Anon string `json:"anon,omitempty"`
|
||||
// User's Public data
|
||||
Public interface{} `json:"public,omitempty"`
|
||||
// User's Trusted data
|
||||
Trusted interface{} `json:"trusted,omitempty"`
|
||||
// Per-subscription private data
|
||||
Private interface{} `json:"private,omitempty"`
|
||||
}
|
||||
@@ -206,9 +208,10 @@ func (a *authenticator) Authenticate(secret []byte, remoteAddr string) (*auth.Re
|
||||
// Create account, get UID, report UID back to the server.
|
||||
|
||||
user := types.User{
|
||||
State: resp.Record.State,
|
||||
Public: resp.NewAcc.Public,
|
||||
Tags: resp.Record.Tags,
|
||||
State: resp.Record.State,
|
||||
Public: resp.NewAcc.Public,
|
||||
Trusted: resp.NewAcc.Trusted,
|
||||
Tags: resp.Record.Tags,
|
||||
}
|
||||
user.Access.Auth.UnmarshalText([]byte(resp.NewAcc.Auth))
|
||||
user.Access.Anon.UnmarshalText([]byte(resp.NewAcc.Anon))
|
||||
|
||||
Reference in New Issue
Block a user