cloudcreativity / laravel-json-api

JSON API (jsonapi.org) package for Laravel applications.
http://laravel-json-api.readthedocs.io/en/latest/
Apache License 2.0
780 stars 109 forks source link

[Question] [Documentation? ] Authorizers for custom actions #583

Closed DenisaHalmaghi closed 3 years ago

DenisaHalmaghi commented 3 years ago

Hello there!

Is there any way in which I can include my custom json-api controller actions in a json-api authorizer? We can currenly do this inside an authorizer:

public function create($type, $request)
    {
        $this->authorize('create', $type);
    }

Can we also do something like this?

public function myCustomAction($type, $request)
    {
        $this->authorize('something', $type);
    }

I don't really like doing controller authrorization, would really like it to have the authorization in one class, such as an Authorizer.

Thank you for your time!

osteel commented 3 years ago

If someone else ends up on this issue like I just did, it looks like it's been answered here already.