diff options
Diffstat (limited to 'modules/context/context.go')
-rw-r--r-- | modules/context/context.go | 7 |
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"] |