### Permit.io SDK Quickstarts
Source: https://docs.permit.io/sdk/golang/user/create
Guides for getting started with Permit.io's SDKs in various programming languages. Covers installation, basic setup, and initial integration steps.
```nodejs
https://docs.permit.io/sdk/nodejs/quickstart-nodejs
```
```python
https://docs.permit.io/sdk/python/quickstart_python_sync
```
```golang
https://docs.permit.io/sdk/golang/quickstart-golang
```
```dotnet
https://docs.permit.io/sdk/dotnet/quickstart-dotnet
```
```java
https://docs.permit.io/sdk/java/quickstart-java
```
```ruby
https://docs.permit.io/sdk/ruby/quickstart-ruby
```
```php
https://docs.permit.io/sdk/php/quickstart-php
```
```kotlin
https://docs.permit.io/sdk/kotlin/quickstart-kotlin
```
```erlang
https://docs.permit.io/sdk/erlang/quickstart-erlang
```
```cpp
https://docs.permit.io/sdk/cpp/quickstart-cpp
```
```rust
https://docs.permit.io/sdk/rust/quickstart-rust
```
--------------------------------
### Permit.io .NET SDK Quickstart
Source: https://docs.permit.io/sdk/nodejs/quickstart-nodejs
Guide to getting started with the Permit.io .NET SDK, covering installation and initial configuration for .NET applications.
```dotnet
quickstart-dotnet: https://docs.permit.io/sdk/dotnet/quickstart-dotnet
```
--------------------------------
### Golang SDK Quickstart
Source: https://docs.permit.io/embeddable-uis/element-login
Instructions for getting started with the Permit.io Golang SDK, including setup and a simple permission check example.
```Golang
package main
import (
"fmt"
"github.com/permitio/permit-go-sdk"
)
func main() {
// Initialize Permit SDK
permit, err := permit.NewPermit("YOUR_API_KEY")
if err != nil {
panic(err)
}
// Example check
user := permit.User("user-123")
action := "read"
resource := "document:doc-abc"
isAllowed, err := permit.Check(user, action, resource)
if err != nil {
panic(err)
}
if isAllowed {
fmt.Println("User is allowed to read the document.")
} else {
fmt.Println("User is not allowed to read the document.")
}
}
```
--------------------------------
### Golang Quickstart
Source: https://docs.permit.io/authentication/your-authentication
Guide for getting started with Permit.io using the Golang SDK. Covers installation, basic configuration, and initial permission checks.
```Golang
go get github.com/permitio/permit-go
package main
import (
"fmt"
"github.com/permitio/permit-go"
)
func main() {
// Initialize Permit SDK
permit.Init("YOUR_ENVIRONMENT_API_KEY", "YOUR_API_TOKEN")
// Example permission check
user := permit.User{ID: "user-123"}
action := "read"
resource := "document:abc"
allowed, err := permit.Check(user, action, resource)
if err != nil {
fmt.Printf("Error checking permission: %v\n", err)
return
}
fmt.Printf("User %s can %s %s: %t\n", user.ID, action, resource, allowed)
}
```
--------------------------------
### Node.js Quickstart
Source: https://docs.permit.io/how-to/deploy/on-prem
A guide to getting started with Permit.io using the Node.js SDK, including installation and basic usage.
```bash
npm install @permitio/permit-sdk
```
```javascript
const permit = require('@permitio/permit-sdk');
async function main() {
const user = { id: 'user-123' };
const action = 'read';
const resource = 'document:report';
const allowed = await permit.check(user, action, resource);
if (allowed) {
console.log('Access granted!');
} else {
console.log('Access denied.');
}
}
main();
```
--------------------------------
### NodeJS Quickstart Guide
Source: https://docs.permit.io/sdk/golang/quickstart-golang
This guide details how to get started with Permit.io using the NodeJS SDK. It explains the core components and provides examples for integrating permission checks into your Node.js applications.
```nodejs
const permit = require("@permitio/permit-sdk");
async function main() {
const permitClient = new permit.Permit("YOUR_API_KEY");
const user = "user:123";
const action = "read";
const resource = "document:456";
try {
const allowed = await permitClient.check(
user,
action,
resource
);
if (allowed) {
console.log("Access granted");
} else {
console.log("Access denied");
}
} catch (error) {
console.error("Error checking permission:", error);
}
}
main();
```
--------------------------------
### Java Quickstart
Source: https://docs.permit.io/authentication/your-authentication
Guide for getting started with Permit.io using the Java SDK. Covers installation, basic configuration, and initial permission checks.
```Java
io.permit.sdk
permit-sdk
LATEST_VERSION
import io.permit.sdk.Permit;
import io.permit.sdk.PermitUser;
public class PermitExample {
public static void main(String[] args) {
// Initialize Permit SDK
Permit permit = new Permit("YOUR_ENVIRONMENT_API_KEY", "YOUR_API_TOKEN");
// Example permission check
PermitUser user = new PermitUser("user-123");
String action = "read";
String resource = "document:abc";
boolean allowed = permit.check(user, action, resource);
System.out.println("User " + user.getId() + " can " + action + " " + resource + ": " + allowed);
}
}
```
--------------------------------
### C++ Quickstart (Beta)
Source: https://docs.permit.io/authentication/your-authentication
Guide for getting started with Permit.io using the C++ SDK (Beta). Covers installation, basic configuration, and initial permission checks.
```C++
// Assuming you have the Permit C++ SDK installed and linked
#include
#include "permit.h"
int main() {
// Initialize Permit SDK
Permit permit("YOUR_ENVIRONMENT_API_KEY", "YOUR_API_TOKEN");
// Example permission check
PermitUser user("user-123");
std::string action = "read";
std::string resource = "document:abc";
bool allowed = permit.check(user, action, resource);
std::cout << "User " << user.getId() << " can " << action << " " << resource << ": " << (allowed ? "true" : "false") << std::endl;
return 0;
}
```
--------------------------------
### Kotlin Quickstart (Beta)
Source: https://docs.permit.io/authentication/your-authentication
Guide for getting started with Permit.io using the Kotlin SDK (Beta). Covers installation, basic configuration, and initial permission checks.
```Kotlin
// Gradle Dependency
// implementation 'io.permit.sdk:permit-sdk:LATEST_VERSION'
import io.permit.sdk.Permit
import io.permit.sdk.PermitUser
fun main() {
// Initialize Permit SDK
val permit = Permit("YOUR_ENVIRONMENT_API_KEY", "YOUR_API_TOKEN")
// Example permission check
val user = PermitUser("user-123")
val action = "read"
val resource = "document:abc"
val allowed = permit.check(user, action, resource)
println("User ${user.id} can $action $resource: $allowed")
}
```
--------------------------------
### Python Quickstart
Source: https://docs.permit.io/authentication/your-authentication
Guide for getting started with Permit.io using the Python SDK. Covers installation, basic configuration, and initial permission checks.
```Python
pip install permit-sdk
from permit import Permit
# Initialize Permit SDK
permit = Permit(environment='YOUR_ENVIRONMENT_API_KEY', token='YOUR_API_TOKEN')
# Example permission check
def check_permission():
user = {'id': 'user-123'}
action = 'read'
resource = 'document:abc'
allowed = permit.check(user, action, resource)
print(f"User {user['id']} can {action} {resource}: {allowed}")
check_permission()
```
--------------------------------
### PHP Quickstart (Beta)
Source: https://docs.permit.io/authentication/your-authentication
Guide for getting started with Permit.io using the PHP SDK (Beta). Covers installation, basic configuration, and initial permission checks.
```PHP
composer require permitio/permit-php
'user-123'];
$action = 'read';
$resource = 'document:abc';
$allowed = $permit->check($user, $action, $resource);
echo "User {$user['id']} can {$action} {$resource}: " . ($allowed ? 'true' : 'false') . "\n";
?>
```
--------------------------------
### .NET Quickstart
Source: https://docs.permit.io/authentication/your-authentication
Guide for getting started with Permit.io using the .NET SDK. Covers installation, basic configuration, and initial permission checks.
```.NET
Install-Package Permit.Sdk
using PermitSdk;
using System;
using System.Threading.Tasks;
public class PermitExample
{
public static async Task Main(string[] args)
{
// Initialize Permit SDK
var permit = new Permit("YOUR_ENVIRONMENT_API_KEY", "YOUR_API_TOKEN");
// Example permission check
var user = new User { Id = "user-123" };
var action = "read";
var resource = "document:abc";
var allowed = await permit.CheckAsync(user, action, resource);
Console.WriteLine($"User {user.Id} can {action} {resource}: {allowed}");
}
}
public class User
{
public string Id { get; set; }
}
```
--------------------------------
### Erlang Quickstart (Beta)
Source: https://docs.permit.io/authentication/your-authentication
Guide for getting started with Permit.io using the Erlang SDK (Beta). Covers installation, basic configuration, and initial permission checks.
```Erlang
% Add permit_sdk to your rebar.config dependencies
% {permit_sdk, "*"}
-module(permit_example).
-export([check_permission/0]).
check_permission() ->
% Initialize Permit SDK
ok = permit_sdk:init("YOUR_ENVIRONMENT_API_KEY", "YOUR_API_TOKEN"),
% Example permission check
User = #{id => "user-123"},
Action = "read",
Resource = "document:abc",
Allowed = permit_sdk:check(User, Action, Resource),
io:format("User ~s can ~s ~s: ~p\n", [maps:get(id, User), Action, Resource, Allowed]).
```
--------------------------------
### Permit.io PHP SDK Quickstart (Beta)
Source: https://docs.permit.io/sdk/nodejs/quickstart-nodejs
Getting started guide for the beta version of the Permit.io PHP SDK, including installation and basic usage instructions.
```php
quickstart-php: https://docs.permit.io/sdk/php/quickstart-php
```
--------------------------------
### Golang SDK Quickstart
Source: https://docs.permit.io/how-to/enforce-permissions/check
Instructions for getting started with the Permit.io Golang SDK. Includes installation and basic usage examples for Go applications.
```bash
go get github.com/permitio/permit-go-sdk
```
```go
package main
import (
"fmt"
"github.com/permitio/permit-go-sdk"
)
func main() {
permit, err := permit_go_sdk.NewPermit("YOUR_API_KEY")
if err != nil {
fmt.Printf("Error creating Permit client: %v\n", err)
return
}
user := permit_go_sdk.User{ID: "user-123"}
action := "read"
res := permit_go_sdk.Resource{Type: "document", ID: "doc-abc"}
allowed, err := permit.Check(user, action, res)
if err != nil {
fmt.Printf("Error checking permission: %v\n", err)
return
}
if allowed {
fmt.Println("Access granted")
} else {
fmt.Println("Access denied")
}
}
```
--------------------------------
### C++ Quickstart (Beta)
Source: https://docs.permit.io/sdk/golang/role/Create
A guide to getting started with the Permit.io C++ SDK, covering installation and basic usage for integrating authorization into C++ applications.
```cpp
#include
#include
#include
int main() {
// Initialize the Permit client
std::string apiKey = "YOUR_API_KEY";
std::string accountId = "YOUR_ACCOUNT_ID";
PermitClient client(apiKey, accountId);
// Example: Check a permission
std::string user = "user123";
std::string action = "read";
std::string resource = "document:report";
try {
bool allowed = client.check(user, action, resource, nullptr);
if (allowed) {
std::cout << user << " is allowed to " << action << " " << resource << std::endl;
} else {
std::cout << user << " is NOT allowed to " << action << " " << resource << std::endl;
}
} catch (const std::exception& e) {
std::cerr << "Error checking permission: " << e.what() << std::endl;
}
return 0;
}
```
--------------------------------
### Node.js SDK Quickstart
Source: https://docs.permit.io/sdk/nodejs/tenant/get-tenant
A guide to getting started with the Permit.io Node.js SDK. Covers installation, authentication, and basic permission enforcement examples.
```nodejs
import { Permit } from "@permitio/sdk";
// Initialize Permit client
const permit = new Permit("YOUR_API_KEY");
// Example: Check permission
const userKey = "user-123";
const actionKey = "read";
const resourceKey = "document:456";
const isAllowed = await permit.check(
userKey,
actionKey,
resourceKey
);
if (isAllowed) {
console.log("Access granted");
} else {
console.log("Access denied");
}
// Example: Bulk check
const checks = [
{ user: "user-123", action: "read", resource: "document:456" },
{ user: "user-123", action: "write", resource: "document:456" },
];
const results = await permit.bulkCheck(checks);
results.forEach(result => {
console.log(`Granted: ${result.granted}`);
});
```
--------------------------------
### Permit.io SDK Quickstarts
Source: https://docs.permit.io/manage-your-account/creating-environments
Guides for integrating Permit.io into your applications using various SDKs. These quickstarts cover installation, basic usage, and common integration patterns.
```Golang
package main
import (
"fmt"
"github.com/permitio/permit-go-sdk"
)
func main() {
permit, err := permit_go_sdk.NewPermit("YOUR_API_KEY")
if err != nil {
panic(err)
}
user := map[string]interface{}{"id": "user-123", "email": "user@example.com"}
res := map[string]interface{}{"type": "document", "id": "doc-abc"}
action := "read"
allowed, err := permit.Check(user, action, res)
if err != nil {
panic(err)
}
if allowed {
fmt.Println("User is allowed to read the document.")
} else {
fmt.Println("User is not allowed to read the document.")
}
}
```
--------------------------------
### Permit.io Quickstart
Source: https://docs.permit.io/how-to/build-policies/abac/time-based-role
A guide to quickly get started with Permit.io, covering initial setup and basic concepts.
```en
https://docs.permit.io/quickstart
```
--------------------------------
### Golang SDK Quickstart
Source: https://docs.permit.io/how-to/deploy/deploy-to-production
A guide to integrating Permit.io into a Golang application using the provided SDK, covering installation and initial setup.
```bash
go get github.com/permitio/permit-go
```
```go
package main
import (
"fmt"
"github.com/permitio/permit-go"
)
func main() {
user := permit.User{ID: "user-123"}
action := "read"
res := permit.Resource{Type: "document", ID: "doc-abc"}
a := permit.NewPermit("YOUR_API_KEY")
allowed, err := a.Check(user, action, res)
if err != nil {
fmt.Printf("Error checking permission: %v\n", err)
return
}
fmt.Printf("User allowed to %s: %t\n", action, allowed)
}
```
--------------------------------
### Golang Quickstart
Source: https://docs.permit.io/sdk/dotnet/quickstart-dotnet
Guide to getting started with Permit.io in a Golang environment.
```golang
https://docs.permit.io/sdk/golang/quickstart-golang
```
--------------------------------
### Python SDK Quickstart
Source: https://docs.permit.io/how-to/enforce-permissions/check
A quick start guide for integrating Permit.io with Python applications. Covers installation and initial setup for the Python SDK.
```bash
pip install permit-sdk
```
```python
from permit import Permit
permit = Permit()
async def check_permission():
user = {'id': 'user-123'}
action = 'read'
resource = {'type': 'document', 'id': 'doc-abc'}
allowed = await permit.check(user, action, resource)
if allowed:
print('Access granted')
else:
print('Access denied')
```
--------------------------------
### Python SDK Quickstart
Source: https://docs.permit.io/sdk/nodejs/user/sync-user
Guide to getting started with the Permit.io Python SDK, covering installation, initialization, and basic usage for policy enforcement.
```python
from permit import Permit
# Initialize Permit client
permit = Permit(api_key="YOUR_API_KEY")
# Example: Check permission
user_key = "user:123"
resource_key = "document:456"
action = "read"
if await permit.check(user_key, action, resource_key):
print("Access granted")
else:
print("Access denied")
```
--------------------------------
### Permit.io SDK - Python Quickstart
Source: https://docs.permit.io/sdk/nodejs/user/get-user
Guide to getting started with the Permit.io Python SDK, including installation and basic usage for policy synchronization.
```python
from permit import Permit
# Initialize Permit client
permit = Permit(api_key="YOUR_API_KEY")
# Sync RBAC policy script
permit.policy.sync_script("path/to/your/policy.py")
# Example of checking permissions (conceptual)
# is_allowed = permit.check("user_key", "read", "resource_key")
```
--------------------------------
### PHP Quickstart (Beta)
Source: https://docs.permit.io/sdk/dotnet/quickstart-dotnet
Guide to getting started with Permit.io in a PHP environment (Beta).
```php
https://docs.permit.io/sdk/php/quickstart-php
```
--------------------------------
### Python SDK: Quickstart
Source: https://docs.permit.io/sdk/nodejs/resource/create-resource
A guide to getting started with the Permit.io Python SDK, including installation and basic usage for policy enforcement.
```python
from permit import Permit
# Initialize Permit client
permit = Permit(token='YOUR_API_TOKEN')
# Define user, action, and resource
user = 'user@example.com'
action = 'read'
resource = 'document:123'
# Check permission
if permit.check(user, action, resource):
print(f'User {user} is allowed to {action} {resource}')
else:
print(f'User {user} is NOT allowed to {action} {resource}')
# Example of bulk check
checks = [
{'user': 'user1@example.com', 'action': 'read', 'resource': 'document:1'},
{'user': 'user2@example.com', 'action': 'write', 'resource': 'document:2'}
]
results = permit.bulk_check(checks)
for result in results:
print(f"User: {result['user']}, Action: {result['action']}, Resource: {result['resource']}, Allowed: {result['allowed']}")
```
--------------------------------
### Golang Quickstart Guide
Source: https://docs.permit.io/sdk/golang/resource/Create
This section provides a quick start guide for integrating Permit.io with your Golang applications. It covers the initial setup and basic usage of the SDK.
```golang
package main
import (
"fmt"
"github.com/permitio/permit-go-sdk/pkg/sdk"
)
func main() {
// Replace with your actual Permit API Key and Environment
apiKey := "YOUR_API_KEY"
environment := "YOUR_ENVIRONMENT"
permit, err := sdk.NewPermit(apiKey, environment)
if err != nil {
fmt.Printf("Failed to initialize Permit SDK: %v\n", err)
return
}
fmt.Println("Permit SDK initialized successfully!")
// Now you can use the permit object to interact with Permit.io
// For example, to check a permission:
// decision, err := permit.Check("user-key", "read", "resource-key")
// if err != nil {
// fmt.Printf("Permission check failed: %v\n", err)
// } else {
// fmt.Printf("Permission decision: %s\n", decision.Decision)
// }
}
```
--------------------------------
### Golang SDK Quickstart
Source: https://docs.permit.io/sdk/python/quickstart-python
Guide for getting started with the Permit.io Golang SDK.
```go
package main
import (
"fmt"
"github.com/permitio/permit-go-sdk"
)
func main() {
permit, err := permit_go_sdk.NewPermit("YOUR_API_KEY")
if err != nil {
panic(err)
}
allowed, err := permit.Check("user123", "edit", "document:456")
if err != nil {
panic(err)
}
if allowed {
fmt.Println("Access granted")
} else {
fmt.Println("Access denied")
}
}
```
--------------------------------
### C++ SDK - Quickstart
Source: https://docs.permit.io/sdk/dotnet/role/listroles
Guide to getting started with the Permit.io C++ SDK, including installation and basic usage for policy enforcement.
```cpp
#include
#include
int main() {
Permit permit("YOUR_API_KEY");
permit_sdk::User user;
user.id = "user-123";
user.email = "user@example.com";
permit_sdk::Resource resource;
resource.type = "document";
resource.id = "doc-abc";
std::string action = "read";
if (permit.check(user, action, resource)) {
std::cout << "User is allowed to perform the action." << std::endl;
} else {
std::cout << "User is not allowed." << std::endl;
}
return 0;
}
```
--------------------------------
### Kotlin SDK - Quickstart
Source: https://docs.permit.io/sdk/dotnet/role/listroles
Guide to getting started with the Permit.io Kotlin SDK, including installation and basic usage for policy enforcement.
```kotlin
implementation("io.permit.sdk:permit-kotlin-sdk:LATEST_VERSION")
```
```kotlin
import io.permit.sdk.Permit
import io.permit.sdk.PermitConfig
import io.permit.sdk.PermitContext
fun main() {
val config = PermitConfig("YOUR_API_KEY")
val permit = Permit(config)
val user = PermitContext.newUser("user-123").withEmail("user@example.com")
val resource = PermitContext.newResource("document", "doc-abc")
val action = "read"
val isAllowed = permit.check(user, action, resource)
if (isAllowed) {
println("User is allowed to perform the action.")
} else {
println("User is not allowed.")
}
}
```
--------------------------------
### Kotlin Quickstart (Beta)
Source: https://docs.permit.io/sdk/dotnet/quickstart-dotnet
Guide to getting started with Permit.io in a Kotlin environment (Beta).
```kotlin
https://docs.permit.io/sdk/kotlin/quickstart-kotlin
```
--------------------------------
### PHP SDK - Quickstart
Source: https://docs.permit.io/sdk/dotnet/role/listroles
Guide to getting started with the Permit.io PHP SDK, including installation and basic usage for policy enforcement.
```bash
composer require permitio/permit-php-sdk
```
```php
'user-123', 'email' => 'user@example.com'];
$resource = ['type' => 'document', 'id' => 'doc-abc'];
$action = 'read';
if ($permit->check($user, $action, $resource)) {
echo 'User is allowed to perform the action.';
} else {
echo 'User is not allowed.';
}
?>
```
--------------------------------
### Permit.io SDK Quickstarts
Source: https://docs.permit.io/overview/sync-your-first-user-with-sdk
Quickstart guides for integrating Permit.io into your applications using various SDKs. These guides cover the initial setup and basic usage for each language.
```Node.js
https://docs.permit.io/sdk/nodejs/quickstart-nodejs
```
```Python
https://docs.permit.io/sdk/python/quickstart_python_sync
```
```Golang
https://docs.permit.io/sdk/golang/quickstart-golang
```
```.NET
https://docs.permit.io/sdk/dotnet/quickstart-dotnet
```
```Java
https://docs.permit.io/sdk/java/quickstart-java
```
```Ruby on Rails
https://docs.permit.io/sdk/ruby/quickstart-ruby
```
```PHP
https://docs.permit.io/sdk/php/quickstart-php
```
--------------------------------
### Permit.io SDK Quickstarts
Source: https://docs.permit.io/manage-your-account/creating-environments
Guides for integrating Permit.io into your applications using various SDKs. These quickstarts cover installation, basic usage, and common integration patterns.
```.NET
using Permit.Core;
public class PermitExample
{
public static async Task Main(string[] args)
{
var permit = new Permit("YOUR_API_KEY");
var user = new Dictionary { { "id", "user-123" }, { "email", "user@example.com" } };
var resource = new Dictionary { { "type", "document" }, { "id", "doc-abc" } };
var action = "read";
var allowed = await permit.CheckAsync(user, action, resource);
if (allowed)
{
Console.WriteLine("User is allowed to read the document.");
}
else
{
Console.WriteLine("User is not allowed to read the document.");
}
}
}
```
--------------------------------
### Java SDK - Quickstart
Source: https://docs.permit.io/sdk/dotnet/role/listroles
Guide to getting started with the Permit.io Java SDK, including installation and basic usage for policy enforcement.
```xml
io.permit.sdk
permit-java-sdk
LATEST_VERSION
```
```java
import io.permit.sdk.Permit;
import io.permit.sdk.PermitConfig;
import io.permit.sdk.PermitContext;
public class Main {
public static void main(String[] args) {
PermitConfig config = new PermitConfig("YOUR_API_KEY");
Permit permit = new Permit(config);
PermitContext user = PermitContext.newUser("user-123").withEmail("user@example.com");
PermitContext resource = PermitContext.newResource("document", "doc-abc");
String action = "read";
boolean isAllowed = permit.check(user, action, resource);
if (isAllowed) {
System.out.println("User is allowed to perform the action.");
} else {
System.out.println("User is not allowed.");
}
}
}
```
--------------------------------
### Python SDK - Quickstart
Source: https://docs.permit.io/sdk/dotnet/role/listroles
Guide to getting started with the Permit.io Python SDK, including installation and basic usage for policy enforcement.
```bash
pip install permit-sdk
```
```python
from permit import Permit
permit = Permit(api_key='YOUR_API_KEY')
def check_permission():
user = {'id': 'user-123', 'email': 'user@example.com'}
resource = {'type': 'document', 'id': 'doc-abc'}
action = 'read'
if permit.check(user, action, resource):
print('User is allowed to perform the action.')
else:
print('User is not allowed.')
check_permission()
```
--------------------------------
### Node.js SDK - Quickstart
Source: https://docs.permit.io/sdk/dotnet/role/listroles
Guide to getting started with the Permit.io Node.js SDK, including installation and basic usage for policy enforcement.
```bash
npm install @permitio/sdk
```
```javascript
const permit = require('@permitio/sdk');
async function checkPermission() {
const user = { id: 'user-123', email: 'user@example.com' };
const resource = { type: 'document', id: 'doc-abc' };
const action = 'read';
const isAllowed = await permit.check(user, action, resource);
if (isAllowed) {
console.log('User is allowed to perform the action.');
} else {
console.log('User is not allowed.');
}
}
checkPermission();
```
--------------------------------
### Java Quickstart
Source: https://docs.permit.io/sdk/dotnet/quickstart-dotnet
Guide to getting started with Permit.io in a Java environment.
```java
https://docs.permit.io/sdk/java/quickstart-java
```
--------------------------------
### Erlang SDK - Quickstart
Source: https://docs.permit.io/sdk/dotnet/role/listroles
Guide to getting started with the Permit.io Erlang SDK, including installation and basic usage for policy enforcement.
```erlang
-module(permit_example).
-export([check_permission/0]).
check_permission() ->
Permit = permit_sdk:new("YOUR_API_KEY"),
User = #{id => "user-123", email => "user@example.com"},
Resource = #{type => "document", id => "doc-abc"},
Action = "read",
IsAllowed = permit_sdk:check(Permit, User, Action, Resource),
if IsAllowed == true ->
io:format("User is allowed to perform the action.~n");
true ->
io:format("User is not allowed.~n")
end.
```
--------------------------------
### Golang SDK - Quickstart
Source: https://docs.permit.io/sdk/dotnet/role/listroles
Guide to getting started with the Permit.io Golang SDK, including installation and basic usage for policy enforcement.
```bash
go get github.com/permitio/permit-go-sdk
```
```go
package main
import (
"fmt"
"github.com/permitio/permit-go-sdk"
)
func main() {
permit, err := permit_go_sdk.NewPermit("YOUR_API_KEY")
if err != nil {
panic(err)
}
user := permit_go_sdk.User{ID: "user-123", Email: "user@example.com"}
res := permit_go_sdk.Resource{Type: "document", ID: "doc-abc"}
action := "read"
isAllowed, err := permit.Check(user, action, res)
if err != nil {
panic(err)
}
if isAllowed {
fmt.Println("User is allowed to perform the action.")
} else {
fmt.Println("User is not allowed.")
}
}
```
--------------------------------
### Python Quickstart
Source: https://docs.permit.io/sdk/dotnet/quickstart-dotnet
Guide to getting started with Permit.io in a Python environment.
```python
https://docs.permit.io/sdk/python/quickstart_python_sync
```
--------------------------------
### C++ SDK - Quickstart
Source: https://docs.permit.io/sdk/dotnet/role/ListRoles
Guide to getting started with the Permit.io C++ SDK, including installation and basic usage for policy enforcement.
```cpp
#include
#include
int main() {
Permit permit("YOUR_API_KEY");
permit_sdk::User user;
user.id = "user-123";
user.email = "user@example.com";
permit_sdk::Resource resource;
resource.type = "document";
resource.id = "doc-abc";
std::string action = "read";
if (permit.check(user, action, resource)) {
std::cout << "User is allowed to perform the action." << std::endl;
} else {
std::cout << "User is not allowed." << std::endl;
}
return 0;
}
```
--------------------------------
### Permit.io SDK Quickstarts
Source: https://docs.permit.io/manage-your-account/creating-environments
Guides for integrating Permit.io into your applications using various SDKs. These quickstarts cover installation, basic usage, and common integration patterns.
```Python
from permit import Permit
permit = Permit(api_key='YOUR_API_KEY')
def check_permission():
user = {'id': 'user-123', 'email': 'user@example.com'}
resource = {'type': 'document', 'id': 'doc-abc'}
action = 'read'
allowed = permit.check(user, action, resource)
if allowed:
print('User is allowed to read the document.')
else:
print('User is not allowed to read the document.')
check_permission()
```
--------------------------------
### PHP SDK - Quickstart
Source: https://docs.permit.io/sdk/dotnet/role/ListRoles
Guide to getting started with the Permit.io PHP SDK, including installation and basic usage for policy enforcement.
```bash
composer require permitio/permit-php-sdk
```
```php
'user-123', 'email' => 'user@example.com'];
$resource = ['type' => 'document', 'id' => 'doc-abc'];
$action = 'read';
if ($permit->check($user, $action, $resource)) {
echo 'User is allowed to perform the action.';
} else {
echo 'User is not allowed.';
}
?>
```
--------------------------------
### Permit.io SDK Quickstarts
Source: https://docs.permit.io/manage-your-account/creating-environments
Guides for integrating Permit.io into your applications using various SDKs. These quickstarts cover installation, basic usage, and common integration patterns.
```Java
import io.permit.sdk.Permit;
import java.util.HashMap;
import java.util.Map;
public class PermitExample {
public static void main(String[] args) throws Exception {
Permit permit = new Permit("YOUR_API_KEY");
Map user = new HashMap<>();
user.put("id", "user-123");
user.put("email", "user@example.com");
Map resource = new HashMap<>();
resource.put("type", "document");
resource.put("id", "doc-abc");
String action = "read";
boolean allowed = permit.check(user, action, resource);
if (allowed) {
System.out.println("User is allowed to read the document.");
} else {
System.out.println("User is not allowed to read the document.");
}
}
}
```
--------------------------------
### Erlang SDK - Quickstart
Source: https://docs.permit.io/sdk/dotnet/role/ListRoles
Guide to getting started with the Permit.io Erlang SDK, including installation and basic usage for policy enforcement.
```erlang
-module(permit_example).
-export([check_permission/0]).
check_permission() ->
Permit = permit_sdk:new("YOUR_API_KEY"),
User = #{id => "user-123", email => "user@example.com"},
Resource = #{type => "document", id => "doc-abc"},
Action = "read",
IsAllowed = permit_sdk:check(Permit, User, Action, Resource),
if IsAllowed == true ->
io:format("User is allowed to perform the action.~n");
true ->
io:format("User is not allowed.~n")
end.
```
--------------------------------
### Golang SDK - Quickstart
Source: https://docs.permit.io/sdk/dotnet/role/ListRoles
Guide to getting started with the Permit.io Golang SDK, including installation and basic usage for policy enforcement.
```bash
go get github.com/permitio/permit-go-sdk
```
```go
package main
import (
"fmt"
"github.com/permitio/permit-go-sdk"
)
func main() {
permit, err := permit_go_sdk.NewPermit("YOUR_API_KEY")
if err != nil {
panic(err)
}
user := permit_go_sdk.User{ID: "user-123", Email: "user@example.com"}
res := permit_go_sdk.Resource{Type: "document", ID: "doc-abc"}
action := "read"
isAllowed, err := permit.Check(user, action, res)
if err != nil {
panic(err)
}
if isAllowed {
fmt.Println("User is allowed to perform the action.")
} else {
fmt.Println("User is not allowed.")
}
}
```
--------------------------------
### C++ Quickstart (Beta)
Source: https://docs.permit.io/sdk/dotnet/quickstart-dotnet
Guide to getting started with Permit.io in a C++ environment (Beta).
```cpp
https://docs.permit.io/sdk/cpp/quickstart-cpp
```
--------------------------------
### Permit.io SDK Quickstarts
Source: https://docs.permit.io/sdk/dotnet/tenant/CreateTenant
Guides for getting started with Permit.io using various programming language SDKs.
```nodejs
https://docs.permit.io/sdk/nodejs/quickstart-nodejs
```
```python
https://docs.permit.io/sdk/python/quickstart_python_sync
```
```golang
https://docs.permit.io/sdk/golang/quickstart-golang
```
```dotnet
https://docs.permit.io/sdk/dotnet/quickstart-dotnet
```
```java
https://docs.permit.io/sdk/java/quickstart-java
```
```ruby
https://docs.permit.io/sdk/ruby/quickstart-ruby
```
```php
https://docs.permit.io/sdk/php/quickstart-php
```
```kotlin
https://docs.permit.io/sdk/kotlin/quickstart-kotlin
```
```erlang
https://docs.permit.io/sdk/erlang/quickstart-erlang
```
```cpp
https://docs.permit.io/sdk/cpp/quickstart-cpp
```
```rust
https://docs.permit.io/sdk/rust/quickstart-rust
```
--------------------------------
### Java SDK - Quickstart
Source: https://docs.permit.io/sdk/dotnet/role/ListRoles
Guide to getting started with the Permit.io Java SDK, including installation and basic usage for policy enforcement.
```xml
io.permit.sdk
permit-java-sdk
LATEST_VERSION
```
```java
import io.permit.sdk.Permit;
import io.permit.sdk.PermitConfig;
import io.permit.sdk.PermitContext;
public class Main {
public static void main(String[] args) {
PermitConfig config = new PermitConfig("YOUR_API_KEY");
Permit permit = new Permit(config);
PermitContext user = PermitContext.newUser("user-123").withEmail("user@example.com");
PermitContext resource = PermitContext.newResource("document", "doc-abc");
String action = "read";
boolean isAllowed = permit.check(user, action, resource);
if (isAllowed) {
System.out.println("User is allowed to perform the action.");
} else {
System.out.println("User is not allowed.");
}
}
}
```
--------------------------------
### Node.js SDK - Quickstart
Source: https://docs.permit.io/sdk/dotnet/role/ListRoles
Guide to getting started with the Permit.io Node.js SDK, including installation and basic usage for policy enforcement.
```bash
npm install @permitio/sdk
```
```javascript
const permit = require('@permitio/sdk');
async function checkPermission() {
const user = { id: 'user-123', email: 'user@example.com' };
const resource = { type: 'document', id: 'doc-abc' };
const action = 'read';
const isAllowed = await permit.check(user, action, resource);
if (isAllowed) {
console.log('User is allowed to perform the action.');
} else {
console.log('User is not allowed.');
}
}
checkPermission();
```
--------------------------------
### Python Quickstart Guide
Source: https://docs.permit.io/sdk/golang/quickstart-golang
This section offers a quickstart guide for integrating Permit.io with Python applications. It covers the necessary steps to set up the SDK and perform permission checks.
```python
from permit import Permit
permit = Permit("YOUR_API_KEY")
user = "user:123"
action = "read"
resource = "document:456"
allowed = permit.check(user, action, resource)
if allowed:
print("Access granted")
else:
print("Access denied")
```
--------------------------------
### Python SDK - Quickstart
Source: https://docs.permit.io/sdk/dotnet/role/ListRoles
Guide to getting started with the Permit.io Python SDK, including installation and basic usage for policy enforcement.
```bash
pip install permit-sdk
```
```python
from permit import Permit
permit = Permit(api_key='YOUR_API_KEY')
def check_permission():
user = {'id': 'user-123', 'email': 'user@example.com'}
resource = {'type': 'document', 'id': 'doc-abc'}
action = 'read'
if permit.check(user, action, resource):
print('User is allowed to perform the action.')
else:
print('User is not allowed.')
check_permission()
```