Created
January 16, 2012 02:48
-
-
Save cthom06/1618776 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func wrapHandler(f func(user, request), perm int) func(request) { | |
return func(r request) { | |
user := getuser(r) | |
if user.priv < perm { | |
write("no permission foo'!") | |
} else { | |
f(user, r) | |
} | |
} | |
} | |
func userPage(user, request) { ... } | |
http.Handle("/someurl", wrapHandler(userPage, 1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment