Added methods to revoke a users access to a list
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user