Sitelet https://web.archive.org/web/20220223110602/https://github.com/Permify/permify-go
Skip to content
main
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Permify Go Library

GitHub go.mod Go version (branch & subdirectory of monorepo) GitHub last commit Twitter URL

Use Permify in server-side Go Projects.

Install

go get github.com/Permify/permify-go/v2

Usage

To get started, create the Permify client using your Workspace id and API private key:

import permify `github.com/Permify/permify-go/v2`

client := client.New("workspace_id", "private_token")

Create User

This method creates a user entity in Permify.

response, err := client.User.Create(user.Create{ExternalID: "user_external_id", GroupExternalID: "group_external_id", Name: "user_name", Photo: permify_go.String("user_photo"), Title: permify_go.String("user_title")})

Create Role

This method creates a role entity in Permify.

response, err = client.Role.Create(role.Create{GroupExternalID: "group_external_id", Name: "role_name", Description: permify_go.String("user_photo"), Color: permify_go.String("color")})

Create Group

This method creates a group entity in Permify.

response, err = client.Group.Create(group.Create{ExternalID: "external_id", Name: "name"})

IsAuthorized

This method returns a decision about whether the user can do this action.

cascade create means if permission does not exist in the database, it creates a new permission and continues processing.

response, err = client.User.IsAuthorized(user.IsAuthorized{UserExternalID: "user_external_id", PermissionName: "permission_name", CascadeCreate: true, Description: permify_go.String("description")})

Create Portal Session

This method creates a new portal session. More information about Permify Portal.

response, err = client.Session.Create(session.Create{GroupExternalID: "group_external_id"})

For more information on how to use the Permify API, please refer to the Permify API Reference.

Permify Documentation

See more

About

Permify Go Library

Resources

License

Stars

Watchers

Forks

Languages