diff options
author | Unknwon <u@gogs.io> | 2015-08-15 00:42:43 +0800 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-08-15 00:42:43 +0800 |
commit | cec38f2a8cf4f6721cc412d1d6cf3ea6f25b16c7 (patch) | |
tree | e17c7394bf6050f9b6133dd588ac1a2f445207e8 /modules/middleware/context.go | |
parent | d07c081920fd3ca395250ac9b5877a764171f4cd (diff) | |
download | gitea-cec38f2a8cf4f6721cc412d1d6cf3ea6f25b16c7.tar.gz gitea-cec38f2a8cf4f6721cc412d1d6cf3ea6f25b16c7.zip |
able edit issue labels/milestone/assignee
Diffstat (limited to 'modules/middleware/context.go')
-rw-r--r-- | modules/middleware/context.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/modules/middleware/context.go b/modules/middleware/context.go index d4bc8f0351..9870b41541 100644 --- a/modules/middleware/context.go +++ b/modules/middleware/context.go @@ -72,9 +72,14 @@ type RepoContext struct { Mirror *models.Mirror } -// Return if the current user has write access for this repository +// IsOwner returns true if current user is the owner of repository. func (r RepoContext) IsOwner() bool { - return r.AccessMode >= models.ACCESS_MODE_WRITE + return r.AccessMode >= models.ACCESS_MODE_OWNER +} + +// IsAdmin returns true if current user has admin or higher access of repository. +func (r RepoContext) IsAdmin() bool { + return r.AccessMode >= models.ACCESS_MODE_ADMIN } // Return if the current user has read access for this repository |