Skip to content

Commit

Permalink
return authorized even though arr is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
henrod committed May 24, 2018
1 parent d2af25d commit fd063e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,12 @@ func authenticate(ctx context.Context, app *App, userID string, topics ...string
allowed[topic] = true
}
authorizedTopics := []string{}
isAuthorized := false
for _, topic := range topics {
isAuthorized = isAuthorized || allowed[topic]
if allowed[topic] && !strings.Contains(topic, "+") {
authorizedTopics = append(authorizedTopics, topic)
}
}
return len(authorizedTopics) > 0, authorizedTopics, nil
return isAuthorized, authorizedTopics, nil
}
2 changes: 1 addition & 1 deletion app/version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app

// VERSION is the current api version
var VERSION = "4.2.0"
var VERSION = "4.2.1"

0 comments on commit fd063e9

Please sign in to comment.