Show / Hide Table of Contents

Class SoPrincipal

Summary description for SoPrincipal.

Inheritance
Object
SoPrincipal
SoLocalPrincipal
Implements
IPrincipal
Namespace: SuperOffice.Security.Principal
Assembly: SoCore.dll
Syntax
public abstract class SoPrincipal : MarshalByRefObject, IPrincipal

Constructors

SoPrincipal(IEnumerable<ClaimsIdentity>)

Default constructor for the identity.

Declaration
protected SoPrincipal(IEnumerable<ClaimsIdentity> identities)
Parameters
Type Name Description
IEnumerable<ClaimsIdentity> identities

Properties

Associate

Associate name (e.g. logon name) for the user

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

AssociateId

AssociateId for the user.

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

BusinessId

BusinessIdx for the company that the user belongs to.

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

CanCreateExternalPerson

Can this user create and manage external persons

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

External persons (e.g. UserType of ExternalPerson) can only manage external persons belonging to the same contact (e.g. company). Hence, only UserType of Employee and System can manage external persons on all companies in the database.

CategoryId

CategoryIdx of the company that the user belongs to.

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

ContactId

Company of the associate's person

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

ContactOwner

Owner (AssocaiteId) of the company that the user belongs to.

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

CountryId

CountryId for the user, from the person record. Note that this is not the users' "home country" (which can be overriden by a preference), use the HomeCountryId to get that id.

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

CRM5Secret

Secret used with type UserType CRM5 in SoCredentials. Only valid 24 hours after it was created.

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

DatabaseContextIdentifier

The identifier of the users database context.

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

EjAccessLevel

eJournal user access level

Declaration
public EjAccess EjAccessLevel { get; }
Property Value
Type Description
EjAccess

EjUserId

Primary key in eJournal's old user table.

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

EjUserStatus

eJournal user status

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

EMailAddress

The Person e-mail address if the associate is a person. Use IsPerson to check

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

FullName

The Person full name if the associate is a person. Use IsPerson to check

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

GroupId

Associate's group_idx

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

HomeCountryId

Country id for the user's home country. This is the default country id when creating new items. In contrast to CountryId, which only looks at the person record, this property also takes into account the OwnCountry preference.

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

Identities

Summary description for SoPrincipal.

Declaration
public IEnumerable<ClaimsIdentity> Identities { get; }
Property Value
Type Description
IEnumerable<ClaimsIdentity>

Identity

Identity for the principal

Declaration
public abstract ISoIdentity Identity { get; }
Property Value
Type Description
ISoIdentity

IsPerson

Is this associate a person, and not a resource?

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

IsSaintEnabled

Summary description for SoPrincipal.

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

License

License granted to the site and user.

Declaration
public ProductLicense License { get; }
Property Value
Type Description
ProductLicense

PersonId

Associate's person id

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

RoleDescription

Description (e.g. tooltip) for the users role

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

RoleId

Id of the users role

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

RoleName

Name of the users role

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

RoleType

Type of user.

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

SecondaryGroups

Secondary user groups

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

State

State of the Authorization

Declaration
public AuthorizationState State { get; protected set; }
Property Value
Type Description
AuthorizationState

TimeZone

TimeZone selected by user in Diary. The selection is available only when BaseTzLocation is set (timezone handling ON). Only a few date fields on appointment/recurrencerule are influenced by this setting, see setting. UI uses Defaults.DefaultTimezone preference as initial choice.

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

UserName

UserName on associatetable

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

UserType

Type of user

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

Methods

Authenticate()

Authenticates the Principal

Declaration
public abstract void Authenticate()

CacheKeyExist(String)

Check for key in cache

Declaration
public virtual bool CacheKeyExist(string key)
Parameters
Type Name Description
String key
Returns
Type Description
Boolean

ClearCache()

Clear all items from the session cache;

Declaration
public virtual void ClearCache()

GetAccessToken(String, Boolean)

Create a new access token for a given clientSecret (aka ApplicationToken), including CustSvc session info.

Declaration
public abstract string GetAccessToken(string clientSecret, bool includeCsSession)
Parameters
Type Name Description
String clientSecret

The app's client secret (the application token) - can be null or "" for on-site. Required for online

Boolean includeCsSession

Whether to include CustSvc session details

Returns
Type Description
String

A fresh "8A:xyz.blabla==" access token.

GetCachedItem(String)

Get a value from the session cache.

Declaration
public virtual object GetCachedItem(string key)
Parameters
Type Name Description
String key

Key to the item in the cache.

Returns
Type Description
Object

If there is a valid item in the cache, it is returned. 'null' (VB Nothing) is returned if there is no valid value.

GetFunctionRights()

Get all the functional rights for the user's role.

Declaration
public virtual string[] GetFunctionRights()
Returns
Type Description
String[]

Functional rights for the user's role.

GetGrantedLicenses()

Summary description for SoPrincipal.

Declaration
public List<GrantedModuleLicense> GetGrantedLicenses()
Returns
Type Description
List<GrantedModuleLicense>

GetGrantedLicensesAsString()

Get commaseparated string of granted licenses.

Declaration
public string GetGrantedLicensesAsString()
Returns
Type Description
String

Commaseperated string of granted licenses for current user

GetLicense(String)

Get details of a granted license. Use SoLicenseNames to avoid misspelling.

Declaration
public GrantedModuleLicense GetLicense(string fullName)
Parameters
Type Name Description
String fullName

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

Returns
Type Description
GrantedModuleLicense

Details of a granted license. Null (VB Nothing) is returned if the named license has not been granted.

GetLicense(String, String)

Get details of a granted license. Use SoLicenseNames to avoid misspelling.

Declaration
public GrantedModuleLicense GetLicense(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
GrantedModuleLicense

Details of a granted license. Null (VB Nothing) is returned if the named license has not been granted.

GetPrincipalCarrier()

Private SuperOffice function - do not use! Get the SoPrincipalCarrier from the SoPrincipal

Declaration
public SoPrincipalCarrier GetPrincipalCarrier()
Returns
Type Description
SoPrincipalCarrier

Instance of the SoPrincipalCarrier held by the SoPrincipal.

Remarks

This method is protected with code access security. It is only to be used by SuperOffice!

Exceptions
Type Condition
SecurityException

Thrown if the caller's if the callstack contains assemblies not signed with the SuperOffice strong name. For SuperOffice developers: When calling this method, it is important that an assert on the SoStrongName permission is called prior to accessing this method; in order to prevent additional stack walcing beyond the calling method.

GetSafeCredentials()

Obtain a set of credentials that are safe to use accross mix-mode authentication scenarios.

Declaration
public abstract SoCredentials GetSafeCredentials()
Returns
Type Description
SoCredentials

Credentials that are safe to use accross mix-mode authentication scenarios

HasFunctionRight(String)

Check if the user's role has the functional right. Use FunctionRightStrings to avoid misspelling.

Declaration
public virtual bool HasFunctionRight(string functionRightName)
Parameters
Type Name Description
String functionRightName

Name of the functional right as returned from the helper class FunctionRightStrings.

Returns
Type Description
Boolean

True if the user's role has this right, otherwise false.

HasLicense(String)

Check if the user has been granted the provided licens.e Use SoLicenseNames to avoid misspelling.

Declaration
public virtual bool HasLicense(string fullName)
Parameters
Type Name Description
String fullName

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

Returns
Type Description
Boolean

False is returned if this license has not been granted.

HasLicense(String, String)

Check if the user has been granted the provided license. Use SoLicenseNames to avoid misspelling.

Declaration
public virtual bool HasLicense(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
Boolean

False is returned if this license has not been granted.

IsInCompany(Int32)

Is the accociate a person in this company

Declaration
public virtual bool IsInCompany(int contactId)
Parameters
Type Name Description
Int32 contactId

ContactId of the company to check for.

Returns
Type Description
Boolean

True if the corrent principal is a person in this company.

IsInProject(Int32)

Is the principal member of the project.

Declaration
public virtual bool IsInProject(int projectId)
Parameters
Type Name Description
Int32 projectId

ProjectId of the project to check that the principal is a member of

Returns
Type Description
Boolean

True if the principal is membor of the given project.

IsInRole(String)

Is the principal (e.g. user) in the given role.

Declaration
public virtual bool IsInRole(string role)
Parameters
Type Name Description
String role

The role to check if the user is a member of

Returns
Type Description
Boolean

True if the user is member for this role

IsInSameCompany(Int32)

Is the associate a person in the same company as the given associate

Declaration
public virtual bool IsInSameCompany(int associateId)
Parameters
Type Name Description
Int32 associateId

Asssociate id of the person to compare to.

Returns
Type Description
Boolean

True if they are in the same company.

IsInSameGroup(Int32)

Is the associate in the same usergroup as the principal.

Declaration
public virtual bool IsInSameGroup(int associateId)
Parameters
Type Name Description
Int32 associateId

AssociateId of the identity to compare to.

Returns
Type Description
Boolean

True if the associate is in the suame usergroup as the principal.

RemoveCachedItem(String)

Deletes a cached value from the session cache

Declaration
public virtual void RemoveCachedItem(string key)
Parameters
Type Name Description
String key

Key to the item in the cache

SetAssociatePassword(String)

Summary description for SoPrincipal.

Declaration
protected void SetAssociatePassword(string password)
Parameters
Type Name Description
String password

SetCachedItem(String, Object, Double)

Add a value to the session cache.

Declaration
public virtual void SetCachedItem(string key, object cacheValue, double timeout)
Parameters
Type Name Description
String key

Key to the item.

Object cacheValue

Value of the item

Double timeout

Timeout for the value, in seconds. '0' means that the value is cahced throughout the session.

SetPrincipalCarrier(SoPrincipalCarrier)

Private SuperOffice function - do not use! Set the SoPrincipalCarrier for the SoPrincipal.

Declaration
public void SetPrincipalCarrier(SoPrincipalCarrier principalCarrier)
Parameters
Type Name Description
SoPrincipalCarrier principalCarrier

The SoPrincipalCarrier to assign to the SoPrincipal.

Remarks

This method is protected with code access security. It is only to be used by SuperOffice!

ToString()

Summary description for SoPrincipal.

Declaration
public override string ToString()
Returns
Type Description
String

TryGetCachedItem(String, out Object)

Summary description for SoPrincipal.

Declaration
public virtual bool TryGetCachedItem(string key, out object item)
Parameters
Type Name Description
String key
Object item
Returns
Type Description
Boolean

Implements

System.Security.Principal.IPrincipal

Extension Methods

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