Class TicketSentry
TicketSentry guards Ticket entities and their component rows.
The TicketSentry applies to the following classes: Ticket, TicketRow, TextRow, UDLarge + UDSmall
Implements
Inherited Members
Namespace: SuperOffice.CRM.Security
Assembly: SoDataBase.dll
Syntax
public class TicketSentry : Sentry<TicketTableInfo>, ICloneable
Remarks
The Ticket row automatically creates a sentry, because Ticket 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 Ticket sentry about its permissions.
Examples
TicketRow a = new TicketRow.IdxTicketId(1234); TextRow t = new TextRow.IdxTextId( a.TextId, a.Sentries );
Constructors
TicketSentry(TicketTableInfo)
Create a Ticket sentry.
Declaration
public TicketSentry(TicketTableInfo ticketTableInfo)
Parameters
Type | Name | Description |
---|---|---|
TicketTableInfo | ticketTableInfo |
Remarks
The Ticket row automatically creates a sentry, because Ticket 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 Ticket sentry about its permissions.
TicketSentry(TicketTableInfo, ISoDataLookup)
Create a Ticket sentry for a particular Ticket row. The row's associate_id will control the user's permissions with respect to this row.
Declaration
public TicketSentry(TicketTableInfo ticketTableInfo, ISoDataLookup lookup)
Parameters
Type | Name | Description |
---|---|---|
TicketTableInfo | ticketTableInfo | |
ISoDataLookup | lookup |
Remarks
The Ticket row automatically creates a sentry, because Ticket 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 Ticket sentry about its permissions.
Properties
AssociateId
Ticket.ownedBy.associate id
Declaration
public override int AssociateId { get; }
Property Value
Type | Description |
---|---|
int |
Overrides
Remarks
The Ticket row automatically creates a sentry, because Ticket 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 Ticket sentry about its permissions.
GroupId
returns Ticket.ownedBy.associate.GroupIdx
Declaration
public override int GroupId { get; }
Property Value
Type | Description |
---|---|
int |
Overrides
Remarks
The Ticket row automatically creates a sentry, because Ticket 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 Ticket 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
Remarks
The Ticket row automatically creates a sentry, because Ticket 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 Ticket 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
Remarks
The Ticket row automatically creates a sentry, because Ticket 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 Ticket sentry about its permissions.
RegisteredAssociateId
Who created the item.
Declaration
public override int RegisteredAssociateId { get; }
Property Value
Type | Description |
---|---|
int |
Overrides
Remarks
The Ticket row automatically creates a sentry, because Ticket 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 Ticket sentry about its permissions.
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 Ticket row automatically creates a sentry, because Ticket 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 Ticket 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
Remarks
The Ticket row automatically creates a sentry, because Ticket 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 Ticket sentry about its permissions.
RowId
Should return a Ticket.Ticket_id
Declaration
public override int RowId { get; }
Property Value
Type | Description |
---|---|
int |
Overrides
Remarks
The Ticket row automatically creates a sentry, because Ticket 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 Ticket sentry about its permissions.
Methods
ComputeDerivedTableRights()
Set correct rights on derived tables (tables we're responsible for, that are not the ticket table)
Declaration
protected override void ComputeDerivedTableRights()
Overrides
Remarks
The Ticket row automatically creates a sentry, because Ticket 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 Ticket sentry about its permissions.
ComputeFieldRights()
Any special field right calculations go here
Declaration
protected override void ComputeFieldRights()
Overrides
Remarks
If we ever decide that ej_message:None means that ticket.numMessages should be masked, then this is the place to do that
ComputeTableRights()
Computes table rights for Ticket tables.
Declaration
protected override void ComputeTableRights()
Overrides
Remarks
The actual rights impact the ticket and ej_message tables, primarily. The rights calculations are performed three times to catch the differences between List/View/Edit intents (a concept unusual to NetServer); those results are then mapped onto table rights
EvaluateTicketRights(TableRight, int, int, int, DateTime, int, TicketIntent)
The ticket rights calculation, available as a static method, with selectable intent. Sentry looks at all three and maps them to table rights
Declaration
public static (ETableRight right, string reason) EvaluateTicketRights(TableRight initialRight, int rowid, int ownedBy, int category, DateTime createdAt, int createdBy, TicketSentry.TicketIntent intent = TicketIntent.List)
Parameters
Type | Name | Description |
---|---|---|
TableRight | initialRight | Rights from previous evaluations, for instance the standard Sentry, or just Full |
int | rowid | Primary key of ticket row |
int | ownedBy | OwnedBy field of ticket row (ejuser, magic value 1 if unassigned) |
int | category | Category of ticket row |
DateTime | createdAt | |
int | createdBy | |
TicketSentry.TicketIntent | intent | What is the intended use, which affects the calculations |
Returns
Type | Description |
---|---|
(ETableRight right, string reason) |
Remarks
The Ticket row automatically creates a sentry, because Ticket 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 Ticket 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
Remarks
The Ticket row automatically creates a sentry, because Ticket 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 Ticket 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 Ticket row automatically creates a sentry, because Ticket 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 Ticket sentry about its permissions.