mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-28 03:03:48 +00:00
fix(repo): centralize repository-scoped authorization (#39063)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -424,9 +424,7 @@ func createRepositoryInDB(ctx context.Context, doer, u *user_model.User, repo *r
|
||||
}
|
||||
}
|
||||
|
||||
if isAdmin, err := access_model.IsUserRepoAdmin(ctx, repo, doer); err != nil {
|
||||
return fmt.Errorf("IsUserRepoAdmin: %w", err)
|
||||
} else if !isAdmin {
|
||||
if !access_model.IsUserRepoAdmin(ctx, repo, doer) {
|
||||
// Make creator repo admin if it wasn't assigned automatically
|
||||
if err = AddOrUpdateCollaborator(ctx, repo, doer, perm.AccessModeAdmin); err != nil {
|
||||
return fmt.Errorf("AddCollaborator: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user