Added admincheck to all adminroutes
This commit is contained in:
parent
4275a3acad
commit
a92d711b00
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 == "" {
|
||||
|
|
Loading…
Reference in New Issue