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

Admin user tries to change his/her own role gives 500 status code #6037

Closed
grgprarup opened this issue Apr 12, 2023 · 2 comments · Fixed by #6276
Closed

Admin user tries to change his/her own role gives 500 status code #6037

grgprarup opened this issue Apr 12, 2023 · 2 comments · Fixed by #6276
Assignees
Labels

Comments

@grgprarup
Copy link
Contributor

Describe the bug

When an Admin user tries to change his/her own role gives a 500 status code, with a response body containing the message 403 Forbidden.

Steps to reproduce

Steps to reproduce the behavior:

  1. Create user1
  2. Grant role Admin to user1
  3. Change user1 role to newRole

Endpoints:

POST: /graph/v1.0/users/user-id/appRoleAssignments/

curl -kv -XPOST -uuser1:1234 https://host.docker.internal:9200/graph/v1.0/users/37130879-7646-44be-9e6c-4ea67c2b7c50/appRoleAssignments \
-H 'Content-Type: application/json' \
-d '{"appRoleId": "2aadd357-682c-406b-8874-293091995fdd","principalId": "37130879-7646-44be-9e6c-4ea67c2b7c50","principalType": "User","resourceDisplayName": "ownCloud Infinite Scale","resourceId": "some-graph-app-id"}'

Expected behavior

HTTP/1.1 403 Forbidden

Actual behavior

HTTP/1.1 500 Internal Server Error

{
    "error": {
        "code": "generalException",
        "innererror": {
            "date": "2023-04-12T11:18:35Z",
            "request-id": "c612df5afef9/cBddd5avYf-014460"
        },
        "message": "{\"id\":\"ocis-settings\",\"code\":403,\"detail\":\"Changing own role assignment forbidden\",\"status\":\"Forbidden\"}"
    }
}
@micbar
Copy link
Contributor

micbar commented Apr 17, 2023

We should fix the error code during the test writing.

@ScharfViktor
Copy link
Contributor

PR #6030 is blocked due to problems: #6037 #6035

status code 500, but response message "{\"id\":\"ocis-settings\",\"code\":403,\"detail\":\"Changing own role assignment forbidden\",\"status\":\"Forbidden\"}"

Screenshot 2023-05-05 at 09 24 01

@2403905 2403905 self-assigned this May 10, 2023
2403905 added a commit that referenced this issue May 12, 2023
fix the wrong status code when appRoleAssignments is forbidden #6037
ownclouders pushed a commit that referenced this issue May 12, 2023
fix the wrong status code when appRoleAssignments is forbidden #6037
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants