Class PersonSentry
PersonSentry guards Person entities and their component rows. The PersonSentry applies to the following classes: Person, PersonRow, AddressRow, PhoneRow, EmailRow, UrlRow, InterestRows, UdefLarge and UdefSmall
Implements
Inherited Members
Namespace: SuperOffice.CRM.Security
Assembly: SoDataBase.dll
Syntax
public class PersonSentry : RoleRightsSentry<PersonTableInfo>, ICloneable
Remarks
The Person row automatically creates a sentry, because Person 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 will ask the Person sentry about its permissions.
The person sentry uses the person.associate/group fields to determine ownership. If these fields are zero, then the person's contact is used to determine the owner.
Examples
PersonRow p = new PersonRow.IdxPersonId(1234); TextRow t = new TextRow.IdxTextId( c.TextId ); t.Sentries.Add( p.Sentries );
Constructors
PersonSentry(PersonTableInfo)
Create a Person sentry.
Declaration
public PersonSentry(PersonTableInfo personTableInfo)
Parameters
Type | Name | Description |
---|---|---|
PersonTableInfo | personTableInfo | Instance of TableInfo for the person that the sentry represents. |
Remarks
The Person row automatically creates a sentry, because Person 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 will ask the Person sentry about its permissions.
The person sentry uses the person.associate/group fields to determine ownership. If these fields are zero, then the person's contact is used to determine the owner.
PersonSentry(PersonTableInfo, ContactTableInfo)
Create a Person sentry.
Declaration
public PersonSentry(PersonTableInfo personTableInfo, ContactTableInfo contactTableInfo)
Parameters
Type | Name | Description |
---|---|---|
PersonTableInfo | personTableInfo | Instance of TableInfo for the person that the sentry represents. |
ContactTableInfo | contactTableInfo | Instance of TableInfo used to get additional fields from the contact. |
Remarks
The Person row automatically creates a sentry, because Person 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 will ask the Person sentry about its permissions.
The person sentry uses the person.associate/group fields to determine ownership. If these fields are zero, then the person's contact is used to determine the owner.
PersonSentry(PersonTableInfo, ISoDataLookup)
Create a Person sentry for a particular Person row. The row's associate_id will control the user's permissions with respect to this row.
Declaration
public PersonSentry(PersonTableInfo personTableInfo, ISoDataLookup lookup)
Parameters
Type | Name | Description |
---|---|---|
PersonTableInfo | personTableInfo | Instance of TableInfo for the person that the sentry represents. |
ISoDataLookup | lookup |
Remarks
The Person row automatically creates a sentry, because Person 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 will ask the Person sentry about its permissions.
The person sentry uses the person.associate/group fields to determine ownership. If these fields are zero, then the person's contact is used to determine the owner.
Properties
AssociateId
Person's associate id - returns the person's associate id if it is defined. If the person.associd = 0, then it returns the contact.associd - which should have been added to the query Returns the current user's id if the record contains 0.
Declaration
public override int AssociateId { get; }
Property Value
Type | Description |
---|---|
int |
Overrides
Remarks
The Person row automatically creates a sentry, because Person 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 will ask the Person sentry about its permissions.
The person sentry uses the person.associate/group fields to determine ownership. If these fields are zero, then the person's contact is used to determine the owner.
ContactTableInfo
TableInfo for the contact table related to the person's contactId.
Declaration
public ContactTableInfo ContactTableInfo { get; set; }
Property Value
Type | Description |
---|---|
ContactTableInfo |
Remarks
The Person row automatically creates a sentry, because Person 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 will ask the Person sentry about its permissions.
The person sentry uses the person.associate/group fields to determine ownership. If these fields are zero, then the person's contact is used to determine the owner.
GroupId
Person's Group id. Returns the Contact.GroupId if Person.GroupId = 0. Returns the associate's GroupId if Contact.GroupId = 0 as well.
Declaration
public override int GroupId { get; }
Property Value
Type | Description |
---|---|
int |
Overrides
Remarks
The Person row automatically creates a sentry, because Person 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 will ask the Person sentry about its permissions.
The person sentry uses the person.associate/group fields to determine ownership. If these fields are zero, then the person's contact is used to determine the owner.
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
Remarks
The Person row automatically creates a sentry, because Person 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 will ask the Person sentry about its permissions.
The person sentry uses the person.associate/group fields to determine ownership. If these fields are zero, then the person's contact is used to determine the owner.
IsNew
Is the row saved to teh database (persisted primary key == 0)
Declaration
public override bool IsNew { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
Remarks
The Person row automatically creates a sentry, because Person 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 will ask the Person sentry about its permissions.
The person sentry uses the person.associate/group fields to determine ownership. If these fields are zero, then the person's contact is used to determine the owner.
MainTable
Return Person table info.
Declaration
protected PersonTableInfo MainTable { get; }
Property Value
Type | Description |
---|---|
PersonTableInfo |
Remarks
The Person row automatically creates a sentry, because Person 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 will ask the Person sentry about its permissions.
The person sentry uses the person.associate/group fields to determine ownership. If these fields are zero, then the person's contact is used to determine the owner.
RegisteredAssociateIdField
The field that holds the associate id of the user first creating the item.
Declaration
public override FieldInfo RegisteredAssociateIdField { get; }
Property Value
Type | Description |
---|---|
FieldInfo |
Overrides
Remarks
The Person row automatically creates a sentry, because Person 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 will ask the Person sentry about its permissions.
The person sentry uses the person.associate/group fields to determine ownership. If these fields are zero, then the person's contact is used to determine the owner.
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
Remarks
The Person row automatically creates a sentry, because Person 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 will ask the Person sentry about its permissions.
The person sentry uses the person.associate/group fields to determine ownership. If these fields are zero, then the person's contact is used to determine the owner.
RowId
Should return a Person.Person_id
Declaration
public override int RowId { get; }
Property Value
Type | Description |
---|---|
int |
Overrides
Remarks
The Person row automatically creates a sentry, because Person 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 will ask the Person sentry about its permissions.
The person sentry uses the person.associate/group fields to determine ownership. If these fields are zero, then the person's contact is used to determine the owner.
Methods
ComputeFieldRights()
Remove write rights to retired field if person is an associate.
Declaration
protected override void ComputeFieldRights()
Overrides
Remarks
The Person row automatically creates a sentry, because Person 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 will ask the Person sentry about its permissions.
The person sentry uses the person.associate/group fields to determine ownership. If these fields are zero, then the person's contact is used to determine the owner.
ComputeTableRights()
Computes table rights for Person tables. Deny delete to Persons which are associates.
Declaration
protected override void ComputeTableRights()
Overrides
Remarks
The Person row automatically creates a sentry, because Person 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 will ask the Person sentry about its permissions.
The person sentry uses the person.associate/group fields to determine ownership. If these fields are zero, then the person's contact is used to determine the owner.
GetRowSentry()
Get a copy of the Sentry holding the same field and table infos.
Declaration
public override Sentry GetRowSentry()
Returns
Type | Description |
---|---|
Sentry | Copy of the sentry. |
Overrides
Remarks
The Person row automatically creates a sentry, because Person 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 will ask the Person sentry about its permissions.
The person sentry uses the person.associate/group fields to determine ownership. If these fields are zero, then the person's contact is used to determine the owner.
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 Person row automatically creates a sentry, because Person 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 will ask the Person sentry about its permissions.
The person sentry uses the person.associate/group fields to determine ownership. If these fields are zero, then the person's contact is used to determine the owner.