#1146 finish new access rights for collaborators

This commit is contained in:
Unknwon 2016-03-05 20:45:23 -05:00
parent 045f14fbd0
commit a5b0400be7
22 changed files with 210 additions and 190 deletions

View file

@ -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)