|
|
|
@@ -1058,23 +1058,13 @@ func isAdminRight(ctx *context.Context) bool { |
|
|
|
if ctx.Repo.IsOwner() { |
|
|
|
return true |
|
|
|
} |
|
|
|
if ctx.Repo.Owner.IsOrganization() { |
|
|
|
isOwner, err := ctx.Repo.Owner.IsOwnedBy(ctx.User.ID) |
|
|
|
if err != nil { |
|
|
|
return false |
|
|
|
} else if isOwner { |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
isCollaborator, err := ctx.Repo.Repository.IsCollaborator(ctx.User.ID) |
|
|
|
permission, err := models.GetUserRepoPermission(ctx.Repo.Repository, ctx.User) |
|
|
|
if err != nil { |
|
|
|
log.Info("query IsCollaborator error." + err.Error()) |
|
|
|
log.Error("GetUserRepoPermission failed:%v", err.Error()) |
|
|
|
return false |
|
|
|
} |
|
|
|
if isCollaborator { |
|
|
|
mode := ctx.Repo.Repository.GetCollaboratorMode(ctx.User.ID) |
|
|
|
if mode >= 3 { |
|
|
|
return true |
|
|
|
} |
|
|
|
if permission.AccessMode >= models.AccessModeAdmin { |
|
|
|
return true |
|
|
|
} |
|
|
|
return false |
|
|
|
} |
|
|
|
|