mirror of
https://github.com/gotify/server.git
synced 2026-06-06 12:40:06 +08:00
Check ownership of app on GetMessagesWithToken
This commit is contained in:
committed by
Jannis Mattheis
parent
98df7501f6
commit
4078358aaa
@@ -43,8 +43,12 @@ func (a *MessageAPI) GetMessages(ctx *gin.Context) {
|
||||
// GetMessagesWithApplication returns all messages from a specific application.
|
||||
func (a *MessageAPI) GetMessagesWithApplication(ctx *gin.Context) {
|
||||
withID(ctx, "appid", func(id uint) {
|
||||
messages := a.DB.GetMessagesByApplication(id)
|
||||
ctx.JSON(200, messages)
|
||||
if app := a.DB.GetApplicationByID(id); app != nil && app.UserID == auth.GetUserID(ctx) {
|
||||
messages := a.DB.GetMessagesByApplication(id)
|
||||
ctx.JSON(200, messages)
|
||||
} else {
|
||||
ctx.AbortWithError(404, errors.New("application does not exist"))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user