Table of Contents

Class UserManager

Namespace
Loehnert.Lisrt.Users
Assembly
Loehnert.Lisrt.dll

Default UserManager.

[Export(typeof(IUserManager))]
public class UserManager : PropertyChangedBase, INotifyPropertyChangedEx, INotifyPropertyChanged, IUserManager
Inheritance
PropertyChangedBase
UserManager
Implements
INotifyPropertyChangedEx
Inherited Members
PropertyChangedBase.Refresh()
PropertyChangedBase.IsNotifying
PropertyChangedBase.PropertyChanged

Remarks

[Export(typeof(IUserManager))]
a new IUserManager to change the default UserManager.

The export must come from executing assembly, because of assembly priority. Alternatively, you can change the Bootstrapper.

Constructors

UserManager(IEnumerable<IPermission>, IEnumerable<IStringRule>, IUser, IUser, IWindowManager)

Initializes a new instance of the UserManager class.

[ImportingConstructor]
public UserManager(IEnumerable<IPermission> permissions, IEnumerable<IStringRule> passwordRules, IUser defaultUser, IUser superUser, IWindowManager windowManager)

Parameters

permissions IEnumerable<IPermission>

All available IPermissions.

passwordRules IEnumerable<IStringRule>

Rules for setting a password.

defaultUser IUser

Fall-back user, normally without password and without IPermissions.

superUser IUser

User with all IPermissions.

windowManager IWindowManager

Window manager for showing the login dialog.

Fields

DefaultUserKey

Gets the default user key.

public const string DefaultUserKey = "DefaultUser"

Field Value

string

SuperUserKey

Gets the super user key.

public const string SuperUserKey = "SuperUser"

Field Value

string

Properties

CurrentUser

Gets the current user.

public IUser CurrentUser { get; }

Property Value

IUser

DefaultUser

Gets the default user.

public IUser DefaultUser { get; }

Property Value

IUser

Remarks

This IUser has a minimum of permissions and no password.

Groups

Gets the IGroups.

public KeyItemCollection<IGroup> Groups { get; }

Property Value

KeyItemCollection<IGroup>

PasswordRules

Gets all exported IStringRules.

public ICollection<IStringRule> PasswordRules { get; }

Property Value

ICollection<IStringRule>

Permissions

Gets all exported IPermissions.

public KeyItemCollection<IPermission> Permissions { get; }

Property Value

KeyItemCollection<IPermission>

SuperUser

Gets the super user with all permissions.

public IUser SuperUser { get; }

Property Value

IUser

Remarks

This IUser has all permissions and a password.

Users

Gets the IUsers.

public KeyItemCollection<IUser> Users { get; }

Property Value

KeyItemCollection<IUser>

Methods

Login()

Logs in with dialog.

public void Login()

Remarks

Opens the LoginWindowView and executes Login(string, string). ILogger logging but no message in the shell.

Login(string, string)

Logs user to CurrentUser in.

public void Login(string key, string password)

Parameters

key string

Key of a exported IUser.

password string

Password for this IUser.

Remarks

ILogger logging but no message in the shell.

Exceptions

ArgumentNullException

Thrown when key is null, empty or whitespace.

ArgumentNullException

Thrown when password is null.

KeyNotFoundException

Thrown when a user doesn't exist.

AuthenticationException

Throw when password doesn't matches the key.

Events

UserChanged

Occurs when the current user has changed.

public event EventHandler<UserChangedEventArgs> UserChanged

Event Type

EventHandler<UserChangedEventArgs>

UserChanging

Occurs before a user change.

public event EventHandler<UserChangingEventArgs> UserChanging

Event Type

EventHandler<UserChangingEventArgs>