Bug 1066022 - Add to 'update role' section that it is possible to update permissions field
Summary: Add to 'update role' section that it is possible to update permissions field
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Pulp
Classification: Retired
Component: documentation
Version: unspecified
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 2.6.0
Assignee: Chris Duryee
QA Contact: Irina Gulina
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-02-17 14:13 UTC by Ina Panova
Modified: 2015-02-28 22:02 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-02-28 22:02:53 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Pulp Redmine 399 0 None None None Never

Description Ina Panova 2014-02-17 14:13:23 UTC
Description of problem:
Current docs mention that only display_name and description of a role can be updated, although it is also possible to update permissions.
http://pulp-dev-guide.readthedocs.org/en/latest/integration/rest-api/role/cud.html#update-a-role

As you can see:

$ curl -H "Accept: application/json" PUT -k -u admin:admin  -d '{"delta":{"permissions":{"/":["CREATE"]}}}' 'https://example.com/pulp/api/v2/roles/myrole/' | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   230  100   188  100    42    217     48 --:--:-- --:--:-- --:--:--   248
{
    "_href": "/pulp/api/v2/roles/myrole/", 
    "_id": {
        "$oid": "53021345356cdf01fefddd22"
    }, 
    "_ns": "roles", 
    "description": null, 
    "display_name": "myrole", 
    "id": "myrole", 
    "permissions": {
        "/": [
            "CREATE"
        ]
    }
}

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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Barnaby Court 2014-11-18 18:18:13 UTC
https://github.com/pulp/pulp/pull/1322

Comment 2 Randy Barlow 2014-12-04 22:57:34 UTC
This is fixed in 2.4.4-0.1.beta.

Comment 3 Irina Gulina 2014-12-07 21:38:11 UTC
I couldn't update permissions. Please let me know what to do about that. 

>> rpm -qa | grep pulp-server
pulp-server-2.4.4-0.1.beta.el7.noarch

>> curl -i -H "Accept: application/json" -X POST -k -u admin:admin  -d '{"display_name": "Role Test", "description": "Demo Role", "role id": "gena-users"}' 'https://hostname/pulp/api/v2/roles/'
HTTP/1.1 201 Created
Date: Sun, 07 Dec 2014 16:46:22 GMT
Server: Apache/2.4.6 (Red Hat) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Location: gena-users
Content-Length: 200
Content-Type: application/json

{"display_name": "Role Test", "description": "Demo Role", "_ns": "roles", "_href": "/pulp/api/v2/roles/gena-users/", "_id": {"$oid": "5484845e21ede105b5f56e39"}, "id": "gena-users", "permissions": {}}

>> curl -i -H "Accept: application/json" -X PUT -k -u admin:admin  -d '{"delta":{"display_name": "New Role Test", "description": "New Demo Role", "permissions": {"/v2/roles/": ["CREATE"]}}}' 'https://hostname/pulp/api/v2/roles/gena-users/'

HTTP/1.1 400 Bad Request
Date: Sun, 07 Dec 2014 16:47:49 GMT
Server: Apache/2.4.6 (Red Hat) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Content-Encoding: utf-8
Content-Length: 380
Connection: close
Content-Type: application/json

{"http_request_method": "PUT", "exception": null, "error_message": "Update Keyword [permissions] is not supported", "_href": "/pulp/api/v2/roles/gena-users/", "http_status": 400, "error": {"code": "PLP0000", "data": {}, "description": "Update Keyword [permissions] is not supported", "sub_errors": []}, "args": ["Update Keyword [permissions] is not supported"], "traceback": null}

>> curl -i -H "Accept: application/json" -X PUT -k -u admin:admin  -d '{"delta":{"display_name": "New Role Test", "description": "New Demo Role"}}' 'https://hostname/pulp/api/v2/roles/gena-users/'


HTTP/1.1 200 OK
Date: Sun, 07 Dec 2014 16:48:55 GMT
Server: Apache/2.4.6 (Red Hat) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Content-Length: 208
Content-Type: application/json

{"display_name": "New Role Test", "description": "New Demo Role", "_ns": "roles", "_href": "/pulp/api/v2/roles/gena-users/", "_id": {"$oid": "5484845e21ede105b5f56e39"}, "id": "gena-users", "permissions": {}}

 
>> curl -i -H "Accept: application/json" -X PUT -k -u admin:admin  -d '{"delta":{"display_name": "New Role Test", "description": "New Demo Role", "permissions": {}}}' 'https://hostname/pulp/api/v2/roles/gena-users/'
HTTP/1.1 400 Bad Request
Date: Sun, 07 Dec 2014 16:50:33 GMT
Server: Apache/2.4.6 (Red Hat) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Content-Encoding: utf-8
Content-Length: 380
Connection: close
Content-Type: application/json

{"http_request_method": "PUT", "exception": null, "error_message": "Update Keyword [permissions] is not supported", "_href": "/pulp/api/v2/roles/gena-users/", "http_status": 400, "error": {"code": "PLP0000", "data": {}, "description": "Update Keyword [permissions] is not supported", "sub_errors": []}, "args": ["Update Keyword [permissions] is not supported"], "traceback": null}

Comment 4 Ina Panova 2014-12-08 12:30:42 UTC
This documentation bug was opened together with https://bugzilla.redhat.com/show_bug.cgi?id=1066040 (api bug), and since api bug was fixed the way it is not possible to update permission field in the role update call - doc bug is not appropriate anymore. 

Barnaby, what are the next steps regarding this situation?

Comment 5 Sayli Karmarkar 2014-12-08 17:53:39 UTC
Ina, Barnaby, that is right. Here is the PR https://github.com/pulp/pulp/pull/820 which summarizes how permissions of a role need to be updated and the way described in this bug is not supported. This change will need to be reverted.

Comment 6 Irina Gulina 2014-12-09 09:45:06 UTC
Everything regarding updating permissions in "Update a role" section [1] should be removed since that way of updating permissions is not supported anymore. See comments above. 

[1] http://pulp-dev-guide.readthedocs.org/en/latest/integration/rest-api/role/cud.html#update-a-role

Comment 7 Chris Duryee 2015-01-05 15:57:06 UTC
https://github.com/pulp/pulp/pull/1477

Comment 8 Chris Duryee 2015-01-12 14:00:24 UTC
merged to 2.6-testing and up

Comment 9 Chris Duryee 2015-01-15 00:35:30 UTC
fixed in 2.6.0-0.4.beta

Comment 10 Brian Bouterse 2015-02-28 22:02:53 UTC
Moved to https://pulp.plan.io/issues/399


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