Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lunox-core] Need Gate and Policy feature for Advance Authorization #37

Open
6 tasks
axmad386 opened this issue Apr 13, 2023 · 0 comments
Open
6 tasks
Labels
enhancement New feature or request help wanted Extra attention is needed nice to have Nice to be implemented, but not urgent

Comments

@axmad386
Copy link
Member

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
    {
        // ...
    }
}
@axmad386 axmad386 added enhancement New feature or request help wanted Extra attention is needed nice to have Nice to be implemented, but not urgent labels Apr 13, 2023
@axmad386 axmad386 added this to the v2.0.0 milestone Apr 13, 2023
@axmad386 axmad386 removed this from the v2.0.0 milestone May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed nice to have Nice to be implemented, but not urgent
Projects
None yet
Development

No branches or pull requests

1 participant