Skip to content

Commit

Permalink
Merge pull request #3 from permitio/master
Browse files Browse the repository at this point in the history
Updating my local master with latest changes
  • Loading branch information
filipermit authored Nov 15, 2022
2 parents 8ea6cd7 + 2680fc8 commit 49531a8
Show file tree
Hide file tree
Showing 40 changed files with 571 additions and 75 deletions.
130 changes: 111 additions & 19 deletions docs/api/v2-migration-guide.mdx

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions docs/sdk/dotnet/quickstart-dotnet.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Quickstart
---

# Dot Net Quickstart

import IntroContent from "@site/docs/tutorials/_quickstart-parts/_quickstart_intro.mdx";
import DotNetExample from "@site/docs/tutorials/_quickstart-parts/_quickstart_dotnet.mdx";

<IntroContent />
<DotNetExample />
15 changes: 15 additions & 0 deletions docs/sdk/dotnet/role/AssignRole.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# AssignRole

Assign a role to a specific user.

### Parameters

`userId` - The id of the user. This is the unique key of the user.<br/>
`roleId` - The id of the role. This can also be the role key.<br/>
`tenantId` - The id of the tenant. This can also be the tenant key.<br/>

### Implementation

```dotnet
var response = await permitClient.Api.AssignRole(userId, roleId, tenantId);
```
31 changes: 31 additions & 0 deletions docs/sdk/dotnet/role/CreateRole.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# CreateRole

Creates a new role.

### Parameters

`role` - An object that contains the information about the new role. The payload is defined below.<br/>

### Payload

`Key` - A URL-friendly name of the role (i.e: slug). You will be able to query later using this key instead of the id (UUID) of the role.<br/>
`Name` - The name of the role.<br/>
`Description` - **optional** - The description string explaining what this role represents, or what permissions are granted to it.<br/>
`Permissions` - **optional** - The list of action keys that define what actions this resource role is permitted to do.<br/>
`Extends` - **optional** - The list of role keys that define what roles this role extends. In other words: this role will automatically inherit all the permissions of the given roles in this list.<br/>

```dotnet
{
Key: "editor",
Name: "Editor",
Description: "the editor role can read and write to documents",
Permissions: ["document:write"],
Extends: ["viewer"]
}
```

### Implementation

```dotnet
var response = await permitClient.Api.CreateRole(role);
```
13 changes: 13 additions & 0 deletions docs/sdk/dotnet/role/GetRole.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# GetRole

Get a single tenant role, if such role exists.

### Parameters

`roleId` - The id of the role. This can also be the role key.<br/>

### Implementation

```dotnet
var roles = await permitClient.Api.GetRole(roleId);
```
14 changes: 14 additions & 0 deletions docs/sdk/dotnet/role/ListAssignedRoles.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# ListAssignedRoles

Get all the assigned roles for a specific user.

### Parameters

`userId` - The id of the user. This can also be the user key.<br/>
`tenantId` - **optional** - The id of the tenant or the tenant key. **If no is tenant provided, all tenants will fetch**.<br/>

### Implementation

```dotnet
const roles = await permitClient.Api.ListAssignedRoles(userId, tenantId);
```
9 changes: 9 additions & 0 deletions docs/sdk/dotnet/role/ListRoles.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ListRoles

Get all available roles.

### Implementation

```dotnet
var response = await permitClient.Api.ListRoles();
```
15 changes: 15 additions & 0 deletions docs/sdk/dotnet/role/UnassignRole.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# UnassignRole

Unassign a role from a specific user.

### Parameters

`userId` - The id of the user. This is the unique key of the user.<br/>
`roleId` - The id of the role. This can also be the role key.<br/>
`tenantId` - The id of the tenant. This can also be the tenant key.<br/>

### Implementation

```dotnet
var response = await permitClient.Api.UnassignRole(userId, roleId, tenantId);
```
29 changes: 29 additions & 0 deletions docs/sdk/dotnet/tenant/CreateTenant.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# CreateTenant

Creates a new tenant.

### Parameters

`tenantObj` - An object that contains the information about the tenant. The payload is defined below.<br/>

### Payload

`Key` - A unique id by which Permit will identify the tenant. The tenant key must be url-friendly (slugified).<br/>
`Name` - A descriptive name for the tenant.<br/>
`Description` - **optional** - A longer description of the tenant.<br/>
`Attributes` - **optional** - Arbitraty tenant attributes that will be used to enforce attribute-based access control policies.<br/>

```dotnet
{
Key: "key",
Name: "name",
Description: "description",
Attributes: {}
}
```

### Implementation

```dotnet
var response = await permitClient.Api.CreateTenant(tenantObj);
```
13 changes: 13 additions & 0 deletions docs/sdk/dotnet/tenant/DeleteTenant.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# DeleteTenant

Deletes a tenant.

### Parameters

`tenantId` - The id of the tenant. This can also be the tenant key.<br/>

### Implementation

```dotnet
var response = await permitClient.Api.DeleteTenant(tenantId);
```
13 changes: 13 additions & 0 deletions docs/sdk/dotnet/tenant/GetTenant.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# GetTenant

Fetch the tenant and the tenant information.

### Parameters

`tenantId` - The id of the tenant. This can also be the tenant key.<br/>

### Implementation

```dotnet
var tenant = await permitClient.Api.GetTenant(tenantId);
```
28 changes: 28 additions & 0 deletions docs/sdk/dotnet/tenant/UpdateTenant.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# UpdateTenant

Updates the tenant.

### Parameters

`tenantId` - The id of the tenant. This can also be the tenant key.<br/>
`tenant` - An object that contains the information about the tenant. The payload is defined below.<br/>

### Payload

`Name` - **optional** - A descriptive name for the tenant.<br/>
`Description` - **optional** - A longer description of the tenant.<br/>
`Attributes` - **optional** - Arbitraty tenant attributes that will be used to enforce attribute-based access control policies.<br/>

```dotnet
{
Name: "name",
Description: "description",
Attributes: {}
}
```

### Implementation

```dotnet
var response = await permitClient.Api.UpdateTenant(tenantId, tenant);
```
33 changes: 33 additions & 0 deletions docs/sdk/dotnet/user/CreateUser.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# CreateUser

Create a new user with specified user information.

### Parameters

`userObj` - An object that contains the information about the user. The payload is defined below.<br/>

### Payload

`Key` - A unique id by which Permit will identify the user for permission checks.

You will later pass this ID to the `permit.check()` API. You can use anything for this ID; the user email - a UUID or anything else as long as it's unique on your end. The user key must be url-friendly (slugified).<br/><br/>
`Email` - **optional** - The email of the user. If synced, will be unique inside the environment.<br/>
`First_name` - **optional** - First name of the user.<br/>
`Last_name` - **optional** - Last name of the user.<br/>
`Attributes` - **optional** - Arbitraty user attributes that will be used to enforce attribute-based access control policies.<br/>

```dotnet
var userObj = new UserCreate{
Key = "key",
Email = "email@example.com",
First_name = "John",
Last_name = "Smith",
Attributes = {}
};
```

### Implementation

```dotnet
var response = await permitClient.Api.CreateUser(userObj);
```
13 changes: 13 additions & 0 deletions docs/sdk/dotnet/user/DeleteUser.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# DeleteUser

Delete a user with specific user key or id.

### Parameters

`userId` - The id of the user. This is the unique key of the user.<br/>

### Implementation

```dotnet
var response = await permitClient.Api.DeleteUser(userId);
```
13 changes: 13 additions & 0 deletions docs/sdk/dotnet/user/GetUser.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# GetUser

Get the specificed user and their information.

### Parameters

`userId` - The id of the user. This is the unique key of the user.<br/>

### Implementation

```dotnet
var user = await permitClient.Api.GetUser(userId);
```
43 changes: 43 additions & 0 deletions docs/sdk/dotnet/user/SyncUser.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# SyncUser

This function is used to sync (save) a user's information to the Permit.io cloud and PDP (Policy Decision Point) upon user creation.

:::note
This function **should be** used for the initial creation of the user. This means that when you need to have the user synced between your authentication
solution and Permit, this is the function you need to use.

Once the user has been synced with Permit, you **should not** use this sdk call to update the user's _role_.

Instead, you should use the **[AssignRole](/sdk/dotnet/role/AssignRole)** function.

:::

### Parameters

`userObj` - An object that contains the information about the user. The payload is defined below.<br/>

### Payload

`Key` - A unique id by which Permit will identify the user for permission checks.

You will later pass this ID to the `permit.check()` API. You can use anything for this ID; the user email - a UUID or anything else as long as it's unique on your end. The user key must be url-friendly (slugified).<br/><br/>
`Email` - **optional** - The email of the user. If synced, will be unique inside the environment.<br/>
`First_name` - **optional** - First name of the user.<br/>
`Last_name` - **optional** - Last name of the user.<br/>
`Attributes` - **optional** - Arbitraty user attributes that will be used to enforce attribute-based access control policies.<br/>

```dotnet
var userObj = new UserCreate{
Key = "key",
Email = "email@example.com",
First_name = "John",
Last_name = "Smith",
Attributes = {}
};
```

### Implementation

```js
var user = await permitClient.Api.SyncUser(userObj);
```
4 changes: 2 additions & 2 deletions docs/sdk/nodejs/resource/delete-resource.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# deleteResource

Deletes a resource with the corresponding ID.
Deletes a resource with the corresponding key or id.

### Parameters

`resourceId` - The unique resource key or the resource name.<br/>
`resourceId` - The unique resource key or the resource id.<br/>

### Implementation

Expand Down
4 changes: 2 additions & 2 deletions docs/sdk/nodejs/resource/update-resource.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# updateResource

Updates a resource for the specific resource ID.
Updates a resource for the specific resource key or id.

### Parameters

`resourceId` - The unique resource key or the resource name.<br />
`resourceId` - The unique resource key or the resource id.<br />
`resource` - An object that contains the information about the updated resource. The payload is defined below.<br/>

### Payload
Expand Down
4 changes: 2 additions & 2 deletions docs/sdk/nodejs/role/delete-role.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# deleteRole

Deletes an existing role with the given ID.
Deletes an existing role with the given key or id.

### Parameters

`roleId` - The ID of the role. This can also be the role name.<br/>
`roleId` - The id of the role. This can also be the role key.<br/>

### Implementation

Expand Down
10 changes: 5 additions & 5 deletions docs/sdk/nodejs/role/get-assigned-roles.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ Get all the assigned roles for a specific user.

### Parameters

`user` - The ID of the role. This can also be the role name.<br/>
`tenant` - **optional** - The ID of the tenant or the tenant name. If no is tenant provided, all tenants will fetch.<br/>
`userId` - The ID of the user. This can also be the user key.<br/>
`tenantId` - **optional** - The id of the tenant or the tenant key. **If no is tenant provided, all tenants will fetch**.<br/>

### Payload

```js
{
user: "user",
tenant: "tenant"
user: "userId",
tenant: "tenantId"
}
```

### Implementation

```js
const roles = await permit.api.getAssignedRoles(user, JSON.stringify(tenant));
const roles = await permit.api.getAssignedRoles(userId, tenantId);
```
2 changes: 1 addition & 1 deletion docs/sdk/nodejs/role/get-role.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Get a single tenant role, if such role exists.

### Parameters

`roleId` - The ID of the role. This can also be the role name.<br/>
`roleId` - The id of the role. This can also be the role key.<br/>

### Implementation

Expand Down
2 changes: 1 addition & 1 deletion docs/sdk/nodejs/role/update-role.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Update an existing role.

### Parameters

`roleId` - The ID of the role. This can also be the role name. <br/>
`roleId` - The ID of the role. This can also be the role key. <br/>
`role` - An object that contains the information about the new role. The payload is defined below.<br/>

### Payload
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk/nodejs/tenant/delete-tenant.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Deletes a tenant.

### Parameters

`tenantId` - The ID of the tenant. This can also be the tenant name.<br/>
`tenantId` - The id of the tenant. This can also be the tenant key.<br/>

### Implementation

Expand Down
Loading

0 comments on commit 49531a8

Please sign in to comment.