fix: update collaborator access mode and httpsign (#38894, #38862) (#38895)

backport #38894, partially #38862
This commit is contained in:
wxiaoguang
2026-08-13 09:59:07 +00:00
committed by GitHub
parent 88b56d408d
commit 0acbcc58a7
8 changed files with 38 additions and 79 deletions
+3 -1
View File
@@ -19,7 +19,9 @@ import (
)
func AddOrUpdateCollaborator(ctx context.Context, repo *repo_model.Repository, u *user_model.User, mode perm.AccessMode) error {
// only allow valid access modes, read, write and admin
// Only allow valid access modes, read, write and admin
// Keep in mind: do not allow "owner" here: because "admin" user can update collaborators but not make dangerous operations.
// If the "admin" user updates a user to "owner", then it means that the admin user can use owner permission, which is not expected.
if mode < perm.AccessModeRead || mode > perm.AccessModeAdmin {
return perm.ErrInvalidAccessMode
}