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

creating group give 200 status code #7678

Closed
nirajacharya2 opened this issue Nov 8, 2023 · 5 comments · Fixed by #7705
Closed

creating group give 200 status code #7678

nirajacharya2 opened this issue Nov 8, 2023 · 5 comments · Fixed by #7705
Assignees
Labels
Priority:p1-urgent Consider a hotfix release with only that fix Severity:sev3-medium minor loss of usage, workaround available Type:Bug

Comments

@nirajacharya2
Copy link
Contributor

Describe the bug

according to the api specification on https://owncloud.dev/libre-graph-api/#/groups/CreateGroup
creating group gives 201 status code but it actually gives 200

Steps to reproduce

create a group

curl -k -v "https://localhost:9200/graph/v1.0/groups" --data "{\"displayName\":\"team2\"}" -u admin:admin

response

> POST /graph/v1.0/groups HTTP/1.1
> Host: localhost:9200
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.81.0
> Accept: */*
> Content-Length: 23
> Content-Type: application/x-www-form-urlencoded
>
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Length: 84
< Content-Security-Policy: frame-ancestors 'none'
< Content-Type: application/json
< Date: Wed, 08 Nov 2023 04:14:30 GMT
< Vary: Origin
< X-Content-Type-Options: nosniff
< X-Frame-Options: DENY
< X-Graph-Version: 5.0.0-alpha.1+2c46b2beb2
< X-Request-Id: neer-OptiPlex-3050/LiAmcrh5bD-000460
<
{"displayName":"team2","groupTypes":[],"id":"115e9844-9bc9-470d-b096-1cb6287fe0bb"}
* Connection #0 to host localhost left intact

Expected behavior

http status code should be 201

Actual behavior

http status code should is 200

Setup

Please describe how you started the server and provide a list of relevant environment variables or configuration files.

OCIS_XXX=master

@nirajacharya2 nirajacharya2 changed the title creating group give incorrect status code creating group give 200 status code Nov 8, 2023
@ScharfViktor
Copy link
Contributor

I found a couple other inconsistencies between specification and actual behavior.

creating users:

https://owncloud.dev/libre-graph-api/#/users/CreateUser expects 201
actual behavior: 200

export GDPR:

https://owncloud.dev/libre-graph-api/#/user/ExportPersonalData - 202
actual- 201

@micbar
Copy link
Contributor

micbar commented Nov 8, 2023

Let us please align that. @kulmann @JammingBen can we change on the server side? Is that a breaking change for web?

@kulmann
Copy link
Member

kulmann commented Nov 8, 2023

creating users:

https://owncloud.dev/libre-graph-api/#/users/CreateUser expects 201 actual behavior: 200

Web doesn't care about the status code. But it needs the id of the created user within the response body. I.e. could be changed in the backend without breaking web.

export GDPR:

https://owncloud.dev/libre-graph-api/#/user/ExportPersonalData - 202 actual- 201

Web triggers the request and only reacts on error status codes. Immediately goes into a scheduled task which checks if the gdpr export file is already available / not in processing (425) state anymore. I.e. could also be changed in the backend without breaking web.

@micbar micbar added Priority:p1-urgent Consider a hotfix release with only that fix Severity:sev3-medium minor loss of usage, workaround available labels Nov 8, 2023
@amrita-shrestha
Copy link
Contributor

amrita-shrestha commented Nov 8, 2023

we need to adjust the status code in the test file after fix

Then the HTTP status code should be "200"

| userName | displayName | email | password | code | enable | shouldOrNot |
| SameDisplayName | Alice Hansen | new@example.org | containsCharacters(*:!;_+-&) | 200 | true | should |
| withoutPassSameEmail | without pass | alice@example.org | | 200 | true | should |
| name | pass with space | example@example.org | my pass | 200 | true | should |
| user1 | user names must not start with a number | example@example.org | my pass | 200 | true | should |
| nameWithCharacters(*:!;_+-&) | user | new@example.org | 123 | 400 | true | should not |
| name with space | name with space | example@example.org | 123 | 400 | true | should not |
| createDisabledUser | disabled user | example@example.org | 123 | 200 | false | should |
| nameWithNumbers0123456 | user | name0123456@example.org | 123 | 200 | true | should |
| name.with.dots | user | name.w.dots@example.org | 123 | 200 | true | should |
| 123456789 | user | 123456789@example.org | 123 | 400 | true | should not |
| 0.0 | user | float@example.org | 123 | 400 | true | should not |
| withoutEmail | without email | | 123 | 200 | true | should |
| Alice | same userName | new@example.org | 123 | 409 | true | should |

Then the HTTP status code should be "200"

Then the HTTP status code should be "200"

https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/userGDPRExport.feature

@phil-davis
Copy link
Contributor

we need to adjust the status code in the test file after fix

The status code expected in the test will need to be adjusted in the PR that implements the fix into ocis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:p1-urgent Consider a hotfix release with only that fix Severity:sev3-medium minor loss of usage, workaround available Type:Bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

7 participants