Show / Hide Table of Contents

Class SoUser

SuperOffice CRM User Administration. Use static (VB: shared) methods to to instantiate objects.

Inheritance
Object
NestedPersist
NestedPersistFacade
SoUser
Implements
INestedPersist
Inherited Members
NestedPersistFacade.OnPrimaryKeyRequest(PKContainer)
NestedPersistFacade.OnPrimaryKeyUpdate(PKContainer)
NestedPersistFacade.OnSave(BatchSave)
NestedPersistFacade.IsDirty
NestedPersist._saveOwner
NestedPersist._isSaving
NestedPersist.SetSaveOwner(INestedPersist)
NestedPersist.Save()
NestedPersist.INestedPersist.OnPreIdUpdate()
NestedPersist.INestedPersist.OnPrimaryKeyRequest(PKContainer)
NestedPersist.INestedPersist.OnPrimaryKeyUpdate(PKContainer)
NestedPersist.INestedPersist.OnIdUpdate()
NestedPersist.INestedPersist.OnSave(BatchSave)
NestedPersist.INestedPersist.OnSaved(Boolean)
NestedPersist.IsSaving
NestedPersist.OnElementSaved
NestedPersist.OnElementIdUpdate
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: SuperOffice.CRM.Administration
Assembly: SoDataBase.dll
Syntax
public sealed class SoUser : NestedPersistFacade, INestedPersist
Remarks

Only users with administrative privileges is permitted to work with other users than the currently logged on user. This means that SuperOffice CRM administrators can manage all users.

Named users that does not have administrative privileges (e.g. users that are persons) are only permitted to change their own password.

Anonymous users can not manage own or other users at all.

System users can manage other users, and own user.

Named users, administrators and the system user with the 'CanCreateExternalPerson' permission can manage external persons. External persons with this permission can only manage other external persons belonging to the same company.

Properties

AssociateId

AssociateId of the user. This value is '0' until the user is created.

Declaration
public int AssociateId { get; }
Property Value
Type Description
Int32

CanChangePassword

Is this plugin able to change password for the current

Declaration
public bool CanChangePassword { get; }
Property Value
Type Description
Boolean
Remarks

True if the plugin is able to change password.

CanCreateExternalPerson

Obsolete: Replaced by new license system!

Declaration
[Obsolete("[SR_REPLACED_BY_NEW_LICENSE_SYSTEM]", true)]
public bool CanCreateExternalPerson { get; set; }
Property Value
Type Description
Boolean

CanValidatePassword

Is the plugin able to validfate the password.

Declaration
public bool CanValidatePassword { get; }
Property Value
Type Description
Boolean

ConfidentialAppointment

Obsolete: Replaced by new license system!

Declaration
[Obsolete("[SR_REPLACED_BY_NEW_LICENSE_SYSTEM]", true)]
public bool ConfidentialAppointment { get; set; }
Property Value
Type Description
Boolean

Credentials

Declaration
public SoUserCredential[] Credentials { get; }
Property Value
Type Description
SoUserCredential[]

CredentialsTableInfo

The Credentials TableInfo used in the sentry to talk about password permissions.

Declaration
public CredentialsTableInfo CredentialsTableInfo { get; }
Property Value
Type Description
CredentialsTableInfo

CustomFields

Custom fields on ejUser - may be null.

Declaration
public EntityCustomFieldsHelper CustomFields { get; }
Property Value
Type Description
EntityCustomFieldsHelper

Deleted

is the user deleted.

Declaration
public bool Deleted { get; set; }
Property Value
Type Description
Boolean

EjCategoryIds

Get and set ejCategories per user.

Declaration
public int[] EjCategoryIds { get; set; }
Property Value
Type Description
Int32[]

Ejuser

Declaration
public EjuserRow Ejuser { get; }
Property Value
Type Description
EjuserRow

EjUserId

Get or set primary key in the ejuser table.

Declaration
public int EjUserId { get; set; }
Property Value
Type Description
Int32

ExtraFields

Extra fields on ejUser - may be null.

Declaration
public EntityExtraFieldsHelper ExtraFields { get; }
Property Value
Type Description
EntityExtraFieldsHelper

ForeignKeyHelper

Declaration
public RowForeignKeyHelper ForeignKeyHelper { get; }
Property Value
Type Description
RowForeignKeyHelper

GroupIdx

Group membership

Declaration
public int GroupIdx { get; set; }
Property Value
Type Description
Int32

IsDeleted

Is the row deleted from the database. Only used by Nested Persist. See the Deleted property for making the user appear as deleted.

Declaration
public override bool IsDeleted { get; }
Property Value
Type Description
Boolean
Overrides
NestedPersist.IsDeleted

IsMarkedForDelete

Declaration
public override bool IsMarkedForDelete { get; set; }
Property Value
Type Description
Boolean
Overrides
NestedPersist.IsMarkedForDelete

IsOnTravel

Return true if the user is on travel from THIS database.

Declaration
public bool IsOnTravel { get; }
Property Value
Type Description
Boolean

LastLogin

Declaration
public DateTime LastLogin { get; }
Property Value
Type Description
DateTime

Lastlogout

Declaration
public DateTime Lastlogout { get; }
Property Value
Type Description
DateTime

LicenseAssocLinkTableInfo

The License TableInfo used in the sentry to talk about role permissions.

Declaration
public LicenseAssocLinkTableInfo LicenseAssocLinkTableInfo { get; }
Property Value
Type Description
LicenseAssocLinkTableInfo

LicenseFieldRight

The current user's permissions to read/modify the Licenses.

Declaration
public FieldRight LicenseFieldRight { get; }
Property Value
Type Description
FieldRight

Licenses

User licenses

Declaration
public AssociateModuleLicenseOwner[] Licenses { get; }
Property Value
Type Description
AssociateModuleLicenseOwner[]

LoginRight

Obsolete: Replaced by new license system!

Declaration
public bool LoginRight { get; set; }
Property Value
Type Description
Boolean

LogonName

Logon name for the user: Associate.Name. Sets ejUser.Username if not already set.

Declaration
public string LogonName { get; set; }
Property Value
Type Description
String

MainTable

The main table info for the associate table storing user information. This is used with Sentries.

Declaration
public AssociateTableInfo MainTable { get; }
Property Value
Type Description
AssociateTableInfo

NetServerClient

Obsolete: Replaced by new license system!

Declaration
[Obsolete("[SR_REPLACED_BY_NEW_LICENSE_SYSTEM]", true)]
public bool NetServerClient { get; set; }
Property Value
Type Description
Boolean

OtherGroupIds

Get and set secondary groups.

Declaration
public int[] OtherGroupIds { get; set; }
Property Value
Type Description
Int32[]

PasswordFieldRight

The current user's permissions to read/modify the Password

Declaration
public FieldRight PasswordFieldRight { get; }
Property Value
Type Description
FieldRight

Person

Get the Person associated with the user. Null if there is no person associated with the user.

Declaration
public Person Person { get; }
Property Value
Type Description
Person

PersonId

Primary key of the person in the person table.

Declaration
public int PersonId { get; set; }
Property Value
Type Description
Int32

PocketClient

Obsolete: Replaced by new license system!

Declaration
[Obsolete("[SR_REPLACED_BY_NEW_LICENSE_SYSTEM]", true)]
public bool PocketClient { get; set; }
Property Value
Type Description
Boolean

Rank

Sort order rank. Only administrators can set.

Declaration
public short Rank { get; set; }
Property Value
Type Description
Int16

RoleIdx

Group membership

Declaration
public int RoleIdx { get; set; }
Property Value
Type Description
Int32

Sentries

Sentries governing the underlying tables and fields.

Declaration
public SentryCollection Sentries { get; }
Property Value
Type Description
SentryCollection

SkipConsistencyChecks

Set this to true, to skip consistency checks when saving the entity. The caller MUST make sure the consistency is not violated after the the caller has performed the intended operation(s).

Declaration
public bool SkipConsistencyChecks { get; set; }
Property Value
Type Description
Boolean

Tooltip

Description / Tooltip. Only administrators can set.

Declaration
public string Tooltip { get; set; }
Property Value
Type Description
String

Travel

Obsolete: Replaced by new license system!

Declaration
[Obsolete("[SR_REPLACED_BY_NEW_LICENSE_SYSTEM]", true)]
public bool Travel { get; set; }
Property Value
Type Description
Boolean

UserGroupLinkTableInfo

The UserGroupLink TableInfo used in the sentry to talk about usergroup permissions.

Declaration
public UserGroupLinkTableInfo UserGroupLinkTableInfo { get; }
Property Value
Type Description
UserGroupLinkTableInfo

UserName

Associate.UserName, not the Associate.Name

Declaration
public string UserName { get; set; }
Property Value
Type Description
String

UserRoleLinkTableInfo

The UserRoleLink TableInfo used in the sentry to talk about role permissions.

Declaration
public UserRoleLinkTableInfo UserRoleLinkTableInfo { get; }
Property Value
Type Description
UserRoleLinkTableInfo

UserType

Type of associate (e.g. logon). Can only be set by administrators.

Declaration
public UserType UserType { get; set; }
Property Value
Type Description
SuperOffice.License.UserType

WebClient

Obsolete: Replaced by new license system!

Declaration
[Obsolete("[SR_REPLACED_BY_NEW_LICENSE_SYSTEM]", true)]
public bool WebClient { get; set; }
Property Value
Type Description
Boolean

WinClient

Obsolete: Replaced by new license system!

Declaration
[Obsolete("[SR_REPLACED_BY_NEW_LICENSE_SYSTEM]", true)]
public bool WinClient { get; set; }
Property Value
Type Description
Boolean

Methods

AddCredential(String, String, String)

Declaration
public void AddCredential(string type, string value, string displayValue)
Parameters
Type Name Description
String type
String value
String displayValue

ChangePassword(String, String)

Changes the account password from the old password to the new password.

Declaration
public void ChangePassword(string oldPassword, string newPassword)
Parameters
Type Name Description
String oldPassword

The old password to change from. This must be the current calid password.

String newPassword

The new password to change to.

ChangeUserGroup(Int32, Int32)

This function is called to change membership of one usergroup to another on the user.

Declaration
public void ChangeUserGroup(int oldGroupId, int newGroupId)
Parameters
Type Name Description
Int32 oldGroupId
Int32 newGroupId

CreateNew(Int32, UserType, Boolean)

Create a new user given it's PersonId

Declaration
public static SoUser CreateNew(int personId, UserType userType, bool withDefaultCredentials = false)
Parameters
Type Name Description
Int32 personId

Id for the person that is to become a user. Use null (VB: Nothing) for System and Anonymous users.

SuperOffice.License.UserType userType
Boolean withDefaultCredentials
Returns
Type Description
SoUser

A new instance of a user object. This object needs to be primed with appropriate data before saving

Remarks

Administration privileges is required for creating new users.

DemandPermission(SoUser.PermissionType)

Check that the current user has the permission.

Declaration
public void DemandPermission(SoUser.PermissionType permissionType)
Parameters
Type Name Description
SoUser.PermissionType permissionType

OwnPerson, Administrator, etc

Exceptions
Type Condition
SoIllegalOperationException

Exception is thrown if the currently logged in user does not meet the demand for permission.

FindUsersFromEJUser(Int32)

Method for finding associateId's of eJournal users providing the ejUser.Id

Declaration
public static int[] FindUsersFromEJUser(int ejUserId)
Parameters
Type Name Description
Int32 ejUserId
Returns
Type Description
Int32[]

AssociateIdd of matching users.

FindUsersFromPerson(Int32)

Method for finding associateId's of user providing the PersonId

Declaration
public static int[] FindUsersFromPerson(int personId)
Parameters
Type Name Description
Int32 personId

PersonId of the user to find

Returns
Type Description
Int32[]

AssociateIdd of mathing users.

GetCurrent()

Manage the current user. Must be logged in. Can't manage users anonymously.

Declaration
public static SoUser GetCurrent()
Returns
Type Description
SoUser

SoUser object for the current user.

Remarks

Only named users are permitted to manage their own user. Other kinds of users needs to be maintained by an administrator.

Exceptions
Type Condition
SoIllegalOperationException

The operation requires the logged on user to have an UserType of Employee, ExternalPerson.

GetDefaultAssociateUserName()

Ask for the default UserName for Associate

Declaration
public string GetDefaultAssociateUserName()
Returns
Type Description
String

GetFacadingItems()

Declaration
protected override IEnumerable<INestedPersist> GetFacadingItems()
Returns
Type Description
IEnumerable<INestedPersist>
Overrides
NestedPersistFacade.GetFacadingItems()

GetLicenseOwner(String)

Get details on a module owner.

Declaration
public AssociateModuleLicenseOwner GetLicenseOwner(string owner)
Parameters
Type Name Description
String owner

Name of the module owner.

Returns
Type Description
AssociateModuleLicenseOwner

Details on a module owner. Null (VB Nothing) is returned if the module owner is not available.

GetModuleLicense(String)

Get details on a module license link. i.e. Returns only user licenses.

Declaration
public AssociateModuleLicenseLink GetModuleLicense(string fullName)
Parameters
Type Name Description
String fullName

Full name of the license formatted like [OwnerName].[LicenseName].

Returns
Type Description
AssociateModuleLicenseLink

Details on a module license link. Null (VB Nothing) is returned if the module license is not available.

GetModuleLicense(String, String)

Get details on a module license link. i.e. Returns only user licenses.

Declaration
public AssociateModuleLicenseLink GetModuleLicense(string owner, string module)
Parameters
Type Name Description
String owner

Name of the module owner.

String module

Name of the module license

Returns
Type Description
AssociateModuleLicenseLink

Details on a module license link. Null (VB Nothing) is returned if the module license is not available.

GetModuleLicenses()

Returns all modules, across all license owners. Some are assigned, some are not.

Declaration
public IEnumerable<AssociateModuleLicenseLink> GetModuleLicenses()
Returns
Type Description
IEnumerable<AssociateModuleLicenseLink>

Associate License links related to the user.

GetRequestRestrictionBlockers()

Return request based reasons for blocking delete of user

Declaration
public string GetRequestRestrictionBlockers()
Returns
Type Description
String

Blank or an error message: "[SR_REQUEST_DEPENDENCY]"

IsAssociateNameLegal(String, out String)

Declaration
public bool IsAssociateNameLegal(string associateName, out string reason)
Parameters
Type Name Description
String associateName
String reason
Returns
Type Description
Boolean

IsAssociateUserNameLegal(String, out String)

Declaration
public bool IsAssociateUserNameLegal(string associateUserName, out string reason)
Parameters
Type Name Description
String associateUserName
String reason
Returns
Type Description
Boolean

IsPasswordLegal(String, out String)

Declaration
public bool IsPasswordLegal(string password, out string reason)
Parameters
Type Name Description
String password
String reason
Returns
Type Description
Boolean

IsPasswordValid(String)

Check if password is valid.

Declaration
public bool IsPasswordValid(string password)
Parameters
Type Name Description
String password

The password to check if if it is valid (e.g. that means that this is the current password.)

Returns
Type Description
Boolean

True if the right password is passed in.

MakeRetired(Boolean)

Retire the given user, meaning removing all licenses and set the person as retired

Declaration
public void MakeRetired(bool retired)
Parameters
Type Name Description
Boolean retired

ManageUser(Int32)

Manage a user.

Declaration
public static SoUser ManageUser(int associateId)
Parameters
Type Name Description
Int32 associateId

Id of the user to manage.

Returns
Type Description
SoUser

The user.

Exceptions
Type Condition
SoIllegalOperationException

If the user is of a wrong UserType or in any way does not have permission to manage the given user, the exception is thrown.

ManageUser(String)

Manage a user.

Declaration
public static SoUser ManageUser(string associateName)
Parameters
Type Name Description
String associateName

Logon name (e.g. associate name) of the user to manage.

Returns
Type Description
SoUser

SoUser object for the user.

Exceptions
Type Condition
SoIllegalOperationException

If the user is of a wrong UserType or in any way does not have permission to manage the given user, the exception is thrown.

ManageUserFromEjUserId(Int32)

Declaration
public static SoUser[] ManageUserFromEjUserId(int ejUserId)
Parameters
Type Name Description
Int32 ejUserId
Returns
Type Description
SoUser[]

ManageUserFromPersonId(Int32)

Declaration
public static SoUser[] ManageUserFromPersonId(int personId)
Parameters
Type Name Description
Int32 personId
Returns
Type Description
SoUser[]

OnIdUpdate()

Handle Id Update: ensure that associate.ejUserId = ejUser.ejUserId

Update related objects with correct id's to make sure that relations are consistent before saving to the database.

Declaration
protected override void OnIdUpdate()
Overrides
NestedPersistFacade.OnIdUpdate()

OnPreIdUpdate()

Handle Pre Id Update: Update the implied licenses on the user to match the ExtraInfo "set=..." by removing all hidden licenses and then assigned the ones

Declaration
protected override void OnPreIdUpdate()
Overrides
NestedPersistFacade.OnPreIdUpdate()

OnSaved(Boolean)

Declaration
protected override void OnSaved(bool bSucceeded)
Parameters
Type Name Description
Boolean bSucceeded
Overrides
NestedPersistFacade.OnSaved(Boolean)

RemoveCredential(String)

Declaration
public void RemoveCredential(string type)
Parameters
Type Name Description
String type

RemoveLicenses()

Remove all licenses for given user

Declaration
public void RemoveLicenses()

SetGeneratedPassword()

Generate a new password and assign it to the user.

Declaration
public string SetGeneratedPassword()
Returns
Type Description
String

The newly generated password.

Exceptions
Type Condition
SoIllegalOperationException

If the user does not have required permissions.

SetGeneratedPassword(Int32)

Generate a new password and assign it to the user.

Declaration
public string SetGeneratedPassword(int length)
Parameters
Type Name Description
Int32 length

Ldength of the new password to generate.

Returns
Type Description
String

The newly generated password.

Exceptions
Type Condition
SoIllegalOperationException

If the user does not have required permissions.

SetOwnPassword(String, String)

Set own password. Only currently logged in users are permitted to access this method.

Declaration
[Obsolete("Use ChangePassword instead", false)]
public void SetOwnPassword(string oldPassword, string newPassword)
Parameters
Type Name Description
String oldPassword

Your old password.

String newPassword

Your new password.

Exceptions
Type Condition
SoIllegalOperationException

If the user does not have required permissions.

SetPassword(String)

Set the password for a user.

Declaration
public void SetPassword(string password)
Parameters
Type Name Description
String password

The password for the user

Remarks

This method requires administration priviledges.

Exceptions
Type Condition
SoIllegalOperationException

If the user does not have required permissions.

SetValidAssociateName(String)

Assign a user name and make sure it is valid.

Declaration
public string SetValidAssociateName(string associateName)
Parameters
Type Name Description
String associateName
Returns
Type Description
String

The valid user name.

SetValidAssociateUserName(String)

Declaration
public string SetValidAssociateUserName(string associateUserName)
Parameters
Type Name Description
String associateUserName
Returns
Type Description
String

SetValidUserName(String)

Declaration
public string SetValidUserName(string associateName)
Parameters
Type Name Description
String associateName
Returns
Type Description
String

ToString()

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

Validate(RowValidator)

Declaration
public void Validate(RowValidator rowValidator)
Parameters
Type Name Description
RowValidator rowValidator

Validate(Dictionary<String, String>)

Declaration
public void Validate(Dictionary<string, string> validator)
Parameters
Type Name Description
Dictionary<String, String> validator

Implements

INestedPersist

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top