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
|
// UserAddOrUpdate is the handler to add a user
|
||||||
func UserAddOrUpdate(c echo.Context) error {
|
func UserAddOrUpdate(c echo.Context) error {
|
||||||
|
|
||||||
|
// Check if the user is admin
|
||||||
|
if !models.IsAdmin(c) {
|
||||||
|
return echo.ErrUnauthorized
|
||||||
|
}
|
||||||
|
|
||||||
// Check for Request Content
|
// Check for Request Content
|
||||||
userFromString := c.FormValue("user")
|
userFromString := c.FormValue("user")
|
||||||
var datUser *models.User
|
var datUser *models.User
|
||||||
|
|
|
@ -10,6 +10,11 @@ import (
|
||||||
// UserDelete is the handler to delete a user
|
// UserDelete is the handler to delete a user
|
||||||
func UserDelete(c echo.Context) error {
|
func UserDelete(c echo.Context) error {
|
||||||
|
|
||||||
|
// Check if the user is admin
|
||||||
|
if !models.IsAdmin(c) {
|
||||||
|
return echo.ErrUnauthorized
|
||||||
|
}
|
||||||
|
|
||||||
id := c.Param("id")
|
id := c.Param("id")
|
||||||
|
|
||||||
// Make int
|
// Make int
|
||||||
|
|
|
@ -8,6 +8,12 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func UserShow(c echo.Context) error {
|
func UserShow(c echo.Context) error {
|
||||||
|
|
||||||
|
// Check if the user is admin
|
||||||
|
if !models.IsAdmin(c) {
|
||||||
|
return echo.ErrUnauthorized
|
||||||
|
}
|
||||||
|
|
||||||
user := c.Param("id")
|
user := c.Param("id")
|
||||||
|
|
||||||
if user == "" {
|
if user == "" {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user