Show / Hide Table of Contents

Class ContactSentry

ContactSentry guards Contact entities and their component rows. The ContactSentry applies to the following classes: Contact, ContactRow, TextRow, AddressRow, PhoneRow, EmailRow, UrlRow, InterestRows, UdefLarge and UdefSmall

Inheritance
object
Sentry
Sentry<ContactTableInfo>
RoleRightsSentry<ContactTableInfo>
ContactSentry
Implements
ICloneable
Inherited Members
RoleRightsSentry<ContactTableInfo>.GetMainRight()
RoleRightsSentry<ContactTableInfo>.RoleTableRights
RoleRightsSentry<ContactTableInfo>.VisibleForRights
Sentry<ContactTableInfo>.GetInterestingFieldsInTable(TableInfo)
Sentry<ContactTableInfo>.InterestedInAnyInstanceOf<T>()
Sentry<ContactTableInfo>.ComputeDerivedTableRights()
Sentry<ContactTableInfo>.SuperComputeDerivedTableRights()
Sentry<ContactTableInfo>.ComputeDerivedTableRight(TableRight)
Sentry<ContactTableInfo>.SuperComputeTableRights()
Sentry<ContactTableInfo>.AddInterestingTables(params TableInfo[])
Sentry<ContactTableInfo>.ComputeLicenseExpiration()
Sentry<ContactTableInfo>.SuperComputeFieldRights()
Sentry<ContactTableInfo>.CanCoverTable(TableInfo)
Sentry<ContactTableInfo>.IsTableCovered(TableInfo)
Sentry<ContactTableInfo>.SetAllTableRights(ETableRight, string)
Sentry<ContactTableInfo>.GetOwnerFieldRight()
Sentry<ContactTableInfo>.AnalyzeQuery(PrivateSelect)
Sentry<ContactTableInfo>.ToString()
Sentry<ContactTableInfo>.InterestingFields
Sentry<ContactTableInfo>.SentryQueryInfo
Sentry.kTableRights
Sentry.kFieldRights
Sentry._tableRights
Sentry._fieldRights
Sentry._lookups
Sentry.DemandPlugins()
Sentry.CreateSentry(TableInfo)
Sentry.CreateSentries(Select)
Sentry.BeginIgnoreSentry()
Sentry.BeginIgnoreRowSentry()
Sentry.IgnoreRowSentry()
Sentry.IgnoreSentry()
Sentry.IterateLookups(LookupCollection)
Sentry.GetIntField(params FieldInfo[])
Sentry.GetPersistedIntField(params FieldInfo[])
Sentry.GetIsGhostField(FieldInfo)
Sentry.GetDateTimeField(FieldInfo)
Sentry.GetStringField(FieldInfo)
Sentry.ClearRights()
Sentry.GetRecordOwnershipIndex(int, int)
Sentry.MapTableToFieldRights(TableInfo, TableRight, FieldInfo[])
Sentry.MakeFieldFromTableRight(TableRight)
Sentry.MakeFieldFromTableRight(TableRight, ETableRight)
Sentry.MakeFieldFromTableRight(ETableRight)
Sentry.GetTableRight(TableInfo)
Sentry.GetFieldRight(FieldInfo)
Sentry.CanTableDo(TableInfo, ETableRight, bool)
Sentry.CanFieldDo(FieldInfo, EFieldRight, bool)
Sentry.IsFieldCovered(FieldInfo)
Sentry.GetGroupFromAssociate(int)
Sentry.IsContactDatabaseOwner(int)
Sentry.IsContactEmployeeUserOwner(int)
Sentry.IsContactSatelliteOwner(int)
Sentry.IsContactLicenseOwner(int)
Sentry.IsContactCurrentDatabaseOwner(int)
Sentry.IsPersonAssociate(int, bool)
Sentry.IsAssociatesOwnerContact(int, int)
Sentry.Lookups
Sentry.Parent
Sentry.Registered
Sentry.RegisteredAssociateId
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOffice.CRM.Security
Assembly: SoDataBase.dll
Syntax
public class ContactSentry : RoleRightsSentry<ContactTableInfo>, ICloneable
Remarks

The contact row automatically creates a sentry, because contact is also an RDB Entity. The text row does not create a sentry because it does not know which entity it belongs to, so we have to give it a sentry to use. The text row asks the contact sentry about its permissions.

Examples

ContactRow c = new ContactRow.IdxContactId(1234); TextRow t = new TextRow.IdxTextId( c.TextId, c.Sentries );

Constructors

ContactSentry(ContactTableInfo)

Create a contact sentry.

Declaration
public ContactSentry(ContactTableInfo contactTableInfo)
Parameters
Type Name Description
ContactTableInfo contactTableInfo
Remarks

The contact row automatically creates a sentry, because contact is also an RDB Entity. The text row does not create a sentry because it does not know which entity it belongs to, so we have to give it a sentry to use. The text row asks the contact sentry about its permissions.

ContactSentry(ContactTableInfo, ISoDataLookup)

Create a contact sentry for a particular contact row. The row's associate_id will control the user's permissions with respect to this row.

Declaration
public ContactSentry(ContactTableInfo contactTableInfo, ISoDataLookup lookup)
Parameters
Type Name Description
ContactTableInfo contactTableInfo
ISoDataLookup lookup
Remarks

The contact row automatically creates a sentry, because contact is also an RDB Entity. The text row does not create a sentry because it does not know which entity it belongs to, so we have to give it a sentry to use. The text row asks the contact sentry about its permissions.

Properties

AssociateId

Returns Contact.Associate_id. Returns the current user's associate-id if the field is empty.

Declaration
public override int AssociateId { get; }
Property Value
Type Description
int
Overrides
Sentry.AssociateId
Remarks

The contact row automatically creates a sentry, because contact is also an RDB Entity. The text row does not create a sentry because it does not know which entity it belongs to, so we have to give it a sentry to use. The text row asks the contact sentry about its permissions.

GroupId

Contact.Group_id -- the primary group of the AssociateId at the time the associate was set. Returns the associate's primary group id if not set in the record.

Declaration
public override int GroupId { get; }
Property Value
Type Description
int
Overrides
Sentry.GroupId
Remarks

The contact row automatically creates a sentry, because contact is also an RDB Entity. The text row does not create a sentry because it does not know which entity it belongs to, so we have to give it a sentry to use. The text row asks the contact sentry about its permissions.

IsGhostRow

Returns whether the primary key is a ghost field (i.e., we're looking at a nonexistent record, as opposed to just looking at a new one)

Declaration
public override bool IsGhostRow { get; }
Property Value
Type Description
bool
Overrides
Sentry.IsGhostRow
Remarks

The contact row automatically creates a sentry, because contact is also an RDB Entity. The text row does not create a sentry because it does not know which entity it belongs to, so we have to give it a sentry to use. The text row asks the contact sentry about its permissions.

IsNew

Is the row saved to teh database (persisted primary key == 0)

Declaration
public override bool IsNew { get; }
Property Value
Type Description
bool
Overrides
Sentry.IsNew
Remarks

The contact row automatically creates a sentry, because contact is also an RDB Entity. The text row does not create a sentry because it does not know which entity it belongs to, so we have to give it a sentry to use. The text row asks the contact sentry about its permissions.

MainTable

Return Contact table info.

Declaration
protected ContactTableInfo MainTable { get; }
Property Value
Type Description
ContactTableInfo
Remarks

The contact row automatically creates a sentry, because contact is also an RDB Entity. The text row does not create a sentry because it does not know which entity it belongs to, so we have to give it a sentry to use. The text row asks the contact sentry about its permissions.

RegisteredAssociateIdField

The field that holds the associate id of teh user first creating the item.

Declaration
public override FieldInfo RegisteredAssociateIdField { get; }
Property Value
Type Description
FieldInfo
Overrides
Sentry.RegisteredAssociateIdField
Remarks

The contact row automatically creates a sentry, because contact is also an RDB Entity. The text row does not create a sentry because it does not know which entity it belongs to, so we have to give it a sentry to use. The text row asks the contact sentry about its permissions.

RegisteredField

The field that holds information about when the item was first created.

Declaration
public override FieldInfo RegisteredField { get; }
Property Value
Type Description
FieldInfo
Overrides
Sentry.RegisteredField
Remarks

The contact row automatically creates a sentry, because contact is also an RDB Entity. The text row does not create a sentry because it does not know which entity it belongs to, so we have to give it a sentry to use. The text row asks the contact sentry about its permissions.

RowId

Should return a contact.contact_id

Declaration
public override int RowId { get; }
Property Value
Type Description
int
Overrides
Sentry.RowId
Remarks

The contact row automatically creates a sentry, because contact is also an RDB Entity. The text row does not create a sentry because it does not know which entity it belongs to, so we have to give it a sentry to use. The text row asks the contact sentry about its permissions.

Methods

ComputeFieldRights()

Computes the field rights based on the associate and group info in the row. The sub-class will handle its particular special cases here. This function is called from SuperComputeFieldRights() which does the standard calculations first, then allows this function to add any special restrictions afterwards.

This function computes a map of rights to all fields that can be determined, both on the primary table and any dependent tables. Each field has an entry in the map, which contains a bitwise OR of all rights the principal user has to that field. If the user has no update rights to a field, the corresponding GUI control should be read-only. If the user has no Read rights to a field, its value should not be shown at all. In the case of write but not read rights, the sanity of the underlying rules should be questioned.

Declaration
protected override void ComputeFieldRights()
Overrides
Sentry<ContactTableInfo>.ComputeFieldRights()
Remarks

Place the results of the computation in the _fieldRights member.

ComputeTableRights()

Computes table rights for Contact tables. Deny delete to contacts which own associates or satellites. Deny full update rights to license owner (name field is sacred).

Declaration
protected override void ComputeTableRights()
Overrides
Sentry<ContactTableInfo>.ComputeTableRights()
Remarks

The contact row automatically creates a sentry, because contact is also an RDB Entity. The text row does not create a sentry because it does not know which entity it belongs to, so we have to give it a sentry to use. The text row asks the contact sentry about its permissions.

GetRecordOwnershipIndex()

Permit updates to someone else regardless of permissions for the other party.

Declaration
public override EOwnershipIndex GetRecordOwnershipIndex()
Returns
Type Description
EOwnershipIndex

Minimum ownership index taking persisted AssociateId into account.

Overrides
Sentry.GetRecordOwnershipIndex()
Remarks

The contact row automatically creates a sentry, because contact is also an RDB Entity. The text row does not create a sentry because it does not know which entity it belongs to, so we have to give it a sentry to use. The text row asks the contact sentry about its permissions.

GetRowSentry()

Create a copy of the Sentry holding the right instances of table and field infos.

Declaration
public override Sentry GetRowSentry()
Returns
Type Description
Sentry

New instance of the Sentry.

Overrides
Sentry.GetRowSentry()
Remarks

The contact row automatically creates a sentry, because contact is also an RDB Entity. The text row does not create a sentry because it does not know which entity it belongs to, so we have to give it a sentry to use. The text row asks the contact sentry about its permissions.

GetTableInfoFromQuery<TargetTableInfo>()

Get tables of the given type from our query

Declaration
protected List<TargetTableInfo> GetTableInfoFromQuery<TargetTableInfo>() where TargetTableInfo : TableInfo
Returns
Type Description
List<TargetTableInfo>

List of tableinfos of the given type, from the query

Type Parameters
Name Description
TargetTableInfo

Type of table to look for

Remarks

The contact row automatically creates a sentry, because contact is also an RDB Entity. The text row does not create a sentry because it does not know which entity it belongs to, so we have to give it a sentry to use. The text row asks the contact sentry about its permissions.

Implements

ICloneable

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