Course contentsShow
← System Design
Lesson 938 of 1,91924. Authentication and Authorization at ScaleFree lesson

Relationship-Based Access Control (ReBAC)

Authorize based on relationships between entities, like followers or team membership.

Relationship-Based Access Control (ReBAC)

What you'll learn: How to authorize access based on the relationships between users and resources, enabling dynamic permission models that reflect real-world social and organizational connections.

The Core Idea

Relationship-Based Access Control (ReBAC) determines whether a user can access a resource by examining the graph of relationships connecting them. Instead of assigning static roles (like RBAC) or evaluating attribute rules (like ABAC), ReBAC asks: "What is the relationship between this user and this resource?"

Think of social media: you can view a post because you're friends with the author, or a member of the same group, or following them. Your access derives from these dynamic, interconnected relationships rather than fixed roles.

How ReBAC Works

ReBAC models your system as a graph:

  • Nodes represent entities (users, documents, organizations, teams)
  • Edges represent relationships (owns, member_of, can_view, parent_org)

When checking authorization, the system performs a graph traversal to determine if a valid relationship path exists between the requesting user and the target resource.

Example scenario:

  • Alice owns Document X
  • Bob is on Team Y
  • Alice shared Document X with Team Y
  • Query: Can Bob read Document X?
  • Answer: Yes, because Bob → member_of → Team Y → can_view → Document X

When ReBAC Shines

ReBAC excels in systems where access naturally follows organizational hierarchies, social networks, or ownership chains. Google Drive's sharing model, GitHub's repository permissions, and Slack's workspace access all leverage relationship-based logic.

Unlike RBAC's rigid roles or ABAC's complex policies, ReBAC scales naturally with your data structure and reflects how people actually think about permissions: "Can my team see this?" or "Who did I share this with?"

Key Takeaway:
ReBAC authorizes access by traversing relationship graphs between users and resources, making it ideal for systems with dynamic, interconnected permission models like social platforms and collaborative tools.