     return if specialMethod is false
     #由业务逻辑指定的处理处理
     if specialMethod and biz[specialMethod]
-      console.log specialMethod, path
       #console.log(path, specialMethod)
-      app[method] path, ()->
-        biz[specialMethod].apply biz, Array.prototype.slice.call(arguments)
+      app[method] path, (req, res, next)->
+        #检查权限
+        requestPermission(method, router, req, res) && biz[specialMethod].call(biz, req, res, next)
       return
 
     #处理常规则的method
     app[method] path, (req, res, next)->
+      #用户校验
+      return if not requestPermission(method, router, req, res)
       #处理data部分
       data = {}
       switch method

###
_ = require 'underscore'
_config = require './config.json'


#获取crud的默认path
getPaths = (router)->
  paths = {}


  ["post", "get", "put", "delete"].forEach (method)->
    #如果有指定paths，优先取指定method的path，如果没有取到，则取paths.all
    #假如在paths中没有取到，则拼装path
    path = (router.paths && (router.paths[method] || router.paths.all)) ||
      "#{_config.rootAPI}#{router.path}#{pathPuffix[method]}"
    #替换掉路径中的变量
