Click or drag to resize

UserRoleCache Class

Represents a secured inter-process cache for a DictionaryTKey, TValue of serialized user role information.
Inheritance Hierarchy
SystemObject
  GSF.IOInterprocessCache
    GSF.SecurityUserRoleCache

Namespace: GSF.Security
Assembly: GSF.Security (in GSF.Security.dll) Version: 2.4.207-beta
Syntax
public class UserRoleCache : InterprocessCache
View Source

The UserRoleCache type exposes the following members.

Constructors
 NameDescription
Public methodUserRoleCache Creates a new instance of the UserRoleCache with the specified number of maximumConcurrentLocks.
Top
Properties
 NameDescription
Public propertyAutoSave Gets or sets flag that determines if InterprocessCache should automatically initiate a save when FileData has been updated.
(Inherited from InterprocessCache)
Public propertyFileData Gets or sets file data for the cache to be saved or that has been loaded.
(Inherited from InterprocessCache)
Public propertyFileName Path and file name for the cache needing inter-process synchronization.
(Inherited from InterprocessCache)
Public propertyItem Gets or sets access roles for given userName.
Public propertyMaximumConcurrentLocks Gets the maximum concurrent reader locks allowed.
(Inherited from InterprocessCache)
Public propertyMaximumRetryAttempts Maximum retry attempts allowed for loading or saving cache file data.
(Inherited from InterprocessCache)
Public propertyReloadOnChange Gets or sets flag that enables system to monitor for changes in FileName and automatically reload FileData.
(Inherited from InterprocessCache)
Public propertyRetryDelayInterval Wait interval, in milliseconds, before retrying load or save of cache file data.
(Inherited from InterprocessCache)
Public propertyUserRoles Gets a copy of the internal user role dictionary.
Top
Methods
 NameDescription
Public methodDispose Releases all the resources used by the InterprocessCache object.
(Inherited from InterprocessCache)
Protected methodDispose(Boolean) Releases the unmanaged resources used by the InterprocessCache object and optionally releases the managed resources.
(Inherited from InterprocessCache)
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalize Releases the unmanaged resources before the InterprocessCache object is reclaimed by GC.
(Inherited from InterprocessCache)
Public methodStatic memberGetCurrentCache Loads the UserRoleCache for the current local user.
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Protected methodHashLoginID Calculates the hash of the userName used as the key for the user roles dictionary.
Public methodLoad Initiates inter-process synchronized cache file load.
(Inherited from InterprocessCache)
Protected methodLoadFileData Handles deserialization of file from disk; virtual method allows customization (e.g., pre-load decryption and/or data merge).
(Overrides InterprocessCacheLoadFileData(FileStream))
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodMergeLeft Merge user roles from another UserRoleCache, local cache taking precedence.
Public methodMergeRight Merge user roles from another UserRoleCache, other cache taking precedence.
Public methodSave Initiates inter-process synchronized save of user role cache.
(Overrides InterprocessCacheSave)
Protected methodSaveFileData Handles serialization of file to disk; virtual method allows customization (e.g., pre-save encryption and/or data merge).
(Overrides InterprocessCacheSaveFileData(FileStream, Byte))
Public methodSaveUserRole Serializes the roles for the given userName into the UserRoleCache.
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Public methodTryGetUserRole Attempts to retrieve access role for given userName.
Public methodWaitForLoad Blocks current thread and waits for any pending load to complete; wait time is RetryDelayInterval * MaximumRetryAttempts.
(Inherited from InterprocessCache)
Public methodWaitForLoad(Int32) Blocks current thread and waits for specified millisecondsTimeout for any pending load to complete.
(Inherited from InterprocessCache)
Public methodWaitForSave Blocks current thread and waits for any pending save to complete; wait time is RetryDelayInterval * MaximumRetryAttempts.
(Inherited from InterprocessCache)
Public methodWaitForSave(Int32) Blocks current thread and waits for specified millisecondsTimeout for any pending save to complete.
(Inherited from InterprocessCache)
Top
Extension Methods
 NameDescription
Public Extension MethodGetEnumValueOrDefault Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Public Extension MethodGetEnumValueOrDefaultT Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Top
Remarks
This is a system cache that contains the role assignments for each user that has logged in successfully. This cache is used to check for changes in role assignments for a user - that is, a role change in the database that may now be different than what is in the current cache. Any kind of role changes are logged as security events in the Windows event log for auditing. Note that this is kept as a separate cache from the AdoSecurityCache since the user role cache is used for auditing and contains information relative to a user's roles at last login.
See Also