fix middleware + add example for manifest scope

This commit is contained in:
Adrien Marquès 2018-07-07 23:35:29 +02:00
parent ee82f48ada
commit d5b9567663
2 changed files with 5 additions and 5 deletions

View File

@ -10,7 +10,7 @@
"POST": {
"info": "creates a new tiny url",
"scope": [[]],
"scope": [["admin"]],
"in": {
"URL#0": { "info": "preferred tiny url", "type": "varchar(1,30)", "name": "url" },
"target": { "info": "url to shorten", "type": "varchar(5,300)" }
@ -20,7 +20,7 @@
"PUT": {
"info": "overrides an existing tiny url",
"scope": [[]],
"scope": [["admin"]],
"in": {
"URL#0": { "info": "preferred tiny url", "type": "varchar(1,30)", "name": "url" },
"target": { "info": "url to shorten", "type": "varchar(5,300)" }
@ -30,7 +30,7 @@
"DELETE": {
"info": "removes an existing tiny url",
"scope": [[]],
"scope": [["admin"]],
"in": {
"URL#0": { "info": "preferred tiny url", "type": "varchar(1,30)", "name": "url" }
},

View File

@ -6,6 +6,6 @@ import (
)
// Authentication middleware
func Inspect(req http.Request, scope middleware.Scope){
scope = append(scope, "user");
func Inspect(req http.Request, scope *middleware.Scope) {
*scope = append(*scope, "admin")
}