// GetScopesByTenantID returns a list of scopes owned by the tenant func GetScopesByTenantID(sm store.Storer) echo.HandlerFunc { return func(ctx *echo.Context) error { var tenantID string if tenantID = ctx.Param("id"); tenantID == "" { return ctx.JSON(http.StatusBadRequest, &logMessage{Status: "error", Action: "GetScopesByTenantID", Info: "tenant id cannot be nil"}) } scopes, err := sm.GetScopesByTenantID(tenantID) if err != nil { return ctx.JSON(http.StatusInternalServerError, &logMessage{Status: "error", Action: "GetScopesByTenantID", Info: err.Error(), Table: "scopes"}) } return ctx.JSON(http.StatusOK, scopes) } }