Don't display hidden live

This commit is contained in:
nemunaire 2022-09-02 12:00:21 +02:00
parent 4f13efbab1
commit b16c91ac6d
5 changed files with 8 additions and 8 deletions

View file

@ -33,7 +33,7 @@ func declareAPIAuthQuestionsRoutes(router *gin.RouterGroup) {
c.JSON(http.StatusOK, questions)
}
} else {
if !s.Shown && !u.IsAdmin {
if (!s.Shown || s.Direct != nil) && !u.IsAdmin {
c.AbortWithStatusJSON(http.StatusForbidden, gin.H{"errmsg": "Not accessible"})
return
}
@ -67,7 +67,7 @@ func declareAPIAuthQuestionsRoutes(router *gin.RouterGroup) {
return
}
if !(s.Shown || (s.Direct != nil && *s.Direct == q.Id)) {
if !s.Shown || (s.Direct != nil && *s.Direct != q.Id) {
c.AbortWithStatusJSON(http.StatusForbidden, gin.H{"errmsg": "Not authorized"})
return
}