Comments (4)
Originally I was only going only for a marking based on method name, but it seems like it's actually not that difficult, the middleware appears in the JSON output:
{
"domain": "demo.test",
"method": "GET|HEAD",
"uri": "ajax/cis/create",
"name": "ajax.cis.create",
"action": "App\\Http\\Controllers\\Ajax\\CiAjaxController@create",
"middleware": [
"web",
"backend",
"auth",
"can:create,App\\Models\\Ci" // <-- here
]
}
from jetbrains-laravel-make-integration.
That's a really nice idea. I had something similar in mind for endpoints that require authentication, but never thought of authorization. Maybe the gutter icon could have a little 🔒 in the lower right corner.
The implementation might require lots of effort. At the moment the plugin receives its information by running artisan route:list --json
. This includes e.g the class and method name, which is how we can map the routes to the source code. I don't think the output contains information regarding any policies. We would need to retrieve this somewhere else, maybe by executing code in the context of the application using artisan tinker
.
from jetbrains-laravel-make-integration.
That's very good news and simplifies the implementation a lot!
I think a "proper" would also check that the can
middleware alias resolves to \Illuminate\Auth\Middleware\Authorize
, but I think this can just be assumed for the initial version. Similar assumptions should be reasonable for the auth
middleware.
For the logo I think it would be reasonable to replace the globe in the existing icon with a lock (e.g. search for "lock" on the JetBrains Icons List). Not sure how to differentiate authorization and authentication here (maybe only one applies, but as in your example, both could be required).
Since the endpoint is also "connected" to a specific policy method, the plugin could maybe add it to the "related symbol" list, which might ease navigation. But I am not 100% sure how to do that or if this API is publicly accessible.
from jetbrains-laravel-make-integration.
Assuming that can
and auth
resolve to the standard middlewares is fair I think, nobody in their fair mind should replace them with something fundamentally/functionally different (imo).
Personally I think having authorization without authentication makes absolutely no sense (although some might do that as a shortcut maybe?), so handling that case imo doesn't make any sense.
Going back to the policy is tricky at best I think considering how many ways there are to set one and them falling back to the next one, not sure if that is worthwhile. Probably easier to parse the arguments of the middleware and display that in some manner.
from jetbrains-laravel-make-integration.
Related Issues (20)
- Add support for PhpStorm 2023.1 (EAP) HOT 3
- Add support for PhpStorm 2023.2 HOT 3
- Support for Laravel 8 on MacOS and PhpStorm 2023.3.2 HOT 1
- plugin crash in phpstorm 2023.3.2
- Clearer documentation (especially on the marketplace)
- Tooltip explaining why some options are not always available HOT 1
- phpstorm-2020.3.3 HOT 1
- Laravel project in sub directory HOT 4
- Can't create controller in app\Http\Controllers HOT 2
- exception when loading laravel project HOT 2
- Links to Middleware in Routes tool window and other places
- [new feature] Disable plugin when you open a non Laravel project HOT 3
- Support new `database/seeders` directory HOT 1
- Files with root permission when using sail PHP interpreter HOT 1
- Add support to PhpStorm 2022.2 HOT 1
- Support Livewire & `Route::view` routes HOT 2
- Working on non-laravel project error HOT 2
- Feature: Show route names HOT 2
- Bug: "Could not extract JSON while introspecting. Source" HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jetbrains-laravel-make-integration.