<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Furkan Gürbüz</title>
    <description>The latest articles on DEV Community by Furkan Gürbüz (@furkangrbz).</description>
    <link>https://dev.to/furkangrbz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4282203%2F7ab4d8c4-1343-46c9-b3da-bee66301077f.jpg</url>
      <title>DEV Community: Furkan Gürbüz</title>
      <link>https://dev.to/furkangrbz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/furkangrbz"/>
    <language>en</language>
    <item>
      <title>Beyond RBAC: Designing Secure Authorization for Multi-Role Business Applications</title>
      <dc:creator>Furkan Gürbüz</dc:creator>
      <pubDate>Fri, 04 Dec 2026 07:58:44 +0000</pubDate>
      <link>https://dev.to/furkangrbz/beyond-rbac-designing-secure-authorization-for-multi-role-business-applications-48nc</link>
      <guid>https://dev.to/furkangrbz/beyond-rbac-designing-secure-authorization-for-multi-role-business-applications-48nc</guid>
      <description>&lt;p&gt;A user successfully logs into your application. They have a valid session, a recognized role, and access to their dashboard.&lt;/p&gt;

&lt;p&gt;Does that mean they should be allowed to access every resource associated with that role?&lt;/p&gt;

&lt;p&gt;Absolutely not.&lt;/p&gt;

&lt;p&gt;When building business applications with multiple user roles, authentication is only the beginning. The real engineering challenge is determining &lt;strong&gt;who can perform which action, on which resource, under which conditions.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;My work on logistics management and real-time education platforms has made this distinction particularly relevant to how I approach backend architecture.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Why Traditional RBAC Is Not Enough
&lt;/h2&gt;

&lt;p&gt;Role-Based Access Control (RBAC) is a useful starting point for authorization.&lt;/p&gt;

&lt;p&gt;Consider a logistics management application with four roles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Administrator&lt;/li&gt;
&lt;li&gt;Operations Manager&lt;/li&gt;
&lt;li&gt;Driver&lt;/li&gt;
&lt;li&gt;Customer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each role has different responsibilities. Administrators manage the system, operations teams coordinate shipments, drivers perform deliveries, and customers track their shipments.&lt;/p&gt;

&lt;p&gt;However, knowing a user's role does not necessarily tell us which records they should access.&lt;/p&gt;

&lt;p&gt;A customer should not see another customer's shipments.&lt;/p&gt;

&lt;p&gt;A driver should not modify shipments assigned to another driver.&lt;/p&gt;

&lt;p&gt;An operations manager should not automatically access data belonging to another organization.&lt;/p&gt;

&lt;p&gt;A role defines general responsibilities. It does not establish the complete security boundary.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Authorization Should Have Multiple Layers
&lt;/h2&gt;

&lt;p&gt;A reliable authorization model should evaluate several independent conditions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Authentication:&lt;/strong&gt; Is the user's identity verified?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Permission:&lt;/strong&gt; Is the requested action allowed?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Organization scope:&lt;/strong&gt; Does the resource belong to an organization the user can access?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resource ownership:&lt;/strong&gt; Is the user authorized to access this particular object?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Business constraints:&lt;/strong&gt; Is the requested action valid in the current workflow state?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Conceptually, the request flow looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Incoming Request
       |
Authentication
       |
Permission Check
       |
Organization Scope
       |
Resource-Level Authorization
       |
Business Rule Validation
       |
Database Operation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A request should proceed only when all required conditions are satisfied.&lt;/p&gt;

&lt;p&gt;Every missing or unrecognized permission should result in denial by default.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. The Frontend Is Not a Security Boundary
&lt;/h2&gt;

&lt;p&gt;One common architectural mistake is implementing authorization primarily through the user interface.&lt;/p&gt;

&lt;p&gt;Hiding a button, disabling a menu item, or restricting a dashboard route can improve the user experience.&lt;/p&gt;

&lt;p&gt;But none of these measures independently protects the backend.&lt;/p&gt;

&lt;p&gt;Every sensitive server-side operation must enforce its own authorization requirements, regardless of how the request reaches the application.&lt;/p&gt;

&lt;p&gt;Consider this simplified PHP authorization policy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;canUpdateShipment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;Shipment&lt;/span&gt; &lt;span class="nv"&gt;$shipment&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;organizationId&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="nv"&gt;$shipment&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;organizationId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;hasPermission&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'shipment.update'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;match&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;role&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="s1"&gt;'admin'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'operations'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'driver'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$shipment&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;driverId&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This illustrative example combines three authorization dimensions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Organization isolation&lt;/li&gt;
&lt;li&gt;Action-specific permissions&lt;/li&gt;
&lt;li&gt;Resource-level restrictions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In production, the requested changes must also be validated against field-level permissions and business rules. A driver allowed to update a delivery status should not automatically be allowed to change shipment pricing or customer information.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Keep Authorization Close to the Business Logic
&lt;/h2&gt;

&lt;p&gt;I prefer an architectural approach in which API endpoints remain thin and business logic lives in dedicated services.&lt;/p&gt;

&lt;p&gt;A typical application structure might look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Application
├── Controllers
├── Middleware
├── Authorization
│   ├── Policies
│   └── Permissions
├── Services
├── Repositories
└── Models
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Middleware handles common request-level concerns, such as authentication.&lt;/p&gt;

&lt;p&gt;Authorization policies determine whether a specific action is permitted.&lt;/p&gt;

&lt;p&gt;Services enforce business rules and coordinate operations.&lt;/p&gt;

&lt;p&gt;Repositories handle persistence and scoped data access.&lt;/p&gt;

&lt;p&gt;This separation reduces duplicated logic and makes authorization easier to test, maintain, and review.&lt;/p&gt;

&lt;p&gt;It also helps prevent permission rules from becoming scattered across controllers, templates, and individual API endpoints.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Build an Authorization Matrix Before Writing Endpoints
&lt;/h2&gt;

&lt;p&gt;An authorization matrix is one of the most practical tools for designing a multi-role application.&lt;/p&gt;

&lt;p&gt;Here is an illustrative matrix for a logistics system:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Action&lt;/th&gt;
&lt;th&gt;Admin&lt;/th&gt;
&lt;th&gt;Operations&lt;/th&gt;
&lt;th&gt;Driver&lt;/th&gt;
&lt;th&gt;Customer&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Create shipment&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Limited&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Assign driver&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Update delivery status&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Assigned&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;View shipment&lt;/td&gt;
&lt;td&gt;Scoped&lt;/td&gt;
&lt;td&gt;Scoped&lt;/td&gt;
&lt;td&gt;Assigned&lt;/td&gt;
&lt;td&gt;Own&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Manage users&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;View audit logs&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Limited&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Permissions remain subject to organization boundaries and applicable business constraints.&lt;/p&gt;

&lt;p&gt;The matrix should serve as a technical specification rather than just documentation.&lt;/p&gt;

&lt;p&gt;For every new endpoint, developers should know which roles can access it, which resource restrictions apply, and what must happen when authorization fails.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Authorization Testing Is Not Optional
&lt;/h2&gt;

&lt;p&gt;Testing successful requests is insufficient.&lt;/p&gt;

&lt;p&gt;A security-focused test suite must also verify that unauthorized operations are rejected.&lt;/p&gt;

&lt;p&gt;Important test scenarios include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A customer cannot access another customer's records.&lt;/li&gt;
&lt;li&gt;A driver cannot modify an unassigned shipment.&lt;/li&gt;
&lt;li&gt;Users cannot access resources outside their organization.&lt;/li&gt;
&lt;li&gt;Revoked permissions are enforced.&lt;/li&gt;
&lt;li&gt;Unrecognized roles receive no implicit access.&lt;/li&gt;
&lt;li&gt;Bulk operations validate every affected resource.&lt;/li&gt;
&lt;li&gt;Exported reports respect the same authorization boundaries as the application.&lt;/li&gt;
&lt;li&gt;Background jobs do not bypass authorization requirements.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Authorization tests should run automatically as part of the development and deployment process.&lt;/p&gt;

&lt;p&gt;The objective is not merely to demonstrate that authorized users can complete their work.&lt;/p&gt;

&lt;p&gt;It is also to demonstrate that unauthorized access consistently fails.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. The Same Principles Apply Beyond Logistics
&lt;/h2&gt;

&lt;p&gt;Multi-role authorization is not limited to enterprise logistics applications.&lt;/p&gt;

&lt;p&gt;In an online education platform, teachers, students, and administrators interact with different resources and permissions.&lt;/p&gt;

&lt;p&gt;A student may be authorized to join a particular live classroom without being authorized to access every recorded lesson.&lt;/p&gt;

&lt;p&gt;A teacher may manage their own classes without having access to another teacher's students.&lt;/p&gt;

&lt;p&gt;Access to media recordings, examination results, and administrative functionality should be evaluated independently.&lt;/p&gt;

&lt;p&gt;Different business domains introduce different rules, but the underlying architectural principle remains the same:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authorize the action against the resource, not just the user's role.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Design for Long-Term Maintainability
&lt;/h2&gt;

&lt;p&gt;As applications grow, authorization becomes increasingly difficult to maintain.&lt;/p&gt;

&lt;p&gt;New roles are introduced. Business workflows change. Integrations are added. Existing permissions become more granular.&lt;/p&gt;

&lt;p&gt;Without a structured authorization architecture, these changes can create inconsistent behavior and security regressions.&lt;/p&gt;

&lt;p&gt;A maintainable system should include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Centralized authorization policies&lt;/li&gt;
&lt;li&gt;Explicit permission definitions&lt;/li&gt;
&lt;li&gt;Resource-level access controls&lt;/li&gt;
&lt;li&gt;Organization-scoped data access&lt;/li&gt;
&lt;li&gt;Automated authorization tests&lt;/li&gt;
&lt;li&gt;Auditable sensitive operations&lt;/li&gt;
&lt;li&gt;Documented security boundaries&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Security should be an architectural responsibility, not a collection of patches added after development.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Building a secure multi-role application requires more than implementing login screens and assigning roles.&lt;/p&gt;

&lt;p&gt;RBAC is a foundation, not a complete authorization strategy.&lt;/p&gt;

&lt;p&gt;The most important question is not:&lt;/p&gt;

&lt;p&gt;"What role does this user have?"&lt;/p&gt;

&lt;p&gt;It is:&lt;/p&gt;

&lt;p&gt;"Should this user be allowed to perform this specific action on this specific resource, under these specific conditions?"&lt;/p&gt;

&lt;p&gt;Answering that question consistently across the entire application is what makes an authorization system reliable.&lt;/p&gt;

&lt;p&gt;For more information about the architectural principles behind my work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://furkangurbuz.dev/en/system-architecture/" rel="noopener noreferrer"&gt;System Architecture&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://furkangurbuz.dev/en/projects/logistics-management-platform/" rel="noopener noreferrer"&gt;Logistics Management Platform — Technical Case Study&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;About the author&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Furkan Gürbüz is a software developer, operations manager, and technology entrepreneur focused on backend architecture, enterprise applications, business process automation, and digital transformation.&lt;/p&gt;

&lt;p&gt;Technical portfolio: &lt;a href="https://furkangurbuz.dev" rel="noopener noreferrer"&gt;furkangurbuz.dev&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;AI disclosure: This article was drafted with AI assistance using publicly documented project architecture and illustrative technical examples.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>security</category>
      <category>architecture</category>
      <category>backend</category>
    </item>
  </channel>
</rss>
