@ -71,7 +71,7 @@ const (
)
)
// ParseCommitsWithSignature checks if signaute of commits are corresponding to users gpg keys.
// ParseCommitsWithSignature checks if signaute of commits are corresponding to users gpg keys.
func ParseCommitsWithSignature ( oldCommits [ ] * user_model . UserCommit , repoTrustModel repo_model . TrustModelType , isCodeReade r func ( * user_model . User ) ( bool , error ) ) [ ] * SignCommit {
func ParseCommitsWithSignature ( oldCommits [ ] * user_model . UserCommit , repoTrustModel repo_model . TrustModelType , isOwnerMemberCollaborato r func ( * user_model . User ) ( bool , error ) ) [ ] * SignCommit {
newCommits := make ( [ ] * SignCommit , 0 , len ( oldCommits ) )
newCommits := make ( [ ] * SignCommit , 0 , len ( oldCommits ) )
keyMap := map [ string ] bool { }
keyMap := map [ string ] bool { }
@ -81,7 +81,7 @@ func ParseCommitsWithSignature(oldCommits []*user_model.UserCommit, repoTrustMod
Verification : ParseCommitWithSignature ( c . Commit ) ,
Verification : ParseCommitWithSignature ( c . Commit ) ,
}
}
_ = CalculateTrustStatus ( signCommit . Verification , repoTrustModel , isCodeReade r , & keyMap )
_ = CalculateTrustStatus ( signCommit . Verification , repoTrustModel , isOwnerMemberCollaborato r , & keyMap )
newCommits = append ( newCommits , signCommit )
newCommits = append ( newCommits , signCommit )
}
}
@ -455,7 +455,7 @@ func hashAndVerifyForKeyID(sig *packet.Signature, payload string, committer *use
// CalculateTrustStatus will calculate the TrustStatus for a commit verification within a repository
// CalculateTrustStatus will calculate the TrustStatus for a commit verification within a repository
// There are several trust models in Gitea
// There are several trust models in Gitea
func CalculateTrustStatus ( verification * CommitVerification , repoTrustModel repo_model . TrustModelType , isCodeReade r func ( * user_model . User ) ( bool , error ) , keyMap * map [ string ] bool ) ( err error ) {
func CalculateTrustStatus ( verification * CommitVerification , repoTrustModel repo_model . TrustModelType , isOwnerMemberCollaborato r func ( * user_model . User ) ( bool , error ) , keyMap * map [ string ] bool ) ( err error ) {
if ! verification . Verified {
if ! verification . Verified {
return
return
}
}
@ -500,11 +500,11 @@ func CalculateTrustStatus(verification *CommitVerification, repoTrustModel repo_
var has bool
var has bool
isMember , has = ( * keyMap ) [ verification . SigningKey . KeyID ]
isMember , has = ( * keyMap ) [ verification . SigningKey . KeyID ]
if ! has {
if ! has {
isMember , err = isCodeReade r ( verification . SigningUser )
isMember , err = isOwnerMemberCollaborato r ( verification . SigningUser )
( * keyMap ) [ verification . SigningKey . KeyID ] = isMember
( * keyMap ) [ verification . SigningKey . KeyID ] = isMember
}
}
} else {
} else {
isMember , err = isCodeReade r ( verification . SigningUser )
isMember , err = isOwnerMemberCollaborato r ( verification . SigningUser )
}
}
if ! isMember {
if ! isMember {