Class AdminService
Server administration: accounts, passwords, admin rights and the room directory for the dashboard, and the same with suspension, locks, rooms and media for the remote admin API.
Assembly: Uniform.Matrix.Server.dll
public sealed class AdminService
Constructors
|
Edit this page
View Source
AdminService(IDbContextFactory<ServerDbContext>, AccountService, AccountDeactivation, RoomService, MediaService, ILogger<AdminService>)
Declaration
public AdminService(IDbContextFactory<ServerDbContext> contexts, AccountService accounts, AccountDeactivation deactivation, RoomService rooms, MediaService media, ILogger<AdminService> logger)
Parameters
Methods
|
Edit this page
View Source
Create the account when it does not exist, with Password, then apply the rest of change; return whether it was created.
Declaration
public Task<bool> CreateOrUpdateUserAsync(string userId, AdminUserChange change, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Create an account that logs in with password; return its user ID.
Declaration
public Task<string> CreateUserAsync(string localpart, string password, bool admin, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Deactivate an account the way its owner would: leave its rooms, clear its profile and end its sessions.
Declaration
public Task DeactivateAsync(string userId, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Delete local media; throw M_NOT_FOUND for media of other servers and unknown media.
Declaration
public Task DeleteMediaAsync(string serverName, string mediaId, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Return the local users joined to a room; throw M_NOT_FOUND for unknown rooms.
Declaration
public Task<IReadOnlyList<string>> GetRoomMembersAsync(string roomId, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Return every room, most members first.
Declaration
public Task<IReadOnlyList<AdminRoom>> GetRoomsAsync(CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Return one local account; throw M_NOT_FOUND when unknown.
Declaration
public Task<AdminUser> GetUserAsync(string userId, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Return the media uploaded by userId, newest first.
Declaration
public Task<IReadOnlyList<MediaRow>> GetUserMediaAsync(string userId, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Return every local account, by user ID.
Declaration
public Task<IReadOnlyList<AdminUser>> GetUsersAsync(CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Return whether the account is locked; throw M_NOT_FOUND when unknown.
Declaration
public Task<bool> IsLockedAsync(string userId, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Return whether local users are kept from joining a room; throw M_NOT_FOUND for unknown rooms.
Declaration
public Task<bool> IsRoomBlockedAsync(string roomId, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Return whether the account is suspended; throw M_NOT_FOUND when unknown.
Declaration
public Task<bool> IsSuspendedAsync(string userId, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Set a new password and log out every device of the user.
Declaration
public Task ResetPasswordAsync(string userId, string password, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Give or take server admin rights.
Declaration
public Task SetAdminAsync(string userId, bool admin, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Deactivate an account, logging out every device, or reactivates it.
Declaration
public Task SetDeactivatedAsync(string userId, bool deactivated, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Lock an account, so its sessions are refused with M_USER_LOCKED but kept for when it is unlocked; or unlock it.
Declaration
public Task SetLockedAsync(string userId, bool locked, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
List or unlists a room in the public room directory.
Declaration
public Task SetPublishedAsync(string roomId, bool published, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Block or unblock a room, so local users cannot or can join it.
Declaration
public Task SetRoomBlockedAsync(string roomId, bool blocked, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Suspend an account, so it can read and leave but not send, join, invite or upload; or end the suspension.
Declaration
public Task SetSuspendedAsync(string userId, bool suspended, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Shut a room down on this server: make every local member leave and forget it, take it out of the directory, delete its local aliases, and, with block, keep local users from joining it again.
Declaration
public Task<RoomShutdown> ShutdownRoomAsync(string roomId, bool block, string? message, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Return the devices of userId, with when and from where each was last used; throw M_NOT_FOUND when unknown.
Declaration
public Task<IReadOnlyList<AdminDevice>> WhoisAsync(string userId, CancellationToken cancellationToken)
Parameters
Returns