Class SentryPreferenceCache
Caches preferences in the "Rights-*" section. Cache is manually flushed when SoPreference sets a "Rights-" preference value, or every 10 minutes.
Inherited Members
Namespace: SuperOffice.CRM.Security
Assembly: SoDataBase.dll
Syntax
[CacheV2("Database", 0)]
public class SentryPreferenceCache : CacheBaseV2, IFlushableV2, IDisposable
Constructors
SentryPreferenceCache()
Caches preferences in the "Rights-*" section. Cache is manually flushed when SoPreference sets a "Rights-" preference value, or every 10 minutes.
Declaration
public SentryPreferenceCache()
Properties
TableNames
Caches preferences in the "Rights-*" section. Cache is manually flushed when SoPreference sets a "Rights-" preference value, or every 10 minutes.
Declaration
protected override IEnumerable<string> TableNames { get; }
Property Value
Type | Description |
---|---|
IEnumerable<string> |
Overrides
Remarks
Although we read from table "UserPreference" we shouldn't add it to TableNames for this cache because there's too much traffic on that table. Invoking flush on every table change would be expensive, so we implement a custom IsCacheInvalidated(string, int, PrivateSave) to only trigger when it sees Rights-* changes or updates to known sentry preferences.
Methods
GetCurrent()
Caches preferences in the "Rights-*" section. Cache is manually flushed when SoPreference sets a "Rights-" preference value, or every 10 minutes.
Declaration
public static SentryPreferenceCache GetCurrent()
Returns
Type | Description |
---|---|
SentryPreferenceCache |
GetFieldRights(int, int, int)
Get the field rights from the preference system for a user.
Declaration
public FieldRight GetFieldRights(int sentryTable, int fieldId, int rowId)
Parameters
Type | Name | Description |
---|---|---|
int | sentryTable | TableNumber for the main sentry table. |
int | fieldId | FieldNumber (TableNumber [left shift] 8 + FieldNumber) for the field to look up |
int | rowId | Primary key of the row. 0 if the row is new. |
Returns
Type | Description |
---|---|
FieldRight | Field rights from the preference system. |
GetFieldRights(int, int, int, SoPrincipal)
Get the field rights from the preference system for a user.
Declaration
public FieldRight GetFieldRights(int sentryTable, int fieldId, int rowId, SoPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
int | sentryTable | TableNumber for the main sentry table. |
int | fieldId | FieldNumber (TableNumber [left shift] 8 + FieldNumber) for the field to look up |
int | rowId | Primary key of the row. 0 if the row is new. |
SoPrincipal | principal | Providing the princpial for optimization |
Returns
Type | Description |
---|---|
FieldRight | Field rights from the preference system. |
GetFieldRights(int, int, int, int, int)
Get the field rights from the preference system for a user.
Declaration
public FieldRight GetFieldRights(int sentryTable, int fieldId, int associateId, int groupId, int rowId)
Parameters
Type | Name | Description |
---|---|---|
int | sentryTable | TableNumber for the main sentry table. |
int | fieldId | FieldNumber (TableNumber [left shift] 8 + FieldNumber) for the field to look up |
int | associateId | AssociateId for the user to get the rights for. |
int | groupId | Group id for the user to get the rights for |
int | rowId | Primary key of the row. 0 if the row is new. |
Returns
Type | Description |
---|---|
FieldRight | Field rights from the preference system. |
GetTableRights(int, int)
Get table rights from the preference system for the logged in user.
Declaration
public TableRight GetTableRights(int sentryTable, int rowId)
Parameters
Type | Name | Description |
---|---|---|
int | sentryTable | TableNumber for the main sentry table. |
int | rowId | Primary key of the row. 0 if the row is new. |
Returns
Type | Description |
---|---|
TableRight | Table rights from the preference system. |
GetTableRights(int, int, int, int)
Get table rights from the preference system for a user.
Declaration
public TableRight GetTableRights(int sentryTable, int associateId, int groupId, int rowId)
Parameters
Type | Name | Description |
---|---|---|
int | sentryTable | TableNumber for the main sentry table. |
int | associateId | AssociateId for the user to get the rights for. |
int | groupId | Group id for the user to get the rights for |
int | rowId | Primary key of the row. 0 if the row is new. |
Returns
Type | Description |
---|---|
TableRight | Table rights from the preference system. |
IsCacheInvalidated(string, int, PrivateSave)
Determine if cache was actually invalidated by this change - much of the traffic on the userpreference table does not affect us here
Declaration
protected override bool IsCacheInvalidated(string tableName, int primaryKey, PrivateSave save)
Parameters
Type | Name | Description |
---|---|---|
string | tableName | |
int | primaryKey | |
PrivateSave | save |
Returns
Type | Description |
---|---|
bool |
Overrides
Remarks
This cache is invalidated if one of the previously known rows is deleted, OR if a row with a section name starting with Rights- is created or updated.
OnLoad()
Caches preferences in the "Rights-*" section. Cache is manually flushed when SoPreference sets a "Rights-" preference value, or every 10 minutes.
Declaration
protected override void OnLoad()