diff options
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) |