From 470b195da1c7b56374c1818338d344740d05503f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=99=BA=E8=B6=85?= <1012112796@qq.com> Date: Mon, 21 Sep 2020 13:04:33 +0800 Subject: [PATCH] Fix ListUserOrgs (#12910) (#12915) fix #12891 Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: Lauris BH Co-authored-by: Lauris BH --- routers/api/v1/org/org.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/api/v1/org/org.go b/routers/api/v1/org/org.go index b79761c87..9c671c8d1 100644 --- a/routers/api/v1/org/org.go +++ b/routers/api/v1/org/org.go @@ -84,7 +84,7 @@ func ListUserOrgs(ctx *context.APIContext) { if ctx.Written() { return } - listUserOrgs(ctx, u, ctx.User.IsAdmin) + listUserOrgs(ctx, u, ctx.User != nil && (ctx.User.IsAdmin || ctx.User.ID == u.ID)) } // GetAll return list of all public organizations