From 801148e7d015ee427f23410b742fa0472ea1f20b Mon Sep 17 00:00:00 2001 From: mlabusch Date: Fri, 28 Apr 2017 10:10:25 +0200 Subject: [PATCH] [QS] commenting --- lib/http/permission.go | 4 ++++ lib/http/permission_test.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/http/permission.go b/lib/http/permission.go index 698e4f2..8efe8bf 100644 --- a/lib/http/permission.go +++ b/lib/http/permission.go @@ -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") diff --git a/lib/http/permission_test.go b/lib/http/permission_test.go index 0086f4b..e4e27f2 100644 --- a/lib/http/permission_test.go +++ b/lib/http/permission_test.go @@ -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)