This PR introduces an ownershipMiddleware to enhance access control for resources in the application. The middleware ensures that a user cannot access a resource unless they meet one of the following conditions:
They are the owner of the resource.
They are associated with the resource as a student.
Key Features
Ownership Verification: Checks if the user is the owner of the resource by verifying specified ownership fields.
Optional Relationship Check: Adds support for verifying relationships (e.g., student membership) if a relationship model is provided.
Flexible Parameters:
Accepts the resource model.
Accepts fields that determine ownership.
Optionally accepts a relationship model for additional association checks.
Description
This PR introduces an
ownershipMiddleware
to enhance access control for resources in the application. The middleware ensures that a user cannot access a resource unless they meet one of the following conditions:Key Features