skyrocketOoO / zanazibar-dag

A permission architecture based on Zanzibar and DAG, which can be used to build lots of permission system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

zanazibar-dag

Zanzibar-dag is a DAG(directed acyclic graph) based with Google's Zanzibar format, which can be the infrastructure below permission app.

Features

  • Get all edges
  • Create edge
  • Delete edge
  • Delete edges by conditions
  • Batch create or delete operations
  • Get all namespaces
  • Check relation
  • Get shortest path
  • Get all paths
  • Get all object relations
  • Get all subject relations
  • Get tree

Relation

The Relation struct represents a relationship like edge in DAG between objects and subjects. It is defined as follows:

// This means: Subject has a relation on Object
type Relation struct {
    ObjectNamespace  string
    ObjectName       string 
    Relation         string 
    SubjectNamespace string 
    SubjectName      string 
    SubjectRelation  string 
}

How to use

  1. Run postgres on docker(without docker, see ./docker-compose.yaml to get config)

    docker compose up -d postgres
  2. Run the main server

    go run .

Example

HRBAC

Reserved words

%

Development benchmark

Link

About

A permission architecture based on Zanzibar and DAG, which can be used to build lots of permission system

License:MIT License


Languages

Language:Go 60.2%Language:HTML 29.3%Language:JavaScript 9.8%Language:Makefile 0.6%Language:Dockerfile 0.2%