---
title: "Class Policy"
slug: "sdk--stylelabs.m.sdk.models.policies.policy"
abstract: ""
---
# Class Policy

Describes a policy.

## Inheritance

object

Policy

[UserGroupPolicy](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.models.policies.usergrouppolicy.html)

[UserPolicy](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.models.policies.userpolicy.html)

## Implements

[IPolicy](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.contracts.policies.ipolicy.html)

[IResource](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.contracts.base.iresource.html)

## Namespace: StylelabsStylelabs.MSdkStylelabs.M.Sdk.ModelsPolicies

## Assembly: Stylelabs.M.Sdk.dll

## Syntax

```csharp
public abstract class Policy : IPolicy, IResource
```

## Properties

### CreatedBy

Gets the id of the user who created this resource. null if it has not been created.

#### Declaration

```csharp
public long? CreatedBy { get; set; }
```

#### Property Value

| Type | Description |
| --- | --- |
| long |  |

### CreatedOn

Gets the date on which this resource was created. null if it has not been created.

#### Declaration

```csharp
public DateTime? CreatedOn { get; set; }
```

#### Property Value

| Type | Description |
| --- | --- |
| DateTime |  |

### MemberGroupSecurity

Gets a list of member group policies (never null).

#### Declaration

```csharp
public IList<IMemberPolicy> MemberGroupSecurity { get; set; }
```

#### Property Value

| Type | Description |
| --- | --- |
| IList<>[IMemberPolicy](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.contracts.policies.imemberpolicy.html) |  |

### MemberSecurity

Gets a list of member policies (never null).

#### Declaration

```csharp
public IList<IMemberPolicy> MemberSecurity { get; set; }
```

#### Property Value

| Type | Description |
| --- | --- |
| IList<>[IMemberPolicy](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.contracts.policies.imemberpolicy.html) |  |

### ModifiedBy

Gets the id of the user who modified this resource. null if it has not been created.

#### Declaration

```csharp
public long? ModifiedBy { get; set; }
```

#### Property Value

| Type | Description |
| --- | --- |
| long |  |

### ModifiedOn

Gets the date on which this resource was modified. null if it has not been created.

#### Declaration

```csharp
public DateTime? ModifiedOn { get; set; }
```

#### Property Value

| Type | Description |
| --- | --- |
| DateTime |  |

### Rules

Gets a list of rules (never null).

#### Declaration

```csharp
public IList<IRule> Rules { get; set; }
```

#### Property Value

| Type | Description |
| --- | --- |
| IList<>[IRule](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.contracts.policies.irule.html) |  |

## Methods

### GetRelatedId()

Gets the id of entity this policy applies to. This depends on the implementation. E.g. for [IUserPolicy](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.contracts.policies.iuserpolicy.html) it will return [UserId](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.contracts.policies.iuserpolicy.html).

#### Declaration

```csharp
public abstract long? GetRelatedId()
```

#### Returns

| Type | Description |
| --- | --- |
| long | The id. |

### Implements

[IPolicy](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.contracts.policies.ipolicy.html)

[IResource](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.contracts.base.iresource.html)
