UniverUserManager
User Manager from Univer
public class UniverUserManager
Remarks
Handles user-related operations within the Univer app using JS Interop. Includes methods to get, list, add, delete, and set current users.
Constructor
public UniverUserManager(IUniverJsInterop service)
Parameters
Parameter | Type | Description |
---|---|---|
service | IUniverJsInterop | JS Interop service for Univer |
Methods
GetCurrentUser
public async Task<UniverUser> GetCurrentUser()
Returns the current user using the Univer App.
Returns
Task<UniverUser>: The current user object.
ListAllUsers
public async Task<List<UniverUser>> ListAllUsers()
Returns a list with all users in the Univer App.
Returns
Task< List<UniverUser> >: List of all users.
GetUser
public async Task<UniverUser> GetUser(string idUser)
Returns the user info in the manager.
Parameters
Parameter | Type | Description |
---|---|---|
idUser | string | User Id |
Returns
Task<UniverUser>: User object by ID.
AddUser (single user)
public void AddUser(UniverUser user, bool setCurrent = false)
Adds a user to the manager. Optionally sets as current.
Parameters
Parameter | Type | Description |
---|---|---|
user | UniverUser | New user to add |
setCurrent | bool | True if the new user should be set as current |
AddUser (multiple users)
public void AddUser(params UniverUser[] users)
Adds a list of users to the manager.
Parameters
Parameter | Type | Description |
---|---|---|
users | UniverUser[] | Users to add |
CleanList
public async void CleanList()
Clears the user list in the manager.
DeleteUser
public async void DeleteUser(string idUser)
Deletes a user from the manager by ID.
Parameters
Parameter | Type | Description |
---|---|---|
idUser | string | User Id in the list |
SetCurrentUser
public async void SetCurrentUser(UniverUser user)
Sets the current user for the component.
Parameters
Parameter | Type | Description |
---|---|---|
user | UniverUser | User object to set as current |