VideoOS.Platform.UserContext Class Reference

This class is used for stand alone applications and services that need to handle multiple users logging in to the same set of server(s).
Some functions and methods are required to be called though this class instead of the usual Configuration.Instance.SomeMethod. More...

Public Member Functions

void AddLoginSettings (LoginSettings loginSettings)
 Add a LoginSetting to the cache. The cache holds information for logging in to all known servers. A plugin can also save it's own server side login, if it choose to. When working through the normal EnvironmentManager and Configuration classes, a plugin should not add any Milestone servers to this list, it is done automatically.
 
void Clear ()
 Clear the entire cache.
 
LoginSettings GetLoginSettings (FQID fqid)
 Get one specific LoginSetting. The lookup will look for a login server id in the FQID.ServerId.Id, and all its parents. This method should be used when the Item is a camera, audio or any other single device.

 
LoginSettings GetLoginSettings (Guid serverGuid)
 Get one specific LoginSetting, indexed by Guid. Please note that before logon and configuration has been received from the server side, the Guid may not be filled. (It is then Guid.Empty) Note: It is recommended to use the FQID version whenever possible.
 
LoginSettings GetLoginSettings (ServerId serverId)
 Get one specific LoginSetting, by use of different information in the ServerId. The lookup will try the to match the login settings by both Guid and a normalized Host from the Uri. Note: It is recommended to use the FQID version whenever possible.
 
LoginSettings GetLoginSettings (String hostName, int port=0)
 Get one specific LoginSetting. The lookup will try the to match the login settings by a normalized Host from the Uri.
 
NetworkCredential GetNetworkCredential (ServerId serverId)
 Returns the NetworkCredential used for connecting to a specific server.
If no LoginSettings is available for the given ServerId, then the EnvironmentManager.Instance.LoginNetworkCredential is returned.
 
void RemoveLoginSettings (LoginSettings loginSettings)
 Remove a specific LoginSettings from the cache. Please only do this when all other references to the LoginSettings are gone. This method should only be used by internal MIP abstraction layers.
 
bool SetPrivacyMaskLifted (bool liftMask)
 Sets the privacy mask on or off.
 
 UserContext ()
 Used internally within .Net library (Internal use only)
 

Public Attributes

Guid InstanceGuid = Guid.NewGuid()
 Identify this specific instance.
 
EventHandler PrivacyMaskLiftChanged = delegate { }
 Used internally to indicate when privacy mask lifted flag has changed.
 

Properties

String ClientType [get, set]
 Used internally for client type checking.
 
Configuration Configuration [get, set]
 Used for accessing the configuration relevant for the user in this context.
 
CredentialCache CredentialCache [get, set]
 The credentials for this user.
 
LogClient LogClient [get, set]
 Used for accessing the log client relevant for the user in this context.
 
List< LoginSettingsLoginSettings [get]
 Get the complete list of all LoginSettings.
 
bool PrivacyMaskLifted [get]
 This property indicates the current state for showing liftable privacy masks.

 

Detailed Description

This class is used for stand alone applications and services that need to handle multiple users logging in to the same set of server(s).
Some functions and methods are required to be called though this class instead of the usual Configuration.Instance.SomeMethod.

Constructor & Destructor Documentation

◆ UserContext()

VideoOS.Platform.UserContext.UserContext ( )
inline

Used internally within .Net library (Internal use only)

Member Function Documentation

◆ AddLoginSettings()

void VideoOS.Platform.UserContext.AddLoginSettings ( LoginSettings loginSettings)
inline

Add a LoginSetting to the cache. The cache holds information for logging in to all known servers. A plugin can also save it's own server side login, if it choose to. When working through the normal EnvironmentManager and Configuration classes, a plugin should not add any Milestone servers to this list, it is done automatically.

Parameters
loginSettings

◆ Clear()

void VideoOS.Platform.UserContext.Clear ( )
inline

Clear the entire cache.

◆ GetLoginSettings() [1/4]

LoginSettings VideoOS.Platform.UserContext.GetLoginSettings ( FQID fqid)
inline

Get one specific LoginSetting. The lookup will look for a login server id in the FQID.ServerId.Id, and all its parents. This method should be used when the Item is a camera, audio or any other single device.

Parameters
fqidThe FQID of the Item you need the loginSettings for.
Returns
LoginSettings or null if not found

◆ GetLoginSettings() [2/4]

LoginSettings VideoOS.Platform.UserContext.GetLoginSettings ( Guid serverGuid)
inline

Get one specific LoginSetting, indexed by Guid. Please note that before logon and configuration has been received from the server side, the Guid may not be filled. (It is then Guid.Empty) Note: It is recommended to use the FQID version whenever possible.

Parameters
serverGuid
Returns

◆ GetLoginSettings() [3/4]

LoginSettings VideoOS.Platform.UserContext.GetLoginSettings ( ServerId serverId)
inline

Get one specific LoginSetting, by use of different information in the ServerId. The lookup will try the to match the login settings by both Guid and a normalized Host from the Uri. Note: It is recommended to use the FQID version whenever possible.

Parameters
serverId
Returns
LoginSettings or null if not found

◆ GetLoginSettings() [4/4]

LoginSettings VideoOS.Platform.UserContext.GetLoginSettings ( String hostName,
int port = 0 )
inline

Get one specific LoginSetting. The lookup will try the to match the login settings by a normalized Host from the Uri.

Parameters
hostName
portSpecify for non-default ports
Returns
LoginSettings or null if not found

◆ GetNetworkCredential()

NetworkCredential VideoOS.Platform.UserContext.GetNetworkCredential ( ServerId serverId)
inline

Returns the NetworkCredential used for connecting to a specific server.
If no LoginSettings is available for the given ServerId, then the EnvironmentManager.Instance.LoginNetworkCredential is returned.

Parameters
serverIdThe server to get the NetworkCredentials for
Returns
The found NetworkCredential or null if not found or External user

◆ RemoveLoginSettings()

void VideoOS.Platform.UserContext.RemoveLoginSettings ( LoginSettings loginSettings)
inline

Remove a specific LoginSettings from the cache. Please only do this when all other references to the LoginSettings are gone. This method should only be used by internal MIP abstraction layers.

Parameters
loginSettings

◆ SetPrivacyMaskLifted()

bool VideoOS.Platform.UserContext.SetPrivacyMaskLifted ( bool liftMask)
inline

Sets the privacy mask on or off.

Notice: that user needs to have the correct rights to perform this change.

Parameters
liftMaskTrue when mask should not be shown
Returns
The return value will indicate if the current user has permission to do so.

Member Data Documentation

◆ InstanceGuid

Guid VideoOS.Platform.UserContext.InstanceGuid = Guid.NewGuid()

Identify this specific instance.

◆ PrivacyMaskLiftChanged

EventHandler VideoOS.Platform.UserContext.PrivacyMaskLiftChanged = delegate { }

Used internally to indicate when privacy mask lifted flag has changed.

Property Documentation

◆ ClientType

String VideoOS.Platform.UserContext.ClientType
getset

Used internally for client type checking.

◆ Configuration

Configuration VideoOS.Platform.UserContext.Configuration
getset

Used for accessing the configuration relevant for the user in this context.

◆ CredentialCache

CredentialCache VideoOS.Platform.UserContext.CredentialCache
getset

The credentials for this user.

◆ LogClient

LogClient VideoOS.Platform.UserContext.LogClient
getset

Used for accessing the log client relevant for the user in this context.

◆ LoginSettings

List<LoginSettings> VideoOS.Platform.UserContext.LoginSettings
get

Get the complete list of all LoginSettings.

◆ PrivacyMaskLifted

bool VideoOS.Platform.UserContext.PrivacyMaskLifted
get

This property indicates the current state for showing liftable privacy masks.

The state is set by calling the SetPrivacyMaskLifted method.