Getting around "The 'administer permissions' permission is required" when Fetching User Roles via JSON:API

Created on 3 January 2018, almost 7 years ago
Updated 3 January 2024, 12 months ago

Hello, im not able to see any role in API because i cant allow 'administer permissions' for our api users. I know its not a bug of jsonapi module. Does anyone have any idea how to allow user to just "view" roles???

{
    "data": [],
    "meta": {
        "errors": [
            {
                "title": "Forbidden",
                "status": 403,
                "detail": "The current user is not allowed to GET the selected resource. The 'administer permissions' permission is required.",
                "links": {
                    "info": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.4"
                },
                "code": 0,
                "id": "/user_role--user_role/8e91e43c-4987-4a42-b37e-4e5586e923b4",
                "source": {
                    "pointer": "/data"
                }
            },
πŸ’¬ Support request
Status

Closed: works as designed

Version

11.0 πŸ”₯

Component
JSON APIΒ  β†’

Last updated 3 days ago

Created by

πŸ‡¨πŸ‡ΏCzech Republic mkolar

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States GuyPaddock

    @mkolar We're going to give this snippet a spin here for an internal API integration that needs to fetch role information from sites. One thing I noticed -- right now the snippet you provided doesn't confirm that the entity type is a user, correct? So, theoretically any roles field in any entity would be impacted.

    I'm thankful for the snippet, but just wanted to point out for others using the snippet that they might want some additional checks in their hook implementation.

  • πŸ‡ΊπŸ‡ΈUnited States GuyPaddock

    Updating issue metadata to aid in discoverability.

Production build 0.71.5 2024