Firstsawyou commented on a change in pull request #3691:
URL: https://github.com/apache/apisix/pull/3691#discussion_r584611151



##########
File path: apisix/plugins/consumer-restriction.lua
##########
@@ -84,20 +116,35 @@ local function is_include(value, tab)
     return false
 end
 
+local function is_method_allow(allowed_methods, method, user)
+    for key,value in ipairs(allowed_methods) do

Review comment:
       There should be a space after `,`, and `key` is not used, it should be 
replaced with a placeholder. like this:
   
   ```lua
   for _, value in ipairs(allowed_methods) do
   ```

##########
File path: apisix/plugins/consumer-restriction.lua
##########
@@ -84,20 +116,35 @@ local function is_include(value, tab)
     return false
 end
 
+local function is_method_allow(allowed_methods, method, user)
+    for key,value in ipairs(allowed_methods) do
+        if value.user == user then
+            for k,allowed_method in ipairs(value.methods) do

Review comment:
       ditto.

##########
File path: apisix/plugins/consumer-restriction.lua
##########
@@ -16,7 +16,7 @@
 --
 local ipairs    = ipairs
 local core      = require("apisix.core")
-
+local ngx          = ngx

Review comment:
       I think it is better to align with the above format, for example:
   
   ```lua
   local ipairs    = ipairs
   local core      = require("apisix.core")
   local ngx       = ngx
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to