[ ] Abstract class of Policy, or just interface to make Policy object
[ ] can middleware, its like Gate.authorize but via middleware
Also we need AuthServiceProvider can register policies like this
import Post from "../app/Models/Post";
import {ServiceProvider} from "@lunoxjs/core";
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*/
protected policies: [Class<any>,typeof Policy][]= [
[Post, PostPolicy], // are we can do this in typescript?
];
/**
* Register any application authentication / authorization services.
*/
public function boot(): void
{
// ...
}
}
In laravel, we can use gate and policy to handle authorization. See https://laravel.com/docs/10.x/authorization#introduction But maybe we can start from simple version
can
middleware, its like Gate.authorize but via middlewareAlso we need AuthServiceProvider can register policies like this