aboutsummaryrefslogtreecommitdiff
path: root/modules/context/context.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-03-17 19:17:40 -0400
committerUnknwon <u@gogs.io>2017-03-17 19:17:40 -0400
commitcac7af2c783e12b68e8263b57a150d19f085f4da (patch)
tree102491e2450d81a414e464523768337c495e6f8c /modules/context/context.go
parent2d4dc544bea95239f620246610ccd9ed0a0ffd46 (diff)
explore: able list and search for private but accessible repositories (#3088)
Diffstat (limited to 'modules/context/context.go')
-rw-r--r--modules/context/context.go7
1 files changed, 7 insertions, 0 deletions
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"]