Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust permissions check on creating PR to fix #6302 #6607

Closed

Conversation

zeripath
Copy link
Contributor

@zeripath zeripath commented Apr 13, 2019

Some users in #6302 appear to be having difficulty creating pull requests since #6098.

I'm uncertain as to why this additional permissions check is required perhaps these users have a different permissions model but I'm raising this PR as possible fix.

Fixes #6302

@zeripath zeripath added modifies/api This PR adds API routes or modifies them type/bug issue/regression Issue needs no code to be fixed, only a description on how to fix it yourself labels Apr 13, 2019
@zeripath zeripath added this to the 1.9.0 milestone Apr 13, 2019
@zeripath zeripath changed the title Fix #6302 by adjusting permission check Adjust permissions check on creating pull request to fix #6302 Apr 13, 2019
@zeripath zeripath changed the title Adjust permissions check on creating pull request to fix #6302 Adjust permissions check on creating PR to fix #6302 Apr 13, 2019
@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@c168095). Click here to learn what that means.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #6607   +/-   ##
=========================================
  Coverage          ?   40.46%           
=========================================
  Files             ?      405           
  Lines             ?    54388           
  Branches          ?        0           
=========================================
  Hits              ?    22006           
  Misses            ?    29356           
  Partials          ?     3026
Impacted Files Coverage Δ
routers/api/v1/repo/pull.go 17.7% <0%> (ø)
routers/repo/pull.go 36.67% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c168095...ea494fc. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 13, 2019
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 14, 2019
@@ -671,8 +671,8 @@ func parseCompareInfo(ctx *context.APIContext, form api.CreatePullRequestOption)
ctx.ServerError("GetUserRepoPermission", err)
return nil, nil, nil, nil, "", ""
}
if !perm.CanReadIssuesOrPulls(true) {
log.Trace("ParseCompareInfo[%d]: cannot create/read pull requests", baseRepo.ID)
if !perm.CanReadIssuesOrPulls(true) && !perm.CanWrite(models.UnitTypeCode) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems it's not reasonable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand. Are you saying that this is wrong?

What should the permissions test be?

Copy link
Member

@lunny lunny Apr 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note: For a parseCompare we should have two permissions, one is for base repo, another is to head repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK So I'm not sure that's what's currently being tested.

@zeripath zeripath mentioned this pull request Apr 19, 2019
7 tasks
@zeripath zeripath closed this Apr 19, 2019
@zeripath
Copy link
Contributor Author

This is unnecessary the likely issue is something to do with a migration.

@zeripath zeripath deleted the fix-6302-adjust-permissions-check branch May 2, 2019 18:48
@techknowlogick techknowlogick removed this from the 1.9.0 milestone May 6, 2019
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/regression Issue needs no code to be fixed, only a description on how to fix it yourself lgtm/need 1 This PR needs approval from one additional maintainer to be merged. modifies/api This PR adds API routes or modifies them type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

compare/create PR produces a 404
6 participants