-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
API returns 201 even though not all data from the request has been processed due to the sudo user not beeing an andministrator #11320
Comments
this is not intended behaviour |
and if you have a working script it would be nice to publish it somewhere - could go on the list of #8689 |
I'll have a look at this but it would be nice if you can describe what exactly do you mean with "linked" labels |
So on the page https://try.gitea.io/api/swagger#/issue/issueCreateIssue it says, the json below can be used to create a new issue. There is a field labels and a field milestone. Both of them accept a int value to like one (milestone) or multiple labels. If I use sudo (with an administrator) all works as expected and the new issue has the right labels linked. But if the sudo user is not an administrator the issue gets created but is not linked.
The script has a big limitation, that there is no api which support setting the created_at value. This is a bit of an issue for a nice import. |
I don't like the idea of arbitrary users creating things in the past, future or whenever. It seems like we would be better off creating a proper migration from trac instead. |
Yeah that would probably be the better way. |
@PascalMinder the API is working fine, this is because of securety conzernes too so this issue is infalid @PascalMinder for you: your script has to create the issue first and the admin acount should add labels and milestones afterwards |
@6543 Okay, but if there is a security concern about a user which adds a label with sudo, the API should probably return another status code than 20X and not apply half of the requested changes? |
the API function's itself do not know if the user is introduced by sudo or if he acts itself with the api |
Instead of silent droping we could return a 422 ... but It will be a breaking change ... |
This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions. |
ping |
[x]
):Description
I'am currently in the process of migrating Trac issues to a new Gitea instance. For this reason I am currently working on a php script which reads issues from the Trac database and creates them over the Gitea API on the new gitea instance.
To create the issue in the name of the orginal author I use the "sudo" header with the user which created the issue in Trac (with a mapping table).
When I try to create an Issue with a user which is not an administrator I get a 201 http back and the issue gets created. BUT linked labels or milestones are not createt for the issue. However if the user is an administrator no such error occures and the issue gets created with all linked labels and milestones.
I would have expected, that the api returns a 400 http header or something similar if not all data could be processed. Is this an intended behaviour?
The text was updated successfully, but these errors were encountered: