[QS] commenting
This commit is contained in:
parent
9378941a3f
commit
801148e7d0
|
@ -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")
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Reference in New Issue