diff options
author | Unknwon <u@gogs.io> | 2016-03-05 20:45:23 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-03-05 20:45:23 -0500 |
commit | a5b0400be7c8868b685403e0718bdd66149c3e84 (patch) | |
tree | 6db3f4999fa43e0b8a384ca4da8885aa00a4de8f /models/user.go | |
parent | 045f14fbd0e3553521f5092cf839be363c74a090 (diff) | |
download | gitea-a5b0400be7c8868b685403e0718bdd66149c3e84.tar.gz gitea-a5b0400be7c8868b685403e0718bdd66149c3e84.zip |
#1146 finish new access rights for collaborators
Diffstat (limited to 'models/user.go')
-rw-r--r-- | models/user.go | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/models/user.go b/models/user.go index 3c87c4a64b..bd4cace44d 100644 --- a/models/user.go +++ b/models/user.go @@ -348,19 +348,15 @@ func (u *User) UploadAvatar(data []byte) error { // IsAdminOfRepo returns true if user has admin or higher access of repository. func (u *User) IsAdminOfRepo(repo *Repository) bool { - if repo.MustOwner().IsOrganization() { - has, err := HasAccess(u, repo, ACCESS_MODE_ADMIN) - if err != nil { - log.Error(3, "HasAccess: %v", err) - } - return has + has, err := HasAccess(u, repo, ACCESS_MODE_ADMIN) + if err != nil { + log.Error(3, "HasAccess: %v", err) } - - return repo.IsOwnedBy(u.Id) + return has } -// CanWriteTo returns true if user has write access to given repository. -func (u *User) CanWriteTo(repo *Repository) bool { +// IsWriterOfRepo returns true if user has write access to given repository. +func (u *User) IsWriterOfRepo(repo *Repository) bool { has, err := HasAccess(u, repo, ACCESS_MODE_WRITE) if err != nil { log.Error(3, "HasAccess: %v", err) |