-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from permitio/master
Updating my local master with latest changes
- Loading branch information
Showing
40 changed files
with
571 additions
and
75 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.