Fintech & Banking
Explore Mercury’s Authorization Schema in this example, delving into the intricate interplay among users, organizations, and accounts. Uncover the defined user roles, approval workflows, and limits, providing a snapshot of the dynamic relationships within the Mercury ecosystem.
For those who don’t know, Mercury is a bank offering both checking and savings accounts, complete with debit and credit card features. Given the delicate nature of financial transactions, Mercury has built-in access control features to ensure security.
But today we’re going to focus on approvals. Mercury allows it’s users to set a number amount for multiple user approval for any action.
For instance, an admin can decide that withdrawals above $1000 by members require approval from two designated approvers.
This means, if a member wants to withdraw more than $1000, they need a green light from two admin. And if an admin tries to withdraw they need an approval form another admin.
- Admin → Withdraw $1000 → needs an approver
- Member → Withdraw $1000 → needs 2 approvers.
Full Schema | Open in playground
So let’s start with building basics. We need Users, Organization, Accounts both Savings and Deposits as entities in the mercury
Then inserting relations into these entities.
Next step is to define actions in our use case.
Now we need to define our attributes which will help us create access rights via Withdraw Limit and Admin Approval of the account.
Every organization has a set withdrawal limit. Additionally, for members and admins of the organization, there are specific approval limits in place when they attempt to withdraw amounts exceeding this limit.
Let’s create our rules that defines our attribute-based access rights.
- Balance of the account must be more than withdraw amount
- If withdraw amount is less than the withdraw limit we don’t need approval
- Else; we need approve of two admins if we’re member, and we need approve of single admin if we’re another admin.
At last, as you can see we use the Rules to define access rights to withdraw which basically translates into;
- Check balance if it’s over the withdraw amount. If not don’t allow the action.
- Check withdraw limit; if it’s less than the limit allow the action…
- Else;
- Check if user is admin, and have approval more than the approval limit for admins.
- Check if user is member, and have approval more than the approval limit for members.
Need any help ?
This is the end of demonstration of the authorization structure for Facebook groups. To install and implement this see the Set Up Permify section.