Skip to main content
Polar uses explicitly typed data. When you open a Polar policy, two main type categories are available: This page covers built-in types only. Most of your policy will be written using custom types defined as resource blocks.

Primitive Types

Polar supports the following primitive types: You can use primitives directly in rules or facts:

Common Uses of String

By convention, Polar represents permission names, role names, and relation names as String values.

Object Literal Representation

Primitives can also be expressed as object literals:
This form has no semantic difference; it’s purely an alternate syntax.

Fact Argument Length Limit

Each argument in a fact can be at most 384 bytes (not characters—multi-byte characters reduce the count).
Example within limits: has_relation(Foo{"<384-byte string>"}, "<384-byte-string>", Bar{"384-byte string>"})
Polar provides two abstract types for authorization modeling: Create your own types by extending these abstracts in resource blocks.

Polymorphism

Abstract types enable polymorphism in policies. Among built-in types: This means every Actor is also a Resource. See the extends documentation for details.

Object Literal Restriction

Do not represent abstract types as object literals. For example, avoid: Resource{"foo"} # Invalid