aboutsummaryrefslogtreecommitdiffstats
path: root/models/access.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-11-19 11:40:00 -0500
committerUnknwon <u@gogs.io>2015-11-19 11:40:00 -0500
commit2158e6fc43a17e8290f2ae1123d67ba01fab0f3f (patch)
treeb2e691d9176da79b4e990ebaa7acf5414f60241d /models/access.go
parentee686f62315006df6d85ad0f74dfc6119b920469 (diff)
downloadgitea-2158e6fc43a17e8290f2ae1123d67ba01fab0f3f.tar.gz
gitea-2158e6fc43a17e8290f2ae1123d67ba01fab0f3f.zip
fix #1997
Diffstat (limited to 'models/access.go')
-rw-r--r--models/access.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/models/access.go b/models/access.go
index 8a7729b734..5eef32819e 100644
--- a/models/access.go
+++ b/models/access.go
@@ -36,19 +36,19 @@ func accessLevel(e Engine, u *User, repo *Repository) (AccessMode, error) {
mode = ACCESS_MODE_READ
}
- if u != nil {
- if u.Id == repo.OwnerID {
- return ACCESS_MODE_OWNER, nil
- }
+ if u == nil {
+ return mode, nil
+ }
- a := &Access{UserID: u.Id, RepoID: repo.ID}
- if has, err := e.Get(a); !has || err != nil {
- return mode, err
- }
- return a.Mode, nil
+ if u.Id == repo.OwnerID {
+ return ACCESS_MODE_OWNER, nil
}
- return mode, nil
+ a := &Access{UserID: u.Id, RepoID: repo.ID}
+ if has, err := e.Get(a); !has || err != nil {
+ return mode, err
+ }
+ return a.Mode, nil
}
// AccessLevel returns the Access a user has to a repository. Will return NoneAccess if the