read:catalog-item
read:customer-profile
create:invoice
Gift Shop Manager
and add these permissions to that role.
Similarly, you create permissions for users of your marketing module, which include:
create:newsletter
edit:newsletter
delete:newsletter
send:newsletter
edit:distribution-list
Newsletter Admin
and add these permissions to that role.
Now, when your animal rescue brings in their volunteer, Astrid, to run their pop-up t-shirt shop, Astrid can be assigned the role of Gift Shop Manager
. When you assign this role to Astrid, she is granted all the permissions that you assigned to the role. Since Astrid knows nothing about publishing newsletters (and isn’t the best with email), you never assigned her the Newsletter Admin
role, so she never has access to the marketing module.
From a more technical perspective, when Astrid logs into your product, Auth0 authenticates and authorizes her and includes the permissions in the returned . Then, your product inspects the token to learn which module to display to Astrid.
By using Auth0’s RBAC, you avoid building and maintaining separate authorization systems; instead, you use the token you already receive during authorization. And when Astrid moves away or decides she is tired of running the gift shop and would rather coordinate the foster program, you can easily remove the Gift Shop Manager role from her and assign her a new role.
And if maintaining the roles and permissions for all of your customers becomes too unwieldy, you can also use the Auth0 API to create a module within your product that allows customers to manage their own RBAC, thereby reducing liability and cutting staffing costs.