genofire/hs_monolith
genofire
/
hs_monolith
Archived
1
0
Fork 0

[QS] commenting

This commit is contained in:
mlabusch 2017-04-28 10:10:25 +02:00
parent 9378941a3f
commit 801148e7d0
2 changed files with 8 additions and 0 deletions

View File

@ -1,9 +1,13 @@
// Package http provides the
// logic of the webserver
package http
import "net/http"
type HasPermission func(string, int) (bool, error)
//Function to evaluate the permission and implent an error handling
// Input: http response writer w, pointer to htto request r, bool variable HasPermission perm, int variable permission (form)
func PermissionHandler(h func(w http.ResponseWriter, r *http.Request), perm HasPermission, permission int) func(w http.ResponseWriter, r *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
session, err := r.Cookie("session")

View File

@ -1,3 +1,5 @@
// Package http provides the
// logic of the webserver
package http
import (
@ -9,6 +11,8 @@ import (
"github.com/stretchr/testify/assert"
)
// Function to the the permission and it's error handling
// Input: pointer to testing object T
func TestPermission(t *testing.T) {
assert := assert.New(t)