Usage metrics view access control fix

Allow all members of status-im organization to see Usage metrics view,
instead of just Status team members.
This commit is contained in:
Teemu Patja 2017-09-11 09:01:34 +03:00
parent 56587f882b
commit 640cf8abd6
No known key found for this signature in database
GPG Key ID: F5B7035E6580FD4C
1 changed files with 8 additions and 3 deletions

View File

@ -5,7 +5,8 @@
[oauth :as oauth] [oauth :as oauth]
[users :as users] [users :as users]
[repos :as repos] [repos :as repos]
[issues :as issues]] [issues :as issues]
[orgs :as orgs]]
[ring.util.codec :as codec] [ring.util.codec :as codec]
[clj-http.client :as http] [clj-http.client :as http]
[commiteth.config :refer [env]] [commiteth.config :refer [env]]
@ -106,8 +107,12 @@
(defn status-team-member? (defn status-team-member?
[token] [token]
(let [user-teams (map :name (users/my-teams (auth-params token)))] (let [user-login (:login (users/me (auth-params token)))
(true? (some #(= "Status" %) user-teams)))) 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 (defn our-webhooks
[owner repo token] [owner repo token]