1
0

Added methods to revoke a users access to a list

This commit is contained in:
konrad
2018-08-30 18:52:12 +02:00
committed by kolaente
parent b1c3e92f66
commit efaa277751
5 changed files with 87 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package crud
import (
"code.vikunja.io/api/models"
"fmt"
"github.com/labstack/echo"
"net/http"
)
@ -24,7 +25,7 @@ func (c *WebHandler) DeleteWeb(ctx echo.Context) error {
err = c.CObject.Delete()
if err != nil {
fmt.Println(err)
if models.IsErrNeedToBeListAdmin(err) {
return echo.NewHTTPError(http.StatusForbidden, "You need to be the list admin to delete a list.")
}
@ -41,6 +42,10 @@ func (c *WebHandler) DeleteWeb(ctx echo.Context) error {
return echo.NewHTTPError(http.StatusBadRequest, "You cannot delete the last member of a team.")
}
if models.IsErrUserDoesNotHaveAccessToList(err) {
return echo.NewHTTPError(http.StatusBadRequest, "This user does not have access to the list.")
}
return echo.NewHTTPError(http.StatusInternalServerError)
}