mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 06:12:45 +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
|
@ -47,8 +47,8 @@ func GetAdminWhois(
|
|||
req *http.Request, userAPI api.UserInternalAPI, device *api.Device,
|
||||
userID string,
|
||||
) util.JSONResponse {
|
||||
if userID != device.UserID {
|
||||
// TODO: Still allow if user is admin
|
||||
allowed := device.AccountType == api.AccountTypeAdmin || userID == device.UserID
|
||||
if !allowed {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusForbidden,
|
||||
JSON: jsonerror.Forbidden("userID does not match the current user"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue