Class UserManager
Default UserManager.
[Export(typeof(IUserManager))]
public class UserManager : PropertyChangedBase, INotifyPropertyChangedEx, INotifyPropertyChanged, IUserManager
- Inheritance
-
PropertyChangedBaseUserManager
- Implements
-
INotifyPropertyChangedEx
- Inherited Members
-
PropertyChangedBase.Refresh()PropertyChangedBase.IsNotifyingPropertyChangedBase.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
IUserFall-back user, normally without password and without IPermissions.
superUser
IUserUser with all IPermissions.
windowManager
IWindowManagerWindow manager for showing the login dialog.
Fields
DefaultUserKey
Gets the default user key.
public const string DefaultUserKey = "DefaultUser"
Field Value
SuperUserKey
Gets the super user key.
public const string SuperUserKey = "SuperUser"
Field Value
Properties
CurrentUser
Gets the current user.
public IUser CurrentUser { get; }
Property Value
DefaultUser
Gets the default user.
public IUser DefaultUser { get; }
Property Value
Remarks
This IUser has a minimum of permissions and no password.
Groups
Gets the IGroups.
public KeyItemCollection<IGroup> Groups { get; }
Property Value
PasswordRules
Gets all exported IStringRules.
public ICollection<IStringRule> PasswordRules { get; }
Property Value
Permissions
Gets all exported IPermissions.
public KeyItemCollection<IPermission> Permissions { get; }
Property Value
SuperUser
Gets the super user with all permissions.
public IUser SuperUser { get; }
Property Value
Remarks
This IUser has all permissions and a password.
Users
Gets the IUsers.
public KeyItemCollection<IUser> Users { get; }
Property Value
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
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 thekey
.
Events
UserChanged
Occurs when the current user has changed.
public event EventHandler<UserChangedEventArgs> UserChanged
Event Type
UserChanging
Occurs before a user change.
public event EventHandler<UserChangingEventArgs> UserChanging