mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-08 22:13:26 +09:00
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user