Skip to main content
Attribute-Based Access Control (ABAC) grants or denies permissions based on properties of the resource, the requester, or the environment — not just their relationships. Permify supports ABAC through two schema primitives: attribute and rule.

How Attributes and Rules Work

An attribute is a typed property attached to an entity:
attribute is_public   boolean
attribute location    string[]
attribute balance     double
attribute credit_limit integer
Supported attribute types:
TypeDescription
booleanTrue / false flag
boolean[]Array of boolean values
stringText value
string[]Array of text values
integerWhole number
integer[]Array of whole numbers
doubleDecimal number
double[]Array of decimal numbers
A rule is a named function that evaluates an expression over one or more attribute parameters and returns true or false. Rules are written in Common Expression Language (CEL).
rule check_age(age integer) {
    age >= 18
}
Rules can also read from context.data — dynamic values passed at check time rather than stored as entity attributes.
Permify’s rule syntax is based on Common Expression Language (CEL). The syntax is nearly identical to C++, Go, Java, and TypeScript expressions.

Patterns

Public and Private Resources

The simplest ABAC pattern uses a single boolean attribute to toggle a resource between public (visible to anyone) and private (visible only to the owner).
entity user {}

entity resource {
    relation  owner     @user
    attribute is_public boolean

    permission view = is_public or owner
    permission edit = owner
}

How it works

  • view — granted if is_public is true or the subject is the owner.
  • edit — granted only to the owner, regardless of visibility.
When is_public is false (or not set), only the owner can view the resource.

Writing the attribute

Set the attribute value when creating or updating a resource using the data write API:
{
  "tenant_id": "t1",
  "metadata": {
    "schema_version": ""
  },
  "attributes": [
    {
      "entity": {
        "type": "resource",
        "id": "1"
      },
      "attribute": "is_public",
      "value": {
        "@type": "type.googleapis.com/base.v1.BooleanValue",
        "data": true
      }
    }
  ]
}
This pattern works well for social platforms where posts can be restricted to followers only based on a boolean is_public attribute.

Build docs developers (and LLMs) love