Added admincheck to all adminroutes

This commit is contained in:
konrad 2018-01-23 15:27:08 +01:00 committed by kolaente
parent 4275a3acad
commit a92d711b00
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 17 additions and 0 deletions

View File

@ -11,6 +11,12 @@ import (
// UserAddOrUpdate is the handler to add a user
func UserAddOrUpdate(c echo.Context) error {
// Check if the user is admin
if !models.IsAdmin(c) {
return echo.ErrUnauthorized
}
// Check for Request Content
userFromString := c.FormValue("user")
var datUser *models.User

View File

@ -10,6 +10,11 @@ import (
// UserDelete is the handler to delete a user
func UserDelete(c echo.Context) error {
// Check if the user is admin
if !models.IsAdmin(c) {
return echo.ErrUnauthorized
}
id := c.Param("id")
// Make int

View File

@ -8,6 +8,12 @@ import (
)
func UserShow(c echo.Context) error {
// Check if the user is admin
if !models.IsAdmin(c) {
return echo.ErrUnauthorized
}
user := c.Param("id")
if user == "" {