Table of Contents

Class UserInfo

Namespace
CMS.Membership
Assembly
CMS.Membership.dll

UserInfo data container class.

[InfoCache(InfoCacheBy.ID|InfoCacheBy.Name)]
public class UserInfo : AbstractInfo<UserInfo, IUserInfoProvider>, IExtensible, IInfo, IAdvancedDataContainer, ICMSObject, IHierarchicalDataContainer, IVirtualHierarchicalObject, IHierarchicalObject, INameIndexable, IMacroObject, IUserInfo, IDataContainer, ISimpleDataContainer
Inheritance
object
UserInfo
Implements
Derived
Inherited Members
Extension Methods

Constructors

UserInfo()

Constructor - Creates an empty UserInfo object.

public UserInfo()

UserInfo(UserInfo, bool, bool)

Constructor - Creates a new UserInfo object from the given DataClass.

public UserInfo(UserInfo ui, bool keepSourceData, bool useCachedData = true)

Parameters

ui UserInfo

Source user info

keepSourceData bool

If true, source data are kept

useCachedData bool

Indicates if cached data like user memberships, roles, cultures, etc. should be used from source user object

UserInfo(DataRow)

Constructor - Creates a new UserInfo object from the given DataRow.

public UserInfo(DataRow dr)

Parameters

dr DataRow

Data row with the user data

Fields

OBJECT_TYPE

Object type

public const string OBJECT_TYPE = "cms.user"

Field Value

string

TYPEINFO

Type information.

public static readonly ObjectTypeInfo TYPEINFO

Field Value

ObjectTypeInfo

Properties

Email

E-mail address.

[DatabaseField]
public virtual string Email { get; set; }

Property Value

string

FirstName

First name of user.

[DatabaseField]
public virtual string FirstName { get; set; }

Property Value

string

FullName

Gets user full name.

public string FullName { get; }

Property Value

string

LastLogon

Last logon of user.

[DatabaseField]
public virtual DateTime LastLogon { get; set; }

Property Value

DateTime

LastName

Last name.

[DatabaseField]
public virtual string LastName { get; set; }

Property Value

string

UserAdministrationAccess

User administration access.

[DatabaseField]
public virtual bool UserAdministrationAccess { get; set; }

Property Value

bool

UserAuthenticationRecoveryCode

User authentication recovery code.

[DatabaseField]
public virtual string UserAuthenticationRecoveryCode { get; set; }

Property Value

string

UserAuthenticatorSharedKey

User authenticator shared key.

[DatabaseField]
public virtual string UserAuthenticatorSharedKey { get; set; }

Property Value

string

UserAuthenticatorSharedKeyResetRequested

User authenticator shared key reset requested.

[DatabaseField]
public virtual bool UserAuthenticatorSharedKeyResetRequested { get; set; }

Property Value

bool

UserCreated

When was user created.

[DatabaseField]
public virtual DateTime UserCreated { get; set; }

Property Value

DateTime

UserEnabled

Indicates whether user is enabled.

[DatabaseField]
public virtual bool UserEnabled { get; set; }

Property Value

bool

Remarks

When toggling the enabled state of a user, a new UserSecurityStamp is generated.

UserFailedLoginAttempts

User failed login attempts.

[DatabaseField]
public virtual int UserFailedLoginAttempts { get; set; }

Property Value

int

UserGUID

User GUID.

[DatabaseField]
public virtual Guid UserGUID { get; set; }

Property Value

Guid

UserID

User ID.

[DatabaseField]
public virtual int UserID { get; set; }

Property Value

int

UserIsExternal

Indicates whether user uses external authentication.

[DatabaseField]
public virtual bool UserIsExternal { get; set; }

Property Value

bool

UserIsPendingRegistration

User is pending registration.

[DatabaseField]
public virtual bool UserIsPendingRegistration { get; set; }

Property Value

bool

UserLastModified

Object last modified.

[DatabaseField]
public virtual DateTime UserLastModified { get; set; }

Property Value

DateTime

UserLockoutEnd

User lockout end.

[DatabaseField]
public virtual DateTime UserLockoutEnd { get; set; }

Property Value

DateTime

UserName

User name.

[DatabaseField]
public virtual string UserName { get; set; }

Property Value

string

UserPasswordLastChanged

User password last changed.

[DatabaseField]
public virtual DateTime UserPasswordLastChanged { get; set; }

Property Value

DateTime

UserRegistrationLinkExpiration

User registration link expiration.

[DatabaseField]
public virtual DateTime UserRegistrationLinkExpiration { get; set; }

Property Value

DateTime

UserSecurityStamp

A unique value used for tracking changes to the user profile. Used for security purposes.

[DatabaseField]
public virtual string UserSecurityStamp { get; set; }

Property Value

string

Remarks

Currently this field is used only in our MVC UserStore implementation. Changing this field's value will invalidate any tokens generated within the Identity/OWIN implementation, e.g.: email confirmation tokens, authentication cookies, etc.

Methods

ClearCachedData()

Clears the cached data of this object

protected void ClearCachedData()

CopyCachedDataTo(UserInfo)

Copies the cached data to another UserInfo object

protected void CopyCachedDataTo(UserInfo userInfo)

Parameters

userInfo UserInfo

Target user info

DeleteObject()

Deletes the object using appropriate provider.

protected override void DeleteObject()

GetDefaultDataWhereCondition(bool, IEnumerable<string>)

Gets the where condition to filter out the default installation data

protected override string GetDefaultDataWhereCondition(bool recursive = true, IEnumerable<string> excludedNames = null)

Parameters

recursive bool

Indicates whether where condition should contain further dependency conditions.

excludedNames IEnumerable<string>

Objects with display names and code names starting with these expressions are filtered out.

Returns

string

GetDefaultObject()

Returns default user set in the settings or Global Administrator if setting is not defined or user not found.

protected override BaseInfo GetDefaultObject()

Returns

BaseInfo

GetUniqueCodeName(string, int)

Returns the unique code name for the specified object, does not check duplicity if duplicity occurs within the currentObjectId.

protected override string GetUniqueCodeName(string codeName, int currentObjectId)

Parameters

codeName string

Original code name

currentObjectId int

Current object ID

Returns

string

Remarks

Also replaces all unsupported characters.

HasAdministrationAccess()

Determines whether user has allowed access to administration.

public bool HasAdministrationAccess()

Returns

bool

true if user has allowed access to administration; otherwise, false.

Invalidate(bool)

Invalidates the object in the object table.

protected override void Invalidate(bool keepThisInstanceValid)

Parameters

keepThisInstanceValid bool

If true, this object is marked as updated to behave as valid

IsAdministrator()

Determines whether this user is administrator.

public bool IsAdministrator()

Returns

bool

true if this user is administrator; otherwise, false.

IsInRole(string)

Returns true if the user is a member of the role.

public virtual bool IsInRole(string roleName)

Parameters

roleName string

Role name to check

Returns

bool

Remarks

The check also accounts for global roles.

IsPublic()

Returns true if the user is public user record.

public virtual bool IsPublic()

Returns

bool

LoadDefaultData()

Sets the object default values

protected override void LoadDefaultData()

RegisterProperties()

Registers properties of the object

protected override sealed void RegisterProperties()

SetObject()

Updates the object using appropriate provider.

protected override void SetObject()

SetValue(string, object)

Sets the field value.

public override bool SetValue(string columnName, object value)

Parameters

columnName string

Column name

value object

Value to be saved

Returns

bool