Class SentryQueryUpdater
Modifies SELECT queries according to the fields used in the query. For example, if a person row is being read, then a contact row will be outer-joined to provide the contact.associate-id for the sentry. If the appointment table is being searched, then the appointment table is inner-joined with the visible-for table to filter out any hidden/private appointments.
The query updater will analyze the query and automatically add the sentries it considers relevant to the query unless the SoCommand.IsAutoSentry flag is cleared. The query updater uses the sentries attached to the query to modify the query to ensure that all the right fields and restrictions are in place. This ensures that private or unpublished data is filtered out on the server. This plug-in will also throw an SoSentryException if an update violates a sentry's rules.Inherited Members
Namespace: SuperOffice.CRM.Security
Assembly: SoDataBase.dll
Syntax
public sealed class SentryQueryUpdater
Constructors
SentryQueryUpdater(SoCommand)
Create a new sentry filter for the command.
Declaration
public SentryQueryUpdater(SoCommand socommand)
Parameters
Type | Name | Description |
---|---|---|
SoCommand | socommand | Command object with Sentries and the IsAutoSentry property. |
Methods
AfterCommit()
Plugin entry point called after Commit of a transaction enclosing the command
Declaration
public void AfterCommit()
AfterCommitOrAutoCommit()
Plugin entry point called after Commit of a transaction enclosing the command, or after execution of the command if it is not enrolled in any transaction. AfterCommitOrAutoCommit() is called after Commit for commands that are enrolled in a transaction
Declaration
public void AfterCommitOrAutoCommit()
AfterExecute(SqlCommand, SqlCommand, int)
Plugin entry point called after successful execution
Declaration
public void AfterExecute(SqlCommand orgCommand, SqlCommand command, int rowsAffected)
Parameters
Type | Name | Description |
---|---|---|
SqlCommand | orgCommand | |
SqlCommand | command | |
int | rowsAffected | Number of rows affected, as reported by the ExecuteNonQuery db-driver method |
AfterExecuteFailed(SqlCommand, SqlCommand)
Plugin entry point called after execution has failed
Declaration
public void AfterExecuteFailed(SqlCommand orgCommand, SqlCommand command)
Parameters
Type | Name | Description |
---|---|---|
SqlCommand | orgCommand | |
SqlCommand | command |
AfterGenerate(SqlCommand, SqlCommand)
Add sentries to command
Declaration
public void AfterGenerate(SqlCommand orgCommand, SqlCommand command)
Parameters
Type | Name | Description |
---|---|---|
SqlCommand | orgCommand | Original Query object. May be a BatchSave, a Row object or a simple Select, Update, Delete, etc |
SqlCommand | command | Query to be processed. May be BatchSave, Union, simple Select, Update, Delete, etc |
AfterRead(SoCommand, SoDataReader, ref bool)
Plugin entry point called after a row is read, sentry is calculated and before it is returned to the user.
Declaration
public void AfterRead(SoCommand command, SoDataReader reader, ref bool skipRow)
Parameters
Type | Name | Description |
---|---|---|
SoCommand | command | The command ExecuteReader() is called on. |
SoDataReader | reader | The data reader being read from. |
bool | skipRow | Shall this row be skipped or returned to the user. |
AfterRollback()
Plugin entry point called after Rollback of a transaction enclosing the command
Declaration
public void AfterRollback()
BeforeExecute(SqlCommand, SqlCommand)
Check the sentries to see if we are allowed to do what we are trying to do.
Declaration
public void BeforeExecute(SqlCommand orgCommand, SqlCommand command)
Parameters
Type | Name | Description |
---|---|---|
SqlCommand | orgCommand | Original Query object. May be a BatchSave, a Row object or a simple Select, Update, Delete, etc |
SqlCommand | command | Query to be processed. May be BatchSave, Union, simple Select, Update, Delete, etc |
BeforeGenerate(SqlCommand, SqlCommand)
Plugin entry point called before the SQL text is generated from the command.
Declaration
public void BeforeGenerate(SqlCommand orgCommand, SqlCommand command)
Parameters
Type | Name | Description |
---|---|---|
SqlCommand | orgCommand | |
SqlCommand | command |
InitialTransform(SqlCommand, ref SqlCommand)
Handle the BeforeGenerate event, unwind batches and call the template method OnBeforeGenerate, supplied by the derived class.
Declaration
public void InitialTransform(SqlCommand orgCommand, ref SqlCommand command)
Parameters
Type | Name | Description |
---|---|---|
SqlCommand | orgCommand | Original Query object. May be a BatchSave, a Row object or a simple Select, Update, Delete, etc |
SqlCommand | command | Query to be processed. May be BatchSave, Union, simple Select, Update, Delete, etc |