Thanks for reading my blog Bashko Ali!
While this is just a boilerplate for RBAC needs.
To get the resource_id in the middleware, you can either add it to the request object or extract it from the request URL.
Adding it to the request object would involve modifying the routing code to pass the resource_id to the middleware.
Extracting it from the request URL would involve parsing the URL and extracting the resource_id from it.
You can also improve this and share.