summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-03-20 08:02:14 -0400
committerUnknown <joe2010xtmf@163.com>2014-03-20 08:02:14 -0400
commit4cf6cc63b0679aaf5fe8b74a2aaf0bd92b1f12d3 (patch)
tree180c744071a0898a415579613379c6a7f80e8bc8 /modules
parent9f9cd6bfc61d82ee0a3d31cee112be7975b8ca86 (diff)
downloadgitea-4cf6cc63b0679aaf5fe8b74a2aaf0bd92b1f12d3.tar.gz
gitea-4cf6cc63b0679aaf5fe8b74a2aaf0bd92b1f12d3.zip
Work on admin
Diffstat (limited to 'modules')
-rw-r--r--modules/base/conf.go2
-rw-r--r--modules/middleware/auth.go2
-rw-r--r--modules/middleware/context.go6
3 files changed, 2 insertions, 8 deletions
diff --git a/modules/base/conf.go b/modules/base/conf.go
index c904c5b39c..fdbf3ad385 100644
--- a/modules/base/conf.go
+++ b/modules/base/conf.go
@@ -32,7 +32,6 @@ var (
AppUrl string
Domain string
SecretKey string
- AdminName string
Cfg *goconfig.ConfigFile
MailService *Mailer
)
@@ -174,7 +173,6 @@ func init() {
AppUrl = Cfg.MustValue("server", "ROOT_URL")
Domain = Cfg.MustValue("server", "DOMAIN")
SecretKey = Cfg.MustValue("security", "SECRET_KEY")
- AdminName = strings.ToLower(Cfg.MustValue("admin", "NAME"))
}
func NewServices() {
diff --git a/modules/middleware/auth.go b/modules/middleware/auth.go
index b67f766bd7..44033abb8f 100644
--- a/modules/middleware/auth.go
+++ b/modules/middleware/auth.go
@@ -39,7 +39,7 @@ func SignOutRequire() martini.Handler {
// AdminRequire requires user signed in as administor.
func AdminRequire() martini.Handler {
return func(ctx *Context) {
- if ctx.User.LowerName != base.AdminName && !ctx.User.IsAdmin {
+ if !ctx.User.IsAdmin {
ctx.Error(403)
return
}
diff --git a/modules/middleware/context.go b/modules/middleware/context.go
index 744cdfc10c..cb3cbabca6 100644
--- a/modules/middleware/context.go
+++ b/modules/middleware/context.go
@@ -14,7 +14,6 @@ import (
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/auth"
- "github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/log"
)
@@ -112,10 +111,7 @@ func InitContext() martini.Handler {
ctx.Data["SignedUser"] = user
ctx.Data["SignedUserId"] = user.Id
ctx.Data["SignedUserName"] = user.LowerName
-
- if ctx.User.IsAdmin || ctx.User.LowerName == base.AdminName {
- ctx.Data["IsAdmin"] = true
- }
+ ctx.Data["IsAdmin"] = ctx.User.IsAdmin
}
ctx.Data["PageStartTime"] = time.Now()