Connectivity Software User's Guide and Reference
GetIsInRoleObservable Method



OpcLabs.BaseLibPrimitives Assembly > OpcLabs.BaseLib.Security.Subject Namespace > ISecurityPrincipal Interface : GetIsInRoleObservable Method
The security role to check.

The value of this parameter cannot be null (Nothing in Visual Basic).

Gets an observable that indicates whether the principal is in the specified security role.
Syntax
'Declaration
 
<JetBrains.Annotations.NotNullAttribute()>
Function GetIsInRoleObservable( _
   ByVal securityRole As ISecurityRole _
) As IObservable(Of Boolean)
'Usage
 
Dim instance As ISecurityPrincipal
Dim securityRole As ISecurityRole
Dim value As IObservable(Of Boolean)
 
value = instance.GetIsInRoleObservable(securityRole)
[JetBrains.Annotations.NotNull()]
IObservable<bool> GetIsInRoleObservable( 
   ISecurityRole securityRole
)
[JetBrains.Annotations.NotNull()]
IObservable<bool>^ GetIsInRoleObservable( 
   ISecurityRole^ securityRole
) 

Parameters

securityRole
The security role to check.

The value of this parameter cannot be null (Nothing in Visual Basic).

Return Value

An observable that emits true when the principal is in the role; otherwise, false.

This method never returns null (Nothing in Visual Basic).

Exceptions
ExceptionDescription

A null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.

This is a usage error, i.e. it will never occur (the exception will not be thrown) in a correctly written program. Your code should not catch this exception.

Remarks

The observables are never completed, and they are never removed from the security principal. This is by design. It is expected that the observables will be used for the lifetime of the security principal anyway.

Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also