mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 13:22:46 +00:00
Add account type (#2171)
* Add account_type for sqlite3 * Add account_type for postgres * Remove CreateGuestAccount from interface * Add new AccountTypes & update test * Use newly added AccountType for account creation * Add migrations * Reuse type * Add AccounnType to Device, so it can be verified on requests * Rename migration, add missing update for appservices * Rename sqlite3 migration * Add missing AccountType to return value * Update sqlite migration Change allowance check on /admin/whois * Fix migration, add IS NULL * Move accountType to completeRegistration * Fix migrations * Add passing test
This commit is contained in:
parent
e9b672a34e
commit
5a39512f5f
18 changed files with 230 additions and 117 deletions
|
@ -18,8 +18,9 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/matrix-org/dendrite/clientapi/auth/authtypes"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
|
||||
"github.com/matrix-org/dendrite/clientapi/auth/authtypes"
|
||||
)
|
||||
|
||||
// UserInternalAPI is the internal API for information about users and devices.
|
||||
|
@ -353,6 +354,7 @@ type Device struct {
|
|||
// If the device is for an appservice user,
|
||||
// this is the appservice ID.
|
||||
AppserviceID string
|
||||
AccountType AccountType
|
||||
}
|
||||
|
||||
// Account represents a Matrix account on this home server.
|
||||
|
@ -361,7 +363,7 @@ type Account struct {
|
|||
Localpart string
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
AppServiceID string
|
||||
// TODO: Other flags like IsAdmin, IsGuest
|
||||
AccountType AccountType
|
||||
// TODO: Associations (e.g. with application services)
|
||||
}
|
||||
|
||||
|
@ -417,4 +419,8 @@ const (
|
|||
AccountTypeUser AccountType = 1
|
||||
// AccountTypeGuest indicates this is a guest account
|
||||
AccountTypeGuest AccountType = 2
|
||||
// AccountTypeAdmin indicates this is an admin account
|
||||
AccountTypeAdmin AccountType = 3
|
||||
// AccountTypeAppService indicates this is an appservice account
|
||||
AccountTypeAppService AccountType = 4
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue