Table of Contents

Class User

Namespace
Dynamicweb.Security.UserManagement
Assembly
Dynamicweb.Security.dll
Represents a user.
[Serializable]
public class User : LimitedUser, IPermissionLookup, IPermissionCustomAncestors, IPermissionControlled
Inheritance
User
Implements
Inherited Members
Extension Methods

Constructors

User()

Creates a new instance of a class.
public User()

User(string)

Creates a new instance of a class.
public User(string userName)

Parameters

userName string
Initial user-name to be assigned to the user.

Properties

AddressCustomFieldValues

Custom fields of the users default address.
public CustomFieldValueCollection AddressCustomFieldValues { get; set; }

Property Value

CustomFieldValueCollection

CreatedByUser

Gets user who created current user
public string CreatedByUser { get; }

Property Value

string
String value

CreatedOn

Gets "crated on" date
public DateTime? CreatedOn { get; }

Property Value

DateTime?
DateTime or null value

CurrentSecondaryUser

Gets the user that is secondary to the current logged in user
[Obsolete("Use GetCurrentSecondaryUser() instead.")]
public User CurrentSecondaryUser { get; set; }

Property Value

User

CustomFieldValues

Gets or sets custom field values
public CustomFieldValueCollection CustomFieldValues { get; set; }

Property Value

CustomFieldValueCollection
CustomFieldValueCollection

EmailAllowed

[AddInName("EmailAllowed")]
[AddInIsEditable(true)]
public bool EmailAllowed { get; set; }

Property Value

bool

EmailPermissionGivenOn

Gets "Email permission given on" date
public DateTime? EmailPermissionGivenOn { get; }

Property Value

DateTime?
DateTime or null value

EmailPermissionUpdatedOn

Gets "Email permission updated on" date
public DateTime? EmailPermissionUpdatedOn { get; }

Property Value

DateTime?
DateTime or null value

ExternalLoginEmail

External login e-mail
[Obsolete("Use ExternalLogOnEmail instead")]
public string ExternalLoginEmail { get; }

Property Value

string
The user e-mail in the external system.

ExternalLoginProviderID

External login provider id
[Obsolete("Use ExternalLogOnProviderID instead")]
public int ExternalLoginProviderID { get; }

Property Value

int

ExternalLoginProviderKey

External login provider key
[Obsolete("Use ExternalLogOnProviderKey instead")]
public string ExternalLoginProviderKey { get; }

Property Value

string

ExternalLoginProviderName

External login provider name
[Obsolete("Use ExternalLogOnProviderName instead")]
public string ExternalLoginProviderName { get; }

Property Value

string

ExternalLoginProviderType

External login provider type
[Obsolete("Use ExternalLogOnProviderType instead")]
public string ExternalLoginProviderType { get; }

Property Value

string

ExternalLoginUserName

External login user name
[Obsolete("Use ExternalLogOnUserName instead")]
public string ExternalLoginUserName { get; }

Property Value

string
The name of the user in the external system.

ExternalLogOnEmail

External login e-mail
public string ExternalLogOnEmail { get; }

Property Value

string
The user e-mail in the external system.

ExternalLogOnProviderID

External login provider id
public int ExternalLogOnProviderID { get; }

Property Value

int

ExternalLogOnProviderKey

External login provider key
public string ExternalLogOnProviderKey { get; }

Property Value

string

ExternalLogOnProviderName

External login provider name
public string ExternalLogOnProviderName { get; }

Property Value

string

ExternalLogOnProviderType

External login provider type
public string ExternalLogOnProviderType { get; }

Property Value

string

ExternalLogOnUserName

External login user name
public string ExternalLogOnUserName { get; }

Property Value

string
The name of the user in the external system.

ImpersonationMode

Gets the impersonation mode.
public static UserImpersonation ImpersonationMode { get; }

Property Value

UserImpersonation

LastLoginOn

Gets date of last login
[Obsolete("Use LastLogOnOn instead")]
public DateTime? LastLoginOn { get; }

Property Value

DateTime?
DateTime or null value

LastLogOnOn

Gets date of last login
public DateTime? LastLogOnOn { get; }

Property Value

DateTime?
DateTime or null value

SecondaryUsers

Gets or sets secondary users for current user.
[Obsolete("Use GetSecondaryUsers() instead.")]
public UserCollection SecondaryUsers { get; set; }

Property Value

UserCollection

SystemFieldValues

Gets or sets system field values
public SystemFieldValueCollection SystemFieldValues { get; set; }

Property Value

SystemFieldValueCollection
SystemFieldValueCollection

UpdatedByUser

Gets user who updated current user
public string UpdatedByUser { get; }

Property Value

string
String value

UpdatedOn

Gets "updated on" date
public DateTime? UpdatedOn { get; }

Property Value

DateTime?
DateTime or null value

Methods

ApproveUser(string, ref User)

Approves user using special key string
public static bool ApproveUser(string approvalKey, ref User user)

Parameters

approvalKey string
Approval key
user User
Return approved user

Returns

bool
True or false

Authenticate(string, string)

Authenticates user
public static User Authenticate(string username, string password)

Parameters

username string
User name
password string
Password

Returns

User

Authenticate(string, string, PermissionLevels)

Authenticates user
[Obsolete("Use overload without PermissionLevels and check user.AllowBackendWithInheritance, if needed.")]
public static User Authenticate(string userName, string password, PermissionLevels permissionLevel)

Parameters

userName string
User name
password string
Password
permissionLevel PermissionLevels
Permission level

Returns

User

Authenticate(string, string, PermissionLevels, string, bool)

Authenticates user
[Obsolete("Use overload without PermissionLevels and check user.AllowBackendWithInheritance, if needed.")]
public static User Authenticate(string userName, string password, PermissionLevels permissionLevel, string shopID, bool updatePassword)

Parameters

userName string
User name
password string
Password
permissionLevel PermissionLevels
Permissions level
shopID string
Shop identifier
updatePassword bool
Is it needs to update password

Returns

User
User

Authenticate(string, string, string)

Authenticates user
public static User Authenticate(string username, string password, string shopId)

Parameters

username string
User name
password string
Password
shopId string
Shop identifier

Returns

User
User

CanImpersonate()

public bool CanImpersonate()

Returns

bool

CanImpersonateMe(User)

Tells if current user can be impersonated by the specified user.
public bool CanImpersonateMe(User user)

Parameters

user User
That should be tested to see if it can impersonate the current user

Returns

bool
canImpersonateMe

CanImpersonateUser(User)

Tells if current user can impersonate the specified user.
public bool CanImpersonateUser(User user)

Parameters

user User
User to test against impersonation rules

Returns

bool
canImpersonateUser

Delete()

Deletes the user.
public void Delete()

Delete(int)

Deletes a user.
public static void Delete(int userID)

Parameters

userID int
The ID of the user to be deleted.

Fill(IDataReader)

Fills object properties according to provided IDataReader.
public override void Fill(IDataReader reader)

Parameters

reader IDataReader
Data holder.

FillRow(DataRow)

Override the FillRow method to map all the properties values to their respective field on the datarow. Used when the object is being saved.
protected override void FillRow(DataRow row)

Parameters

row DataRow
The datarow to fill with data.

get_Current(PagePermissionLevels)

Gets current session user
[Obsolete("Use GetCurrentUser instead")]
public static User get_Current(PagePermissionLevels level)

Parameters

level PagePermissionLevels
PagePermissionLevels

Returns

User
User

GetAdministratorsByGroupID(int)

Get administrators from specific group
public static UserCollection GetAdministratorsByGroupID(int groupID)

Parameters

groupID int
Group identifier

Returns

UserCollection
UserCollection

GetAncestors(int)

Gets all ancestor groups collection
public static IEnumerable<Group> GetAncestors(int userId)

Parameters

userId int
The id of the user to get ancestors

Returns

IEnumerable<Group>

GetCurrentBackendUser()

Gets the current backend user. If no user is logged in, null is returned.
public static User GetCurrentBackendUser()

Returns

User

GetCurrentBackendUserId()

Gets the id of the current backend user. If no user is logged in, 0 is returned.
public static int GetCurrentBackendUserId()

Returns

int

GetCurrentExtranetUser()

Retrieves the current user for the current context. If context is Frontend and no user is logged in, Nothing is returned.
[Obsolete("Use GetCurrentFrontendUser() instead.")]
public static User GetCurrentExtranetUser()

Returns

User

GetCurrentExtranetUserId()

[Obsolete("Use GetCurrentFrontendUserId() instead.")]
public static int GetCurrentExtranetUserId()

Returns

int

GetCurrentFrontendUser()

Gets the current frontend user. If no user is logged in, null is returned.
public static User GetCurrentFrontendUser()

Returns

User

GetCurrentFrontendUserId()

Gets the id of the current frontend user. If no user is logged in, 0 is returned.
public static int GetCurrentFrontendUserId()

Returns

int

GetCurrentSecondaryUser()

Gets the current secondary user. If secondary user is not set, null is returned.
public static User GetCurrentSecondaryUser()

Returns

User

GetCurrentUser()

Retrieves the current user for the current context. If context is Frontend and no user is logged in, Nothing is returned.
[Obsolete("Use GetCurrentBackendUser() or GetCurrentFrontendUser() instead.")]
public static User GetCurrentUser()

Returns

User

GetCurrentUser(PagePermissionLevels)

Gets current session user
[Obsolete("Use GetCurrentBackendUser() or GetCurrentFrontendUser() instead.")]
public static User GetCurrentUser(PagePermissionLevels level)

Parameters

level PagePermissionLevels
PagePermissionLevels

Returns

User
User

GetCurrentUserID()

Retrieves the ID of the current backend user. If no user is logged in backend, 0 is returned.
[Obsolete("Use GetCurrentBackendUserId() instead.")]
public static int GetCurrentUserID()

Returns

int

GetEmptyAccessUserDataSet()

Returns an empty dataset from the AccessUser table - used for looking at the columns
[Obsolete]
public static DataSet GetEmptyAccessUserDataSet()

Returns

DataSet

GetSecondaryRelationPermissionGroups(int, int)

Get Groups (and users) that the defined user (userId) that impersonates another user (secondaryUserId) will get as extra permissions when an impersonation using this userid and secondaryid combination takes place.
public static List<Group> GetSecondaryRelationPermissionGroups(int userId, int secondaryUserId)

Parameters

userId int
The user id to find the additional users and groups for permissions
secondaryUserId int
The id of the secondary user to match on the permissions set

Returns

List<Group>

Remarks

This is an unofficial supported feature that requires additional tables in the database and a setting to activate. It is recommended not to use this feature.

GetSecondaryUsers()

Gets the secondary users.
public UserCollection GetSecondaryUsers()

Returns

UserCollection

GetTopUsersByGroupID(int, int, bool)

Retrieves a collection of users of the same group.
public static UserCollection GetTopUsersByGroupID(int groupID, int top, bool onlyBackEnd)

Parameters

groupID int
The ID of the group which retrieved users belongs to.
top int
onlyBackEnd bool

Returns

UserCollection
Retrieved users.

GetUser(CommandBuilder)

Retrieves a user according to provided SQL statement in the specified command builder.
[Obsolete]
public static User GetUser(CommandBuilder commandBuilder)

Parameters

commandBuilder CommandBuilder
The command builder.

Returns

User

GetUserByEmailAddress(string)

Gets user by email
public static User GetUserByEmailAddress(string emailAddress)

Parameters

emailAddress string
User email address

Returns

User

GetUserByEmailAddress(string, string)

Gets user by email
public static User GetUserByEmailAddress(string emailAddress, string shopId)

Parameters

emailAddress string
User email address
shopId string
Shop identifier

Returns

User

GetUserByExternalId(string)

Gets user by external id
public static User GetUserByExternalId(string externalId)

Parameters

externalId string
The external id

Returns

User

GetUserByID(int)

Retrieves a user by its ID.
public static User GetUserByID(int userID)

Parameters

userID int
The ID of the user to be retrieved.

Returns

User
Retrieved users or Nothing if user can not be retrieved.

GetUserByID(int, bool)

Retrieves a user by its ID.
public static User GetUserByID(int userID, bool includeAngelType)

Parameters

userID int
The ID of the user to be retrieved.
includeAngelType bool
If true, include angel user type into search, otherwise - not.

Returns

User
Retrieved user or Nothing if user can not be retrieved.

GetUserByRecoveryToken(string)

Gets a user by recovery token
public static User GetUserByRecoveryToken(string recoveryToken)

Parameters

recoveryToken string
Recovery token

Returns

User
Active user with matching recovery token, if found; Otherwise null.

GetUserBySql(string)

Retrieves a user according to provided SQL statement.
[Obsolete]
public static User GetUserBySql(string sqlCommandText)

Parameters

sqlCommandText string
SQL statement to be used to retrieve a user.

Returns

User
Retrieved user or Nothing if user can not be retrieved.

GetUserByUserName(string)

Retrieves a user by its user name.
public static User GetUserByUserName(string userName)

Parameters

userName string
The user name of the user to be retrieved.

Returns

User
Retrieved user or Nothing if user can not be retrieved.

GetUserByUserName(string, string)

Retrieves a user by its user name.
public static User GetUserByUserName(string userName, string shopID)

Parameters

userName string
The user name of the user to be retrieved.
shopID string
Shop identifier

Returns

User
Retrieved user or Nothing if user can not be retrieved.

GetUserCountByGroupID(int, bool)

public static int GetUserCountByGroupID(int groupID, bool onlyBackEnd)

Parameters

groupID int
onlyBackEnd bool

Returns

int

GetUsers()

Retrieves a collection of all users.
public static UserCollection GetUsers()

Returns

UserCollection
Retrieved users.

GetUsers(CommandBuilder)

Retrieves a collection of users.
[Obsolete]
public static UserCollection GetUsers(CommandBuilder commandBuilder)

Parameters

commandBuilder CommandBuilder
The command builder.

Returns

UserCollection
UserCollection

GetUsers(bool)

Gets collection of users
public static UserCollection GetUsers(bool onlyBackEnd)

Parameters

onlyBackEnd bool
Do we need only backend users

Returns

UserCollection
UserCollection

GetUsers(bool, bool, bool, string, bool, int, int, string, int?, ref int)

public static UserCollection GetUsers(bool onlyBackEnd, bool hideAdmins, bool onlyActive, string sortField, bool isAscending, int startItem, int endItem, string search, int? groupId, ref int total)

Parameters

onlyBackEnd bool
hideAdmins bool
onlyActive bool
sortField string
isAscending bool
startItem int
endItem int
search string
groupId int?
total int

Returns

UserCollection

GetUsersAndGroupsICanSetAsSecondary()

Get Users and Groups that user can set as secondary
public ArrayList GetUsersAndGroupsICanSetAsSecondary()

Returns

ArrayList

GetUsersAndGroupsICanSetAsSecondary(int, ReadOnlyGroupCollection)

Get Users and Groups that defined user can set as secondary
public static ArrayList GetUsersAndGroupsICanSetAsSecondary(int userID, ReadOnlyGroupCollection groups)

Parameters

userID int
The user id to find secondary users and groups
groups ReadOnlyGroupCollection
The user groups or group subgroups to find the secondary users and groups

Returns

ArrayList

Remarks

The user id can be group id for group

GetUsersAndGroupsThatCanSetMeAsSecondary()

Get users and groups that can impersonate user
public ArrayList GetUsersAndGroupsThatCanSetMeAsSecondary()

Returns

ArrayList

GetUsersAndGroupsThatCanSetMeAsSecondary(int, ReadOnlyGroupCollection)

Get users and groups that can impersonate the defined user
public static ArrayList GetUsersAndGroupsThatCanSetMeAsSecondary(int userID, ReadOnlyGroupCollection groups)

Parameters

userID int
The user id to find users and groups that can impersonate user
groups ReadOnlyGroupCollection
The user groups or group subgroups to find the users and groups that can impersonate user

Returns

ArrayList

Remarks

The user id can be group id for group

GetUsersByGroupID(int)

Gets users from specific group
public static UserCollection GetUsersByGroupID(int groupID)

Parameters

groupID int
Group identifier

Returns

UserCollection
UserCollection

GetUsersByGroupID(int, bool)

Gets users from specific group
public static UserCollection GetUsersByGroupID(int groupID, bool onlyBackEnd)

Parameters

groupID int
Group identifier
onlyBackEnd bool
Do we need only backend users

Returns

UserCollection
UserCollection

GetUsersByID(ICollection<int>)

Retrieves a user by its ID.
public static UserCollection GetUsersByID(ICollection<int> userIds)

Parameters

userIds ICollection<int>
The ID of the user to be retrieved.

Returns

UserCollection
Retrieved users or Nothing if user can not be retrieved.

GetUsersByIds(List<int>)

Gets the users by the list of user ids.
public static UserCollection GetUsersByIds(List<int> userIds)

Parameters

userIds List<int>
The user ids.

Returns

UserCollection
UserCollection.

GetUsersBySql(string)

Retrieves a collection of users according to provided SQL statement.
[Obsolete]
public static UserCollection GetUsersBySql(string sqlCommandText)

Parameters

sqlCommandText string
SQL statement to be used to retrieve users.

Returns

UserCollection
Retrieved users.

GetUsersFromGroupTree(Group, Dictionary<int, User>)

Gets users from group tree hierarchy
public static void GetUsersFromGroupTree(Group group, Dictionary<int, User> users)

Parameters

group Group
Parent group
users Dictionary<int, User>
Dictionary<TKey, TValue>

GetUsersICanSetAsSecondary()

Gets users whom I can set as secondary
public UserCollection GetUsersICanSetAsSecondary()

Returns

UserCollection

GetUsersThatCanSetMeAsSecondary()

Gets user's that can impersonate me
public UserCollection GetUsersThatCanSetMeAsSecondary()

Returns

UserCollection

IsBackendUserLoggedIn()

Determines whether a user is logged into the backend.
public static bool IsBackendUserLoggedIn()

Returns

bool
true if user is logged into the backend otherwise, false.

IsExtranetUserLoggedIn()

Determines whether a user is logged into the frontend (extranet).
[Obsolete("Use IsFrontendUserLoggedIn() instead.")]
public static bool IsExtranetUserLoggedIn()

Returns

bool
true if user is logged into the frontend otherwise, false.

IsFrontendUserLoggedIn()

Determines whether a user is logged into the frontend.
public static bool IsFrontendUserLoggedIn()

Returns

bool
true if user is logged into the frontend otherwise, false.

RemoveSecondaryUsers(int)

Removes all the users and groups that can impersonate the user or grouop and users and groups that the user or group can impersonate
public static void RemoveSecondaryUsers(int userId)

Parameters

userId int
The user or group id to remove the impersonated users and groups from

Remarks

The user id can be group id for group

Save()

Saves current user.
public bool Save()

Returns

bool
True if the user was saved, false if the username already exists on another user.

set_Current(PagePermissionLevels, User)

Sets current session user
[Obsolete("Do not use")]
public static void set_Current(PagePermissionLevels level, User value)

Parameters

level PagePermissionLevels
PagePermissionLevels
value User
A user

SetCurrentUser(PagePermissionLevels, User)

Sets current session user
[Obsolete("Do not use")]
public static void SetCurrentUser(PagePermissionLevels level, User value)

Parameters

level PagePermissionLevels
PagePermissionLevels
value User
A user

UpdateInformationSentDate(IEnumerable<User>)

Updates the value of the InformationSentDate property.
public static void UpdateInformationSentDate(IEnumerable<User> users)

Parameters

users IEnumerable<User>
The collection of the users to update.

UpdateInformationSentDate(IEnumerable<User>, DateTime)

Updates the value of the InformationSentDate property.
[Obsolete("Use UpdateInformationSentDate(IEnumerable<User>) instead.")]
public static void UpdateInformationSentDate(IEnumerable<User> users, DateTime sentDate)

Parameters

users IEnumerable<User>
The collection of the users to update.
sentDate DateTime
The parameter is no longer used.

UpdateSecondaryUsers(ICollection<int>, bool)

Update users and groups that I can impersonate or that can Impersonate me
public void UpdateSecondaryUsers(ICollection<int> secondaryUserIds, bool updateUsersICanSetAsSecondary)

Parameters

secondaryUserIds ICollection<int>
The list of group or user ids that can impersonate me or I can impersonate them
updateUsersICanSetAsSecondary bool
If set to true the users and groups that I can impersonate are updated. Otherwise the users and grouops that can impersonate me are updated.

UpdateSecondaryUsers(int, ICollection<int>, bool)

Update users and groups that I can impersonate or that can Impersonate me
public static void UpdateSecondaryUsers(int userId, ICollection<int> secondaryUserIds, bool updateUsersICanSetAsSecondary)

Parameters

userId int
The user or group id to update imeprsonation users and groups ids
secondaryUserIds ICollection<int>
The list of group or user ids that can impersonate the user or user can impersonate them
updateUsersICanSetAsSecondary bool
If set to true the users and groups that I can impersonate are updated. Otherwise the users and grouops that can impersonate me are updated.

Remarks

The user id can be group id for group
To top