From 6b7021481052ef2302b450e9e00fe8d917e58b16 Mon Sep 17 00:00:00 2001 From: Howl Date: Sun, 3 Apr 2016 21:49:51 +0200 Subject: [PATCH] Show country if we have confidential privileges and we're looking at our user --- app/v1/user.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/v1/user.go b/app/v1/user.go index b5f67db..6e541fc 100644 --- a/app/v1/user.go +++ b/app/v1/user.go @@ -72,7 +72,9 @@ func UserGET(md common.MethodData) (r common.Response) { } } - if !showcountry { + // If the user wants to stay anonymous, don't show their country. + // This can be overriden if we have the ReadConfidential privilege and the user we are accessing is the token owner. + if !(showcountry || (md.User.Privileges.HasPrivilegeReadConfidential() && user.ID == md.User.UserID)) { user.Country = "XX" }