Bug 1021970 - Add an example how to retrieve permissions for a particular resource
Summary: Add an example how to retrieve permissions for a particular resource
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Pulp
Classification: Retired
Component: documentation
Version: 2.2
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 2.6.0
Assignee: Ina Panova
QA Contact: Irina Gulina
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-10-22 12:33 UTC by Ina Panova
Modified: 2015-02-28 23:41 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-02-19 01:12:05 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Pulp Redmine 210 None None None Never

Description Ina Panova 2013-10-22 12:33:34 UTC
Description of problem:
Cannot retrieve permissions for a particular resource, meanwhile docs says it should be possible.

https://pulp-dev-guide.readthedocs.org/en/pulp-2.2/integration/rest-api/permission/retrieval.html#retrieval


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Retrieve permissions on a particular resource

Actual results:
Permissions on a specified resource not retrieved

Expected results:
Permissions on a specified resource retrieved

Additional info:

Listing permissions for all resources:
# http --verify=no https://admin:admin@pulp.example.com/pulp/api/v2/permissions/
HTTP/1.1 200 OK
Content-Length: 1121
Content-Type: application/json
Date: Tue, 22 Oct 2013 12:20:26 GMT
Server: Apache/2.4.6 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5

[
    {
        "_id": {
            "$oid": "525546d2da892d073367960f"
        }, 
        "_ns": "permissions", 
        "id": "525546d2da892d073367960f", 
        "resource": "/v2/users/admin/", 
        "users": {
            "admin": [
                "READ", 
                "UPDATE"
            ]
        }
    }, 
    {
        "_id": {
            "$oid": "525d34abda892d07336798e1"
        }, 
        "_ns": "permissions", 
        "id": "525d34abda892d07336798e1", 
        "resource": "/v2/tasks/aa0ef267-7bd3-482d-876c-2bf602b4b5f1/", 
        "users": {
            "admin": [
                null, 
                null
            ]
        }
    }, 
    {
        "_id": {
            "$oid": "525d35edda892d07336798f4"
        }, 
        "_ns": "permissions", 
        "id": "525d35edda892d07336798f4", 
        "resource": "/v2/tasks/ee25189f-1f16-41ca-b065-fd2f7b5fabac/", 
        "users": {
            "admin": [
                null, 
                null
            ]
        }
    }, 
    {
        "_id": {
            "$oid": "525546d2da892d073367960d"
        }, 
        "_ns": "permissions", 
        "id": "525546d2da892d073367960d", 
        "resource": "/v2/actions/login/", 
        "users": {
            "admin": [
                "READ", 
                "UPDATE"
            ]
        }
    }, 
    {
        "_id": {
            "$oid": "525546d2da892d073367960e"
        }, 
        "_ns": "permissions", 
        "id": "525546d2da892d073367960e", 
        "resource": "/v2/actions/logout/", 
        "users": {
            "admin": [
                "READ", 
                "UPDATE"
            ]
        }
    }, 
    {
        "_id": {
            "$oid": "525546d2da892d0733679610"
        }, 
        "_ns": "permissions", 
        "id": "525546d2da892d0733679610", 
        "resource": "/", 
        "users": {
            "admin": [
                "CREATE", 
                "READ", 
                "UPDATE", 
                "DELETE", 
                "EXECUTE"
            ]
        }
    }
]

Using the id of the resource:

# http --verify=no https://admin:admin@pulp.example.com/pulp/api/v2/permissions/525546d2da892d0733679610/
HTTP/1.1 404 Not Found
Content-Type: text/html; charset=UTF-8
Date: Tue, 22 Oct 2013 12:22:20 GMT
Server: Apache/2.4.6 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Transfer-Encoding: chunked

not found

Comment 1 Ina Panova 2014-11-14 15:06:31 UTC
It actually works:

# curl -H "Accept: application/json" -X GET -k -u admin:admin 'https://localhost/pulp/api/v2/permissions/?resource=%2Fv2%2Factions%2Flogin%2F' | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   210  100   177  100    33    473     88 --:--:-- --:--:-- --:--:--   474
[
    {
        "_id": {
            "$oid": "54660ade6754762ed6e6bd38"
        },
        "_ns": "permissions",
        "id": "54660ade6754762ed6e6bd38",
        "resource": "/v2/actions/login/",
        "users": {
            "admin": [
                "READ",
                "UPDATE"
            ]
        }
    }
]

I think an example how to do it would be helpful.

Comment 2 Ina Panova 2014-11-18 15:15:33 UTC
https://github.com/pulp/pulp/pull/1317

Comment 3 Chris Duryee 2014-11-19 23:26:34 UTC
This commit is in master and 2.6-dev, changing state to MODIFIED and setting target release.

Comment 4 Chris Duryee 2014-12-23 20:52:57 UTC
fixed in pulp 2.6.0-0.2.beta

Comment 5 Irina Gulina 2015-01-14 09:45:05 UTC
Documented.

Comment 6 Brian Bouterse 2015-02-19 01:12:05 UTC
Moved to https://pulp.plan.io/issues/210


Note You need to log in before you can comment on or make changes to this bug.