1
0

Added method to show all lists in a namespace

This commit is contained in:
kolaente
2018-07-03 08:26:28 +02:00
parent 06cae09f77
commit e0244e28d7
4 changed files with 98 additions and 7 deletions

View File

@ -38,6 +38,19 @@ func ShowNamespace(c echo.Context) error {
return c.JSON(http.StatusBadRequest, models.Message{"Invalid ID."})
}
// Check if the user has acces to that namespace
user, err := models.GetCurrentUser(c)
if err != nil {
return c.JSON(http.StatusInternalServerError, models.Message{"An error occured."})
}
has, err := user.HasNamespaceAccess(&models.Namespace{ID:namespaceID})
if err != nil {
return c.JSON(http.StatusInternalServerError, models.Message{"An error occured."})
}
if !has {
return c.JSON(http.StatusForbidden, models.Message{"You don't have access to this namespace."})
}
// Get the namespace
namespace, err := models.GetNamespaceByID(namespaceID)
if err != nil {