Skip to content

Commit

Permalink
Extract policy body types for better documentation
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Haines <haines@cerbos.dev>
  • Loading branch information
haines committed Jul 13, 2023
1 parent 5975063 commit fdfe37a
Show file tree
Hide file tree
Showing 41 changed files with 512 additions and 146 deletions.
6 changes: 1 addition & 5 deletions docs/core.derivedroles.derivedroles.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,5 @@ A set of derived roles.
**Signature:**

```typescript
derivedRoles: {
name: string;
definitions: DerivedRoleDefinition[];
variables?: Variables | undefined;
};
derivedRoles: DerivedRolesBody;
```
2 changes: 1 addition & 1 deletion docs/core.derivedroles.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ export interface DerivedRoles extends PolicyBase
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [derivedRoles](./core.derivedroles.derivedroles.md) | | { name: string; definitions: [DerivedRoleDefinition](./core.derivedroledefinition.md)<!-- -->\[\]; variables?: [Variables](./core.variables.md) \| undefined; } | A set of derived roles. |
| [derivedRoles](./core.derivedroles.derivedroles.md) | | [DerivedRolesBody](./core.derivedrolesbody.md) | A set of derived roles. |
13 changes: 13 additions & 0 deletions docs/core.derivedrolesbody.definitions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@cerbos/core](./core.md) &gt; [DerivedRolesBody](./core.derivedrolesbody.md) &gt; [definitions](./core.derivedrolesbody.definitions.md)

## DerivedRolesBody.definitions property

The definitions of the derived roles.

**Signature:**

```typescript
definitions: DerivedRoleDefinition[];
```
22 changes: 22 additions & 0 deletions docs/core.derivedrolesbody.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@cerbos/core](./core.md) &gt; [DerivedRolesBody](./core.derivedrolesbody.md)

## DerivedRolesBody interface

A set of [derived roles](https://docs.cerbos.dev/cerbos/latest/policies/derived_roles.html) to augment static RBAC roles with contextual data to provide more fine-grained control at runtime.

**Signature:**

```typescript
export interface DerivedRolesBody
```

## Properties

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [definitions](./core.derivedrolesbody.definitions.md) | | [DerivedRoleDefinition](./core.derivedroledefinition.md)<!-- -->\[\] | The definitions of the derived roles. |
| [name](./core.derivedrolesbody.name.md) | | string | The name to use when importing the set of derived roles. |
| [variables?](./core.derivedrolesbody.variables.md) | | [Variables](./core.variables.md) \| undefined | _(Optional)_ [Variables](https://docs.cerbos.dev/cerbos/prerelease/policies/variables.html) defined for use in conditions. |

13 changes: 13 additions & 0 deletions docs/core.derivedrolesbody.name.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@cerbos/core](./core.md) &gt; [DerivedRolesBody](./core.derivedrolesbody.md) &gt; [name](./core.derivedrolesbody.name.md)

## DerivedRolesBody.name property

The name to use when importing the set of derived roles.

**Signature:**

```typescript
name: string;
```
18 changes: 18 additions & 0 deletions docs/core.derivedrolesbody.variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@cerbos/core](./core.md) &gt; [DerivedRolesBody](./core.derivedrolesbody.md) &gt; [variables](./core.derivedrolesbody.variables.md)

## DerivedRolesBody.variables property

[Variables](https://docs.cerbos.dev/cerbos/prerelease/policies/variables.html) defined for use in conditions.

**Signature:**

```typescript
variables?: Variables | undefined;
```

## Remarks

Requires the Cerbos policy decision point server to be at least v0.29.

5 changes: 1 addition & 4 deletions docs/core.exportvariables.exportvariables.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,5 @@ A set of exported variables.
**Signature:**

```typescript
exportVariables: {
name: string;
definitions: Record<string, string>;
};
exportVariables: ExportVariablesBody;
```
2 changes: 1 addition & 1 deletion docs/core.exportvariables.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ Requires the Cerbos policy decision point server to be at least v0.29.
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [exportVariables](./core.exportvariables.exportvariables.md) | | { name: string; definitions: Record&lt;string, string&gt;; } | A set of exported variables. |
| [exportVariables](./core.exportvariables.exportvariables.md) | | [ExportVariablesBody](./core.exportvariablesbody.md) | A set of exported variables. |
13 changes: 13 additions & 0 deletions docs/core.exportvariablesbody.definitions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@cerbos/core](./core.md) &gt; [ExportVariablesBody](./core.exportvariablesbody.md) &gt; [definitions](./core.exportvariablesbody.definitions.md)

## ExportVariablesBody.definitions property

Variable expressions.

**Signature:**

```typescript
definitions: Record<string, string>;
```
25 changes: 25 additions & 0 deletions docs/core.exportvariablesbody.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@cerbos/core](./core.md) &gt; [ExportVariablesBody](./core.exportvariablesbody.md)

## ExportVariablesBody interface

A set of [exported variables](https://docs.cerbos.dev/cerbos/prerelease/policies/variables.html#export) to be reused in other policies.

**Signature:**

```typescript
export interface ExportVariablesBody
```

## Remarks

Requires the Cerbos policy decision point server to be at least v0.29.

## Properties

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [definitions](./core.exportvariablesbody.definitions.md) | | Record&lt;string, string&gt; | Variable expressions. |
| [name](./core.exportvariablesbody.name.md) | | string | The name to use when importing the set of variables. |

13 changes: 13 additions & 0 deletions docs/core.exportvariablesbody.name.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@cerbos/core](./core.md) &gt; [ExportVariablesBody](./core.exportvariablesbody.md) &gt; [name](./core.exportvariablesbody.name.md)

## ExportVariablesBody.name property

The name to use when importing the set of variables.

**Signature:**

```typescript
name: string;
```
4 changes: 4 additions & 0 deletions docs/core.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ Common types used by the [gRPC](./grpc.md) and [HTTP](./http.md) client librarie
| [DeleteSchemasResponse](./core.deleteschemasresponse.md) | The outcome of deleting schemas. |
| [DerivedRoleDefinition](./core.derivedroledefinition.md) | The definition of a [derived role](https://docs.cerbos.dev/cerbos/latest/policies/derived_roles.html)<!-- -->. |
| [DerivedRoles](./core.derivedroles.md) | A set of [derived roles](https://docs.cerbos.dev/cerbos/latest/policies/derived_roles.html) to augment static RBAC roles with contextual data to provide more fine-grained control at runtime. |
| [DerivedRolesBody](./core.derivedrolesbody.md) | A set of [derived roles](https://docs.cerbos.dev/cerbos/latest/policies/derived_roles.html) to augment static RBAC roles with contextual data to provide more fine-grained control at runtime. |
| [DisablePoliciesRequest](./core.disablepoliciesrequest.md) | Input to [Client.disablePolicies()](./core.client.disablepolicies.md)<!-- -->. |
| [DisablePoliciesResponse](./core.disablepoliciesresponse.md) | The outcome of disabling policies. |
| [EnablePoliciesRequest](./core.enablepoliciesrequest.md) | Input to [Client.enablePolicies()](./core.client.enablepolicies.md)<!-- -->. |
| [EnablePoliciesResponse](./core.enablepoliciesresponse.md) | The outcome of enabling policies. |
| [ExportVariables](./core.exportvariables.md) | A set of [exported variables](https://docs.cerbos.dev/cerbos/prerelease/policies/variables.html#export) to be reused in other policies. |
| [ExportVariablesBody](./core.exportvariablesbody.md) | A set of [exported variables](https://docs.cerbos.dev/cerbos/prerelease/policies/variables.html#export) to be reused in other policies. |
| [GetPoliciesRequest](./core.getpoliciesrequest.md) | Input to [Client.getPolicies()](./core.client.getpolicies.md)<!-- -->. |
| [GetPoliciesResponse](./core.getpoliciesresponse.md) | Fetched policies. |
| [GetSchemasRequest](./core.getschemasrequest.md) | Input to [Client.getSchemas()](./core.client.getschemas.md)<!-- -->. |
Expand All @@ -81,12 +83,14 @@ Common types used by the [gRPC](./grpc.md) and [HTTP](./http.md) client librarie
| [PolicyMetadata](./core.policymetadata.md) | Metadata describing a policy. |
| [Principal](./core.principal.md) | A principal (often a user, but potentially another actor like a service account) to authorize. |
| [PrincipalPolicy](./core.principalpolicy.md) | A [policy](https://docs.cerbos.dev/cerbos/latest/policies/principal_policies.html) defining overrides for a specific user. |
| [PrincipalPolicyBody](./core.principalpolicybody.md) | A [policy](https://docs.cerbos.dev/cerbos/latest/policies/principal_policies.html) defining overrides for a specific user. |
| [PrincipalRule](./core.principalrule.md) | A rule defining an override for a specific user. |
| [PrincipalRuleAction](./core.principalruleaction.md) | An override for a given action for a specific user. |
| [ReloadStoreRequest](./core.reloadstorerequest.md) | Input to [Client.reloadStore()](./core.client.reloadstore.md)<!-- -->. |
| [Resource](./core.resource.md) | A resource on which to check a principal's permissions. |
| [ResourceCheck](./core.resourcecheck.md) | A [Resource](./core.resource.md) and list of actions on which to check a principal's permissions. |
| [ResourcePolicy](./core.resourcepolicy.md) | A [policy](https://docs.cerbos.dev/cerbos/latest/policies/resource_policies.html) defining rules for actions that can be performed on a given resource. |
| [ResourcePolicyBody](./core.resourcepolicybody.md) | A [policy](https://docs.cerbos.dev/cerbos/latest/policies/resource_policies.html) defining rules for actions that can be performed on a given resource. |
| [ResourceRule](./core.resourcerule.md) | A rule for actions that can be performed on a given resource. |
| [Schema](./core.schema.md) | A JSON schema used to validate principal or resource attributes. |
| [SchemaInput](./core.schemainput.md) | A JSON schema to be used to validate principal or resource attributes. |
Expand Down
2 changes: 1 addition & 1 deletion docs/core.policybase.variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

> Warning: This API is now obsolete.
>
> Define variables within the policy body instead (provided the Cerbos policy decision point server is at least v0.29).
> Define variables within the policy body instead, provided the Cerbos policy decision point server is at least v0.29 ([DerivedRolesBody.variables](./core.derivedrolesbody.variables.md)<!-- -->, [PrincipalPolicyBody.variables](./core.principalpolicybody.variables.md)<!-- -->, or [ResourcePolicyBody.variables](./core.resourcepolicybody.variables.md)<!-- -->).
>
Variable expressions defined for the policy.
Expand Down
2 changes: 1 addition & 1 deletion docs/core.principalpolicy.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ export interface PrincipalPolicy extends PolicyBase
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [principalPolicy](./core.principalpolicy.principalpolicy.md) | | { principal: string; version: string; rules: [PrincipalRule](./core.principalrule.md)<!-- -->\[\]; scope?: string; variables?: [Variables](./core.variables.md) \| undefined; } | The policy body. |
| [principalPolicy](./core.principalpolicy.principalpolicy.md) | | [PrincipalPolicyBody](./core.principalpolicybody.md) | The policy body. |
8 changes: 1 addition & 7 deletions docs/core.principalpolicy.principalpolicy.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,5 @@ The policy body.
**Signature:**

```typescript
principalPolicy: {
principal: string;
version: string;
rules: PrincipalRule[];
scope?: string;
variables?: Variables | undefined;
};
principalPolicy: PrincipalPolicyBody;
```
24 changes: 24 additions & 0 deletions docs/core.principalpolicybody.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@cerbos/core](./core.md) &gt; [PrincipalPolicyBody](./core.principalpolicybody.md)

## PrincipalPolicyBody interface

A [policy](https://docs.cerbos.dev/cerbos/latest/policies/principal_policies.html) defining overrides for a specific user.

**Signature:**

```typescript
export interface PrincipalPolicyBody
```

## Properties

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [principal](./core.principalpolicybody.principal.md) | | string | The ID of the principal to whom the policy applies. |
| [rules](./core.principalpolicybody.rules.md) | | [PrincipalRule](./core.principalrule.md)<!-- -->\[\] | Rules defining the overrides that apply to the principal. |
| [scope?](./core.principalpolicybody.scope.md) | | string | _(Optional)_ [Scope](https://docs.cerbos.dev/cerbos/latest/policies/scoped_policies.html) of the policy. |
| [variables?](./core.principalpolicybody.variables.md) | | [Variables](./core.variables.md) \| undefined | _(Optional)_ [Variables](https://docs.cerbos.dev/cerbos/prerelease/policies/variables.html) defined for use in conditions. |
| [version](./core.principalpolicybody.version.md) | | string | The version of the policy. |

13 changes: 13 additions & 0 deletions docs/core.principalpolicybody.principal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@cerbos/core](./core.md) &gt; [PrincipalPolicyBody](./core.principalpolicybody.md) &gt; [principal](./core.principalpolicybody.principal.md)

## PrincipalPolicyBody.principal property

The ID of the principal to whom the policy applies.

**Signature:**

```typescript
principal: string;
```
13 changes: 13 additions & 0 deletions docs/core.principalpolicybody.rules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@cerbos/core](./core.md) &gt; [PrincipalPolicyBody](./core.principalpolicybody.md) &gt; [rules](./core.principalpolicybody.rules.md)

## PrincipalPolicyBody.rules property

Rules defining the overrides that apply to the principal.

**Signature:**

```typescript
rules: PrincipalRule[];
```
13 changes: 13 additions & 0 deletions docs/core.principalpolicybody.scope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@cerbos/core](./core.md) &gt; [PrincipalPolicyBody](./core.principalpolicybody.md) &gt; [scope](./core.principalpolicybody.scope.md)

## PrincipalPolicyBody.scope property

[Scope](https://docs.cerbos.dev/cerbos/latest/policies/scoped_policies.html) of the policy.

**Signature:**

```typescript
scope?: string;
```
18 changes: 18 additions & 0 deletions docs/core.principalpolicybody.variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@cerbos/core](./core.md) &gt; [PrincipalPolicyBody](./core.principalpolicybody.md) &gt; [variables](./core.principalpolicybody.variables.md)

## PrincipalPolicyBody.variables property

[Variables](https://docs.cerbos.dev/cerbos/prerelease/policies/variables.html) defined for use in conditions.

**Signature:**

```typescript
variables?: Variables | undefined;
```

## Remarks

Requires the Cerbos policy decision point server to be at least v0.29.

18 changes: 18 additions & 0 deletions docs/core.principalpolicybody.version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@cerbos/core](./core.md) &gt; [PrincipalPolicyBody](./core.principalpolicybody.md) &gt; [version](./core.principalpolicybody.version.md)

## PrincipalPolicyBody.version property

The version of the policy.

**Signature:**

```typescript
version: string;
```

## Remarks

Policies are uniquely identified by the principal name and version pair. You can have multiple policy versions for the same principal (e.g. production vs. staging). The version value `default` is special as it is the default fallback when no version is specified in the request.

2 changes: 1 addition & 1 deletion docs/core.resourcepolicy.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ export interface ResourcePolicy extends PolicyBase
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [resourcePolicy](./core.resourcepolicy.resourcepolicy.md) | | { resource: string; version: string; importDerivedRoles?: string\[\]; rules: [ResourceRule](./core.resourcerule.md)<!-- -->\[\]; scope?: string; schemas?: [SchemaRefs](./core.schemarefs.md) \| undefined; variables?: [Variables](./core.variables.md) \| undefined; } | The policy body. |
| [resourcePolicy](./core.resourcepolicy.resourcepolicy.md) | | [ResourcePolicyBody](./core.resourcepolicybody.md) | The policy body. |
10 changes: 1 addition & 9 deletions docs/core.resourcepolicy.resourcepolicy.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,5 @@ The policy body.
**Signature:**

```typescript
resourcePolicy: {
resource: string;
version: string;
importDerivedRoles?: string[];
rules: ResourceRule[];
scope?: string;
schemas?: SchemaRefs | undefined;
variables?: Variables | undefined;
};
resourcePolicy: ResourcePolicyBody;
```
13 changes: 13 additions & 0 deletions docs/core.resourcepolicybody.importderivedroles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@cerbos/core](./core.md) &gt; [ResourcePolicyBody](./core.resourcepolicybody.md) &gt; [importDerivedRoles](./core.resourcepolicybody.importderivedroles.md)

## ResourcePolicyBody.importDerivedRoles property

Name of a set of [derived roles](https://docs.cerbos.dev/cerbos/latest/policies/derived_roles.html) to import.

**Signature:**

```typescript
importDerivedRoles?: string[];
```
26 changes: 26 additions & 0 deletions docs/core.resourcepolicybody.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@cerbos/core](./core.md) &gt; [ResourcePolicyBody](./core.resourcepolicybody.md)

## ResourcePolicyBody interface

A [policy](https://docs.cerbos.dev/cerbos/latest/policies/resource_policies.html) defining rules for actions that can be performed on a given resource.

**Signature:**

```typescript
export interface ResourcePolicyBody
```

## Properties

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [importDerivedRoles?](./core.resourcepolicybody.importderivedroles.md) | | string\[\] | _(Optional)_ Name of a set of [derived roles](https://docs.cerbos.dev/cerbos/latest/policies/derived_roles.html) to import. |
| [resource](./core.resourcepolicybody.resource.md) | | string | The name of the resource to which the policy applies. |
| [rules](./core.resourcepolicybody.rules.md) | | [ResourceRule](./core.resourcerule.md)<!-- -->\[\] | Rules defining the actions that can be performed on the resource. |
| [schemas?](./core.resourcepolicybody.schemas.md) | | [SchemaRefs](./core.schemarefs.md) \| undefined | _(Optional)_ [Schemas](https://docs.cerbos.dev/cerbos/latest/policies/schemas.html) for principal and resource attributes. |
| [scope?](./core.resourcepolicybody.scope.md) | | string | _(Optional)_ [Scope](https://docs.cerbos.dev/cerbos/latest/policies/scoped_policies.html) of the policy. |
| [variables?](./core.resourcepolicybody.variables.md) | | [Variables](./core.variables.md) \| undefined | _(Optional)_ [Variables](https://docs.cerbos.dev/cerbos/prerelease/policies/variables.html) defined for use in conditions. |
| [version](./core.resourcepolicybody.version.md) | | string | The version of the policy. |

13 changes: 13 additions & 0 deletions docs/core.resourcepolicybody.resource.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@cerbos/core](./core.md) &gt; [ResourcePolicyBody](./core.resourcepolicybody.md) &gt; [resource](./core.resourcepolicybody.resource.md)

## ResourcePolicyBody.resource property

The name of the resource to which the policy applies.

**Signature:**

```typescript
resource: string;
```
Loading

0 comments on commit fdfe37a

Please sign in to comment.