docs: function setRuleRoute (roles, rule, rules, origRule) {
      // allow/deny is last element of rule
      var allow = rule.pop()
      // blanket rule for all models
      if (rule.length === 0) {
          // create role access rule map
          if (!rules.allow) {
              rules.allow = {}
          }
          // set rule for each role
          _.each(roles, role => {
              rules.allow[role] = allow
          })
          // break
          return
      }
  
      // path name is first clause of rule
      var path = rule.shift()
      // path must start with /
      assert.ok(path.charAt(0) === '/', 'path must start with slash '+origRule)
      // if path ends in / append index
      if (path.charAt(path.length - 1) === '/') {
          path = path + 'index';
      }
      // split path into segments
      var segments = path.split('/')
      // discard first empty segment of path
      segments.shift()
      // require atleast one path segment
      assert.ok(segments[0].length, 'invalid path '+origRule)
      // path rule starts from root of rools structure and will be nested
      // as many layers deep as there are segments
      var pathRule = rules
      // iterate over each path segment creating nested rule
      _.each(segments, segment => {
          // create map of paths
          if (!pathRule.path) {
              pathRule.path = {}
          }
          // create entry for path
          if (!pathRule.path[segment]) {
              pathRule.path[segment] = {}
          }
          // move pathRule cursor to nested structure
          pathRule = pathRule.path[segment]
      })
      // blanket rule for single path
      if (rule.length === 0) {
          // create role access rule map
          if (!pathRule.allow) {
              pathRule.allow = {}
          }
          // set rule for each role
          _.each(roles, role => {
              pathRule.allow[role] = allow
          })
      }
      // rule for method
      else if (rule.length === 1) {
          var method = rule.shift()
          // create map of methods
          if (!pathRule.method) {
              pathRule.method = {}
          }
          // create method entry
          if (!pathRule.method[method]) {
              pathRule.method[method] = {}
          }
          // create role access rule map
          if (!pathRule.method[method].allow) {
              pathRule.method[method].allow = {}
          }
          // set rule for each role
          _.each(roles, role => {
              pathRule.method[method].allow[role] = allow
          })
      }
      // invalid rule
      else {
          throw new Error('invalid rule '+origRule)
      }
  }