search

Home  >  Q&A  >  body text

php - Want to manage permissions for each route, but there are placeholders in the route definition?

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

大家讲道理大家讲道理2716 days ago794

reply all(3)I'll reply

  • 女神的闺蜜爱上我

    女神的闺蜜爱上我2017-06-23 09:13:32

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

    reply
    0
  • 黄舟

    黄舟2017-06-23 09:13:32

    Hash key plus regularity?

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-06-23 09:13:32

    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

    reply
    0
  • Cancelreply