From cac7af2c783e12b68e8263b57a150d19f085f4da Mon Sep 17 00:00:00 2001 From: Unknwon Date: Fri, 17 Mar 2017 19:17:40 -0400 Subject: explore: able list and search for private but accessible repositories (#3088) --- modules/context/context.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'modules/context/context.go') diff --git a/modules/context/context.go b/modules/context/context.go index 31378532..f543e766 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -42,6 +42,13 @@ type Context struct { Org *Organization } +func (ctx *Context) UserID() int64 { + if !ctx.IsSigned { + return 0 + } + return ctx.User.ID +} + // HasError returns true if error occurs in form validation. func (ctx *Context) HasApiError() bool { hasErr, ok := ctx.Data["HasError"] -- cgit v1.2.3