Skip to main content

IUserManager

Interface for user authentication and management.

Namespace: ControlBee.Interfaces

Properties

NameTypeDescription
CurrentUserIUserInfo?The currently logged-in user, or null.

Methods

Register

Registers a new user.

bool Register(string userId, string rawPassword, string name, int level = 0);

Parameters:

  • userId — The login ID.
  • rawPassword — The plain-text password.
  • name — The display name.
  • level — The access level. Default is 0.

Returns: true if registration succeeded.

Login

Authenticates a user.

bool Login(string userId, string userPassword);

Returns: true if login succeeded.

Logout

Logs out the current user.

void Logout();

Delete

Deletes a user by database ID.

bool Delete(int id);

Returns: true if deletion succeeded.

GetUserBelowCurrentLevel

Returns users with access levels below the current user.

List<IUserInfo> GetUserBelowCurrentLevel();

UpdateUsers

Batch updates user information.

bool UpdateUsers(IEnumerable<Dictionary<string, object?>> userUpdates);

Returns: true if all updates succeeded.

Events

CurrentUserChanged

Raised when the current user changes.

event EventHandler? CurrentUserChanged;

UserListUpdated

Raised when the user list is modified.

event EventHandler? UserListUpdated;

See Also