# OpcPrincipal Members

> Reference: Represents a user of the server by its OpcIdentity, to which the entries of the access control lists and the access control roles apply.

<dl class="api-definition">
<dt>Type</dt>
<dd><a href="./">OpcPrincipal</a></dd>
<dt>Namespace</dt>
<dd><a href="../namespaces/opc.uafx.server">Opc.UaFx.Server</a></dd>
<dt>Assembly</dt>
<dd>Opc.UaFx.Advanced.dll</dd>
<dt>Package</dt>
<dd>Opc.UaFx.Advanced v2.59.0</dd>
</dl>

## Constructors

### OpcPrincipal

Initializes a new instance of the [OpcPrincipal](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.server.opcprincipal/) class using the `identity` specified.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcPrincipal(OpcIdentity identity)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Sub New(identity As OpcIdentity)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `identity` | [OpcIdentity](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcidentity/) | The [OpcIdentity](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcidentity/) of the principal. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `identity` is a null reference (Nothing in Visual Basic). |

## Properties

### Identity

Gets the identity of the principal.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcIdentity Identity { get; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public ReadOnly Property Identity As OpcIdentity
```

</div>

**Property value**

[OpcIdentity](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcidentity/)

The [OpcIdentity](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcidentity/) specified on construction.

## Methods

### IsInRole

<span class="api-meta">virtual · since v2.53</span>

Determines whether the current [OpcPrincipal](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.server.opcprincipal/) is a member of the specified `role`.

<div class="api-signature" data-lang="csharp">

```csharp
public virtual bool IsInRole(OpcAccessControlRole role)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Overridable Function IsInRole(role As OpcAccessControlRole) As Boolean
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `role` | [OpcAccessControlRole](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.server.opcaccesscontrolrole/) | The [OpcAccessControlRole](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.server.opcaccesscontrolrole/) for which to check the membership. |

**Returns**

[Boolean](https://learn.microsoft.com/dotnet/api/system.boolean)

The value true if the current [OpcPrincipal](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.server.opcprincipal/) is a member of the specified `role`; otherwise the value false.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) |  |
