This project demonstrates how to utilize Cerbos with Cerbos Laravel SDK.
- Run
composer installandnpm installto install dependencies. - Run
docker compose upto launch acerbosandmysqlinstance. - Run
php artisan migrateto migrate database schema to themysqlinstance. - Run
php artisan serveto serve the Laravel application.
Register a user
{
"email": "[email protected]",
"password": "123",
"name": "Someone",
"roles": "USER,MANAGER",
"region": "EU",
"department": "IT"
}Login with e-mail and password
{
"email": "[email protected]",
"password": "123"
}Logout
List all expenses the logged-in user authorized to view
Get expense by ID if logged-in user is authorized to view
Create new expense
{
"amount": 500,
"region": "EMEA",
"vendor": "ACME Inc."
}Delete the expense by ID if logged-in user is authorized to delete
Update the expense by ID if logged-in user is authorized to update
{
"amount": 500,
"region": "EMEA",
"vendor": "ACME Inc."
}Approve the expense by ID if logged-in user is authorized to approve
Reject the expense by ID if logged-in user is authorized to reject
Running php artisan db:seed seeds the database with the following rows.
| ID | Name | Password | Roles | Department | Region | |
|---|---|---|---|---|---|---|
| 1 | Sally | [email protected] | 123 | USER | SALES | EMEA |
| 2 | Ian | [email protected] | 123 | ADMIN | IT | - |
| 3 | Frank | [email protected] | 123 | USER | FINANCE | EMEA |
| 4 | Derek | [email protected] | 123 | USER, MANAGER | FINANCE | EMEA |
| 5 | Simon | [email protected] | 123 | USER, MANAGER | SALES | NA |
| 6 | Mark | [email protected] | 123 | USER, MANAGER | SALES | EMEA |
| 7 | Sydney | [email protected] | 123 | USER | SALES | NA |
| ID | Vendor | Region | Owner ID | Approved By ID | Amount | Status |
|---|---|---|---|---|---|---|
| 1 | Flux Water Gear | EMEA | 1 | - | 500 | OPEN |
| 2 | Vortex Solar | EMEA | 1 | 3 | 2500 | APPROVED |
| 3 | Global Airlines | EMEA | 1 | - | 12000 | OPEN |
| 4 | Vortex Solar | EMEA | 3 | - | 2421 | OPEN |
| 5 | Vortex Solar | EMEA | 1 | 3 | 2500 | REJECTED |