summaryrefslogtreecommitdiffstats
path: root/modules/middleware
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2015-02-13 02:14:57 -0500
committerUnknwon <joe2010xtmf@163.com>2015-02-13 02:14:57 -0500
commit6b7d35eade921058654207abf30bd718389d11f1 (patch)
tree555a939eaa9b9f4b6000ce2037e8c938048db7d4 /modules/middleware
parent6d0f3a07d4fa3189b0b7c4e366bddb6d72ef7e68 (diff)
downloadgitea-6b7d35eade921058654207abf30bd718389d11f1.tar.gz
gitea-6b7d35eade921058654207abf30bd718389d11f1.zip
fix mirror issues uncaught #941
Diffstat (limited to 'modules/middleware')
-rw-r--r--modules/middleware/repo.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go
index ea41b0dddd..bd298819d7 100644
--- a/modules/middleware/repo.go
+++ b/modules/middleware/repo.go
@@ -29,7 +29,7 @@ func ApiRepoAssignment() macaron.Handler {
)
// Check if the user is the same as the repository owner.
- if ctx.IsSigned && u.LowerName == strings.ToLower(userName) {
+ if ctx.IsSigned && ctx.User.LowerName == strings.ToLower(userName) {
u = ctx.User
} else {
u, err = models.GetUserByName(userName)
@@ -210,7 +210,7 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
}
// Check if the user is the same as the repository owner
- if ctx.IsSigned && u.LowerName == strings.ToLower(userName) {
+ if ctx.IsSigned && ctx.User.LowerName == strings.ToLower(userName) {
u = ctx.User
} else {
u, err = models.GetUserByName(userName)
@@ -248,6 +248,9 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
ctx.Repo.IsOwner = mode >= models.ACCESS_MODE_WRITE
ctx.Repo.IsAdmin = mode >= models.ACCESS_MODE_READ
ctx.Repo.IsTrueOwner = mode >= models.ACCESS_MODE_OWNER
+ if !ctx.Repo.IsTrueOwner && ctx.Repo.Owner.IsOrganization() {
+ ctx.Repo.IsTrueOwner = ctx.Repo.Owner.IsOwnedBy(ctx.User.Id)
+ }
}
// Check access.