1. Model Your Application’s Authorization
Before diving into writing your authorization in a policy, you’ll want to have a clear picture of the application and its parts. As depicted in the diagram above, the human resources app hosts many organizations. Each organization has its own set of users and those users have one of two roles: admin or employee. Users of this application have the ability to perform actions based on their role, but **only** within their organization. Our authorization policy should exist to enforce this view of the world.
In this section you will:
- Create a policy that models multi-tenancy in an human resources application.
- Copy and paste the policy into your Oso Cloud Rules Editor (opens in a new tab).
Putting the Building Blocks in Place
To begin building the policy, answer the following questions:
- Who uses the application? (Users within an organization).
- What resources make up the application? (Organizations).
- What actions require authorization before a user can perform them? (Getting an admin view and getting an employee view of the application).
- How are permissions granted within the application? (Through roles).
- How are permissions attached to roles? (Through logic rules).
Now, all that’s left to do is write what we know in Polar!
Action Items
The next step is to add some authorization data.
Additional Resources
Talk to an Oso Engineer
If you'd like to learn more about using Oso Cloud in your app or have any questions about this guide, connect with us on Slack. We're happy to help.