This project demonstrates how to utilize Cerbos with Cerbos Laravel SDK.
- Run
composer install
andnpm install
to install dependencies. - Run
docker compose up
to launch acerbos
andmysql
instance. - Run
php artisan migrate
to migrate database schema to themysql
instance. - Run
php artisan serve
to serve the Laravel application.
Register a user
{
"email": "someone@someone.com",
"password": "123",
"name": "Someone",
"roles": "USER,MANAGER",
"region": "EU",
"department": "IT"
}
Login with e-mail and password
{
"email": "someone@someone.com",
"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 | sally@sally.co | 123 | USER | SALES | EMEA |
2 | Ian | ian@ian.co | 123 | ADMIN | IT | - |
3 | Frank | frank@frank.co | 123 | USER | FINANCE | EMEA |
4 | Derek | derek@derek.co | 123 | USER, MANAGER | FINANCE | EMEA |
5 | Simon | simon@simon.co | 123 | USER, MANAGER | SALES | NA |
6 | Mark | mark@mark.co | 123 | USER, MANAGER | SALES | EMEA |
7 | Sydney | sydney@syndey.co | 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 |