php - Want to manage permissions for each route, but there are placeholders in the route definition?
大家讲道理
大家讲道理 2017-06-23 09:11:32
0
3
754

If I want to use a hash table to find the permissions, the permission processing should be placed in the middleware.
For example, for the GET /users route, the permissions I indicate are users.read

But for the GET /users/:id route, the actual value may be /users/1, so the hash key is difficult to write

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(3)
女神的闺蜜爱上我

From /users/1, find the route GET /users/:id, and then determine permission control based on this route.

黄舟

Hash key plus regularity?

给我你的怀抱

Regular matching to obtain the id value, and then hget to obtain permissions. However, this suggestion is written in lua on the nginx module. There is no need to let the request go to the application stage

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!