From 640cf8abd61ad7b610b2af53be1a6e94c053b98b Mon Sep 17 00:00:00 2001 From: Teemu Patja Date: Mon, 11 Sep 2017 09:01:34 +0300 Subject: [PATCH] Usage metrics view access control fix Allow all members of status-im organization to see Usage metrics view, instead of just Status team members. --- src/clj/commiteth/github/core.clj | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/clj/commiteth/github/core.clj b/src/clj/commiteth/github/core.clj index 93af55a..13001c9 100644 --- a/src/clj/commiteth/github/core.clj +++ b/src/clj/commiteth/github/core.clj @@ -5,7 +5,8 @@ [oauth :as oauth] [users :as users] [repos :as repos] - [issues :as issues]] + [issues :as issues] + [orgs :as orgs]] [ring.util.codec :as codec] [clj-http.client :as http] [commiteth.config :refer [env]] @@ -106,8 +107,12 @@ (defn status-team-member? [token] - (let [user-teams (map :name (users/my-teams (auth-params token)))] - (true? (some #(= "Status" %) user-teams)))) + (let [user-login (:login (users/me (auth-params token))) + user-teams (map :name (users/my-teams (auth-params token))) + status-org-members (map :login (orgs/members "status-im" (self-auth-params)))] + (or + (true? (some #(= "Status" %) user-teams)) + (true? (some #(= user-login %) status-org-members))))) (defn our-webhooks [owner repo token]