Class UserManager
The implementation for the User Manager.
Inheritance
Implements
Inherited Members
Namespace: Phoenix.Users
Assembly: Phoenix.Plugin.Users.dll
Syntax
public class UserManager : IUserManager
Constructors
View SourceUserManager(IPhoenixLogger, IEventAggregator, ISettingsManager)
Initializes a new instance of the UserManager class.
Declaration
public UserManager(IPhoenixLogger logger, IEventAggregator eventAggregator, ISettingsManager settingsManager)
Parameters
Type | Name | Description |
---|---|---|
IPhoenixLogger | logger | The logger. |
IEventAggregator | eventAggregator | The event aggregator. |
ISettingsManager | settingsManager | The settings manager. |
Properties
View SourceSettings
Gets the user management settings.
Declaration
public UserManagementSettings Settings { get; }
Property Value
Type | Description |
---|---|
UserManagementSettings |
Methods
View SourceAddUserAsync(String, IDevice)
Adds a user to a device.
Declaration
public async Task<PhoenixUser> AddUserAsync(string email, IDevice device)
Parameters
Type | Name | Description |
---|---|---|
System.String | The email associated with a user. |
|
IDevice | device | The device to add a user to. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PhoenixUser> | A System.Threading.Tasks.Task that returns the new PhoenixUser. |
AddUserAsync(String, String, IDevice)
Adds a user to a device and signs user in with provided password.
Declaration
public async Task<PhoenixUser> AddUserAsync(string email, string password, IDevice device)
Parameters
Type | Name | Description |
---|---|---|
System.String | The email associated with a user. |
|
System.String | password | The password to sign in the user. |
IDevice | device | The device to add a user to. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PhoenixUser> | A task which will return the new PhoenixUser. |
ClearDefaultSignedInUserAsync(IDevice)
Clears the default signed in user on specified device.
Declaration
public async Task ClearDefaultSignedInUserAsync(IDevice device)
Parameters
Type | Name | Description |
---|---|---|
IDevice | device | The device to clear the default signed in user. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | awaitable task |
GetDefaultSignedInUserEmailAsync(IDevice)
Gets the default signed in user email.
Declaration
public async Task<string> GetDefaultSignedInUserEmailAsync(IDevice device)
Parameters
Type | Name | Description |
---|---|---|
IDevice | device | The device to get the default signed in user from. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String> | The email. |
GetUserOfEmail(String, IDevice)
Gets a cached user based on email.
Declaration
public PhoenixUser GetUserOfEmail(string email, IDevice device)
Parameters
Type | Name | Description |
---|---|---|
System.String | The email associated with the user. |
|
IDevice | device | The device to look for the user in. |
Returns
Type | Description |
---|---|
PhoenixUser | The user. |
GetUsersAsync(IDevice)
Asynchronously gets a list of users from a device.
Declaration
public async Task<IEnumerable<PhoenixUser>> GetUsersAsync(IDevice device)
Parameters
Type | Name | Description |
---|---|---|
IDevice | device | The device to get users from. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<PhoenixUser>> | A list of users. |
Remarks
On first call users will be grabbed. Any further call will return the cached results. Call
GetUsersOfEmail(String)
Gets a list of a specific user across devices all cached devices.
Declaration
public IEnumerable<PhoenixUser> GetUsersOfEmail(string email)
Parameters
Type | Name | Description |
---|---|---|
System.String | The email associated with the user to search for. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<PhoenixUser> | List of the specified user per device the user was found in. |
Remarks
RefreshDeviceAsync(IDevice)
Asynchronously refreshes a device.
Declaration
public async Task RefreshDeviceAsync(IDevice device)
Parameters
Type | Name | Description |
---|---|---|
IDevice | device | The device to refresh. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | The task running. |
RefreshDevicesAsync()
Asynchronously refreshes all previously added devices.
Declaration
public async Task RefreshDevicesAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | The task running. |
RemoveAllUsersAsync(IDevice)
Removes all users from an existing device.
Declaration
public async Task RemoveAllUsersAsync(IDevice device)
Parameters
Type | Name | Description |
---|---|---|
IDevice | device | The device to remove all users from. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | The task executing the request. |
Remarks
The device must have been initially added.
RemoveUserAsync(PhoenixUser)
Removes a user from a device.
Declaration
public async Task<bool> RemoveUserAsync(PhoenixUser user)
Parameters
Type | Name | Description |
---|---|---|
PhoenixUser | user | The user to remove. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> | A task which will return true if the removal was successful, false otherwise. |
SignInAsync(PhoenixUser)
Signs the user in.
Declaration
public async Task<bool> SignInAsync(PhoenixUser user)
Parameters
Type | Name | Description |
---|---|---|
PhoenixUser | user | The user to sign in. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> | A task which will return true if the sign in was successful, false otherwise. |
SignOutAsync(PhoenixUser)
Signs the user out.
Declaration
public async Task<bool> SignOutAsync(PhoenixUser user)
Parameters
Type | Name | Description |
---|---|---|
PhoenixUser | user | The user to sign out. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> | True if sign out was successful, false otherwise. |