Show / Hide Table of Contents

Class User

A model of a user as it exists in the database.

Inheritance
System.Object
User
Implements
System.IEquatable<User>
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: BuzzLockGui.Backend
Assembly: BuzzLockGui.dll
Syntax
public class User : IEquatable<User>

Constructors

User(Int64)

Creates a model for a user with the given ID in the database.

Declaration
public User(long id)
Parameters
Type Name Description
System.Int64 id

The database ID for this user.

Fields

Id

The unique ID of this user in the database.

Declaration
public readonly long Id
Field Value
Type Description
System.Int64

Properties

AuthenticationMethods

The devices or passcodes this user uses to authenticate. Contains exactly two AuthenticationMethods of different types. Cannot be null.

Declaration
public AuthenticationMethods AuthenticationMethods { get; set; }
Property Value
Type Description
AuthenticationMethods

Name

The name of the user. Cannot be null.

Declaration
public string Name { get; set; }
Property Value
Type Description
System.String

PermissionLevel

The level of access of this user.

Declaration
public User.PermissionLevels PermissionLevel { get; set; }
Property Value
Type Description
User.PermissionLevels

PhoneNumber

The phone number of the user. Cannot be null.

Declaration
public string PhoneNumber { get; set; }
Property Value
Type Description
System.String

Photo

The user's photo as a binary blob in an implementation-defined format.

Declaration
public byte[] Photo { get; set; }
Property Value
Type Description
System.Byte[]
Remarks

Each access to this field returns a new byte[] with the latest information from the database. Mutating this byte[] has no impact on the user's photo in the database; the photo is only updated on an assignment to this field.

Methods

Create(String, User.PermissionLevels, String, Byte[], AuthenticationMethods)

Creates a new user in the database with the given details.

Declaration
public static User Create(string name, User.PermissionLevels permissionLevel, string phoneNumber, byte[] photo, AuthenticationMethods authenticationMethods)
Parameters
Type Name Description
System.String name

The name of the user. Cannot be null.

User.PermissionLevels permissionLevel

The level of access of this user.

System.String phoneNumber

The phone number of the user. Cannot be null.

System.Byte[] photo

The user's photo as a binary blob in an implementation-defined format.

AuthenticationMethods authenticationMethods

The devices or passcodes this user uses to authenticate. Must contain exactly two AuthenticationMethods of different types. Cannot be null.

Returns
Type Description
User

The newly created user.

Delete()

Deletes the user from the database. Continuing to use this User object after a call to this method will result in undefined behavior.

Declaration
public void Delete()

Equals(User)

Declaration
public bool Equals(User other)
Parameters
Type Name Description
User other
Returns
Type Description
System.Boolean

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean
Overrides
System.Object.Equals(System.Object)

GetAll()

Gets all existing users from the database.

Declaration
public static List<User> GetAll()
Returns
Type Description
System.Collections.Generic.List<User>

A System.Collections.Generic.List<T> of all Users.

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
Overrides
System.Object.GetHashCode()

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.Object.ToString()

Operators

Equality(User, User)

Declaration
public static bool operator ==(User a, User b)
Parameters
Type Name Description
User a
User b
Returns
Type Description
System.Boolean

Inequality(User, User)

Declaration
public static bool operator !=(User a, User b)
Parameters
Type Name Description
User a
User b
Returns
Type Description
System.Boolean

Implements

System.IEquatable<T>
Back to top Generated by DocFX