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
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
CustomFieldValues
Gets or sets custom field values
public CustomFieldValueCollection CustomFieldValues { get; set; }
Property Value
EmailAllowed
[AddInName("EmailAllowed")]
[AddInIsEditable(true)]
public bool EmailAllowed { get; set; }
Property Value
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
ExternalLoginProviderKey
External login provider key
[Obsolete("Use ExternalLogOnProviderKey instead")]
public string ExternalLoginProviderKey { get; }
Property Value
ExternalLoginProviderName
External login provider name
[Obsolete("Use ExternalLogOnProviderName instead")]
public string ExternalLoginProviderName { get; }
Property Value
ExternalLoginProviderType
External login provider type
[Obsolete("Use ExternalLogOnProviderType instead")]
public string ExternalLoginProviderType { get; }
Property Value
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
ExternalLogOnProviderKey
External login provider key
public string ExternalLogOnProviderKey { get; }
Property Value
ExternalLogOnProviderName
External login provider name
public string ExternalLogOnProviderName { get; }
Property Value
ExternalLogOnProviderType
External login provider type
public string ExternalLogOnProviderType { get; }
Property Value
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
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
SystemFieldValues
Gets or sets system field values
public SystemFieldValueCollection SystemFieldValues { get; set; }
Property Value
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
Returns
- bool
- True or false
Authenticate(string, string)
Authenticates user
public static User Authenticate(string username, string password)
Parameters
Returns
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
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
Authenticate(string, string, string)
Authenticates user
public static User Authenticate(string username, string password, string shopId)
Parameters
Returns
CanImpersonate()
public bool CanImpersonate()
Returns
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
Returns
GetAdministratorsByGroupID(int)
Get administrators from specific group
public static UserCollection GetAdministratorsByGroupID(int groupID)
Parameters
groupID
int- Group identifier
Returns
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
GetCurrentBackendUser()
Gets the current backend user. If no user is logged in, null is returned.
public static User GetCurrentBackendUser()
Returns
GetCurrentBackendUserId()
Gets the id of the current backend user. If no user is logged in, 0 is returned.
public static int GetCurrentBackendUserId()
Returns
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
GetCurrentExtranetUserId()
[Obsolete("Use GetCurrentFrontendUserId() instead.")]
public static int GetCurrentExtranetUserId()
Returns
GetCurrentFrontendUser()
Gets the current frontend user. If no user is logged in, null is returned.
public static User GetCurrentFrontendUser()
Returns
GetCurrentFrontendUserId()
Gets the id of the current frontend user. If no user is logged in, 0 is returned.
public static int GetCurrentFrontendUserId()
Returns
GetCurrentSecondaryUser()
Gets the current secondary user. If secondary user is not set, null is returned.
public static User GetCurrentSecondaryUser()
Returns
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
GetCurrentUser(PagePermissionLevels)
Gets current session user
[Obsolete("Use GetCurrentBackendUser() or GetCurrentFrontendUser() instead.")]
public static User GetCurrentUser(PagePermissionLevels level)
Parameters
Returns
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
GetEmptyAccessUserDataSet()
Returns an empty dataset from the AccessUser table - used for looking at the columns
[Obsolete]
public static DataSet GetEmptyAccessUserDataSet()
Returns
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
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
GetTopUsersByGroupID(int, int, bool)
Retrieves a collection of users of the same group.
public static UserCollection GetTopUsersByGroupID(int groupID, int top, bool onlyBackEnd)
Parameters
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
GetUserByEmailAddress(string)
Gets user by email
public static User GetUserByEmailAddress(string emailAddress)
Parameters
emailAddress
string- User email address
Returns
GetUserByEmailAddress(string, string)
Gets user by email
public static User GetUserByEmailAddress(string emailAddress, string shopId)
Parameters
Returns
GetUserByExternalId(string)
Gets user by external id
public static User GetUserByExternalId(string externalId)
Parameters
externalId
string- The external id
Returns
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
Returns
- User
- Retrieved user or Nothing if user can not be retrieved.
GetUserCountByGroupID(int, bool)
public static int GetUserCountByGroupID(int groupID, bool onlyBackEnd)
Parameters
Returns
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
GetUsers(bool)
Gets collection of users
public static UserCollection GetUsers(bool onlyBackEnd)
Parameters
onlyBackEnd
bool- Do we need only backend users
Returns
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
boolhideAdmins
boolonlyActive
boolsortField
stringisAscending
boolstartItem
intendItem
intsearch
stringgroupId
int?total
int
Returns
GetUsersAndGroupsICanSetAsSecondary()
Get Users and Groups that user can set as secondary
public ArrayList GetUsersAndGroupsICanSetAsSecondary()
Returns
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
Remarks
The user id can be group id for group
GetUsersAndGroupsThatCanSetMeAsSecondary()
Get users and groups that can impersonate user
public ArrayList GetUsersAndGroupsThatCanSetMeAsSecondary()
Returns
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
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
GetUsersByGroupID(int, bool)
Gets users from specific group
public static UserCollection GetUsersByGroupID(int groupID, bool onlyBackEnd)
Parameters
Returns
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
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
GetUsersThatCanSetMeAsSecondary()
Gets user's that can impersonate me
public UserCollection GetUsersThatCanSetMeAsSecondary()
Returns
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