GitHub
Reference

Authorization & Permissions

Complete reference for ProxifAI's RBAC permission system, token scopes, and access control architecture.

ProxifAI uses a layered authorization system combining PostgreSQL Row-Level Security (RLS) for tenant isolation with a granular RBAC permission model for fine-grained access control.

How It Works

Every API request passes through three authorization layers:

  1. Authentication — validates JWT or Personal Access Token
  2. Tenant Isolation — PostgreSQL RLS automatically scopes all queries to the current organization
  3. Permission Check — each handler verifies the user has the required permission via their roles

Tenant isolation is automatic and enforced at the database level. Even if a permission check were bypassed, RLS prevents any cross-organization data access.

System Roles

Three built-in roles are created for every organization:

Owner

Full access to every feature, including admin operations and organization deletion.

Admin

Same as Owner, except no admin.access. Cannot access super-admin endpoints or delete the organization.

Member

Day-to-day contributor access. Can create issues, write code, and run workflows. Cannot delete issues, manage projects, change settings, or manage integrations.

What Members CAN doWhat Members CANNOT do
Create and edit issuesDelete issues
Read projectsCreate, edit, or delete projects
Read and write codeManage integrations
Create and run workflowsEdit or delete workflows
Use AI chat and agentsManage agent configurations
Read teams and membersCreate, edit, or delete teams

Permission Reference

35 granular permissions organized in 11 groups (including the four cloud permissions added with ProxifAI Cloud).

Issues

PermissionDescription
issues.readView issues, labels, sprints, time entries
issues.createCreate issues, tickets, and feature requests
issues.editUpdate issues, manage labels, comments, views, and time entries
issues.deleteDelete issues, tickets, and feature requests
issues.dispatchDispatch issues to AI agents for automated resolution

Projects

PermissionDescription
projects.readView projects, initiatives, and documents
projects.createCreate projects and initiatives
projects.editUpdate projects, sprints, initiatives, and documents
projects.deleteDelete projects, sprints, initiatives, and documents
projects.membersManage project membership (add/remove members, change roles)

Members

PermissionDescription
members.readView organization members, roles, and permission definitions
members.inviteInvite new members to the organization
members.editEdit member roles, create/update/delete custom roles, set permission overrides
members.removeRemove members from the organization

Teams

PermissionDescription
teams.readView teams and team members
teams.createCreate new teams
teams.editUpdate teams, add/remove team members
teams.deleteDelete teams

Settings

PermissionDescription
settings.readView workspace settings, custom fields, model providers, event types
settings.editEdit workspace settings, manage secrets, model providers, custom fields, event types, SLA policies, canned responses, ticket tags, gateway rate limits and budgets, client management

Code

PermissionDescription
code.readRead repositories, branches, commits, files, pipeline runs and logs
code.writePush code, create/delete branches, create/merge PRs, manage releases and assets, dispatch/cancel pipelines, manage pipeline secrets/variables, configure branch protection rules, push rules, approval rules, protected tags, and deploy keys

Workflows

PermissionDescription
workflows.readView workflows, triggers, templates, and execution history
workflows.createCreate workflows, triggers, and templates; import workflows
workflows.editUpdate, delete, publish, and promote workflows, triggers, and templates
workflows.runExecute workflows, cancel/retry/resume executions, test triggers

Integrations

PermissionDescription
integrations.readView integrations and webhook configurations
integrations.manageCreate, update, delete integrations; manage inbound/outbound webhooks and Slack channel mappings; verify credentials

Agents

PermissionDescription
agents.readView AI agent configurations and execution history
agents.manageCreate, update, and delete AI agent configurations

Cloud (ProxifAI Cloud)

PermissionDescription
cloud.readView virtual clusters, workloads, deployments
cloud.execOpen shell sessions and run commands inside cloud workloads
cloud.queryQuery cloud-hosted databases via the dump/query endpoints
cloud.manageCreate, edit, and delete clusters; deploy and scale workloads

Admin

PermissionDescription
admin.accessSuper-admin access: manage all organizations, view all users via /api/v1/admin/*

Custom Roles

Create custom roles with any subset of the 35 permissions from Settings > Roles.

A custom role is a named collection of permissions:

{
  "name": "Reviewer",
  "description": "Can review code and manage PRs",
  "permissions": [
    "code.read",
    "code.write",
    "issues.read",
    "issues.edit"
  ]
}

Example custom roles:

RolePermissionsUse Case
Triage Leadissues.read, issues.edit, projects.readPrioritize and assign issues without code access
CI Operatorcode.read, workflows.runTrigger and monitor pipelines without editing definitions
External Contributorcode.read, code.write, issues.readPush code and read issues, nothing else
Security Auditorcode.read, settings.read, members.readRead-only access to code, settings, and member info

Per-User Permission Overrides

Individual users can have permissions explicitly granted or denied, regardless of their role assignments. Overrides are evaluated first and take priority.

  • Grant override — user gets the permission even if no role provides it
  • Deny override — user loses the permission even if a role provides it

Manage overrides via Settings > Members > [member] > Permission Overrides or the API:

PUT /api/v1/org/members/{userId}/permissions

Project-Level Roles

Beyond org-level permissions, users have per-project roles. Three values, defined in models.go:

RoleDescription
viewerRead-only access to the project
memberStandard contributor
leadCan manage project settings (members, status, repo links)

Users with the projects.edit org-level permission bypass project-level role checks entirely.

Personal Access Tokens

PATs provide scoped access for CI/CD, scripts, and the CLI. They use a separate scope system optimized for git and API access patterns.

Token Format

Tokens use the pfai_ prefix followed by 40 hex characters:

pfai_a1b2c3d4e5f6...

The full token value is shown only once at creation. It is stored as a SHA-256 hash and cannot be retrieved later.

Token Scopes

ScopeDescriptionImplies
readBroad read accessAll *:read scopes
writeBroad write accessread + all *:write scopes
repo:readRead repositories, branches, commits, files
repo:writePush code, create branches, manage releasesrepo:read
issues:readRead issues and comments
issues:writeCreate and update issuesissues:read
pr:readRead pull requests and reviews
pr:writeCreate, merge PRs and submit reviewspr:read
admin:readRead admin-level data
admin:writeModify admin-level dataadmin:read
pipelineTrigger and manage CI/CD pipelines

Scope Hierarchy

The write scope includes everything. Fine-grained write scopes imply their corresponding read scope:

write ⊇ read ⊇ repo:read, issues:read, pr:read, admin:read
write ⊇ repo:write, issues:write, pr:write, admin:write, pipeline
repo:write ⊇ repo:read
issues:write ⊇ issues:read
pr:write ⊇ pr:read
admin:write ⊇ admin:read

Git Authentication with PATs

Use a PAT as the password in Git HTTP basic auth (username is ignored):

git clone https://x-token:[email protected]/org/repo.git
OperationMinimum Scope
Clone/fetch (public repo)No token required
Clone/fetch (private repo)read or repo:read
Pushwrite or repo:write
Push to archived repoRejected (403)

CLI Commands

# Authentication
pfai auth login                  # OAuth login via browser
pfai auth status                 # Show current auth state
pfai auth token                  # Display JWT claims

# Roles & permissions
pfai org roles                   # List roles in your org
pfai org members                 # List members with roles
pfai org features                # List enabled features

# Personal access tokens
pfai token list                  # List your PATs
pfai token create --name "CI" --scopes read,pipeline
pfai token delete tok_abc123

# Check your permissions
pfai api GET /me/permissions     # Raw API call to see effective permissions

API Reference

Permission Management

GET    /api/v1/me/permissions                     # Your effective permissions
GET    /api/v1/org/permissions                     # All permission definitions
GET    /api/v1/org/roles                           # List roles
POST   /api/v1/org/roles                           # Create role
PATCH  /api/v1/org/roles/{id}                      # Update role
DELETE /api/v1/org/roles/{id}                      # Delete role
PUT    /api/v1/org/members/{userId}/roles          # Assign roles
GET    /api/v1/org/members/{userId}/permissions    # User's permissions
PUT    /api/v1/org/members/{userId}/permissions    # Set overrides

Token Management

GET    /api/v1/tokens                # List PATs
POST   /api/v1/tokens                # Create PAT
PATCH  /api/v1/tokens/{id}           # Update PAT
DELETE /api/v1/tokens/{id}           # Revoke PAT