From fd063e90a4ef24df4abaee504dab8adfa8e06dcd Mon Sep 17 00:00:00 2001 From: Henrique Rodrigues Date: Thu, 24 May 2018 13:30:37 -0300 Subject: [PATCH] return authorized even though arr is empty --- app/helpers.go | 4 +++- app/version.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/helpers.go b/app/helpers.go index 7493540..6d40d97 100644 --- a/app/helpers.go +++ b/app/helpers.go @@ -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 } diff --git a/app/version.go b/app/version.go index 6b85b0f..a43030c 100644 --- a/app/version.go +++ b/app/version.go @@ -1,4 +1,4 @@ package app // VERSION is the current api version -var VERSION = "4.2.0" +var VERSION = "4.2.1"