[lunox-core] Need Gate and Policy feature for Advance Authorization
axmad386 opened this issue · 0 comments
axmad386 commented
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
- Gate.define
- Gate.authorize
- Gate.before
- Gate.after
- 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
{
// ...
}
}