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

Permission error occured when accessing the comments of a specific issue #4416

Closed
2 tasks done
k1won opened this issue Mar 4, 2022 · 2 comments · Fixed by #4421
Closed
2 tasks done

Permission error occured when accessing the comments of a specific issue #4416

k1won opened this issue Mar 4, 2022 · 2 comments · Fixed by #4421
Labels
bug Something isn't working

Comments

@k1won
Copy link
Contributor

k1won commented Mar 4, 2022

My actions before raising this issue

Expected Behaviour

  • returns all comments of a specific issue

Current Behaviour

  • permission error occured (except admin account)
HTTP 403 Forbidden
Allow: GET, OPTIONS
Content-Type: application/vnd.cvat+json
Vary: Accept

{
    "detail": "You do not have permission to perform this action."
}

Possible Solution

  • add additional 'key:value'('comments': 'view') to the get_scopes() method in IssuePermission class like below. (apps.iam.permissions.py)
    @staticmethod
    def get_scopes(request, view, obj):
        return [{
            'list': 'list',
            'create': 'create@job',
            'destroy': 'delete',
            'partial_update': 'update',
            'retrieve': 'view',
            'comments': 'view'
        }.get(view.action, None)]

Steps to Reproduce (for bugs)

  1. create an issue and comment by task owner
  2. access the /api/issues/{id}/comments api endpoint

Context

Your Environment

  • Git hash commit (git log -1): cc98ff0
  • Docker version docker version (e.g. Docker 17.0.05):
  • Are you using Docker Swarm or Kubernetes?
  • Operating System and version (e.g. Linux, Windows, MacOS): ubuntu 18.04
  • Code example or link to GitHub repo or gist to reproduce problem:
  • Other diagnostic information / logs:
    Logs from `OPA` container
    "input": {
        "auth": {
            "organization": {
                "id": 9,
                "owner": {
                    "id": 6
                },
                "user": {
                    "role": "owner"
                }
            },
            "user": {
                "id": 6,
                "privilege": "business"
            }
        },
        "resource": {
            "assignee": {
                "id": null
            },
            "id": 12,
            "job": {
                "assignee": {
                    "id": 4
                }
            },
            "organization": {
                "id": 9
            },
            "owner": {
                "id": 4
            },
            "project": null,
            "task": {
                "assignee": {
                    "id": 7
                },
                "owner": {
                    "id": 6
                }
            }
        },
        "scope": null
    },

Next steps

You may join our Gitter channel for community support.

@nmanovic nmanovic added the bug Something isn't working label Mar 4, 2022
@nmanovic
Copy link
Contributor

nmanovic commented Mar 4, 2022

@k1won , thanks for the bug report! Please let me know if you would like to send us a PR. In general if I don't reply in several hours on the comment, I will fix it by myself. I want to have the fix in our next release v2.0.0

@k1won
Copy link
Contributor Author

k1won commented Mar 4, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants