Enable user =========== PUT /v2.0/users/{userId}/OS-KSADM/enabled
The above API doesn't work, there are two issue here.
1. The API unnecessarily need a request body
url -g -i -X PUT http://10.239.159.68/identity_v2_admin/v2.0/users/acc163d0efa14fe5b84e1dcc62ff6404/OS-KSADM/enabled -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token:
{"error": {"message": "set_user_enabled() takes exactly 4 arguments (3 given)", "code": 400, "title": "Bad Request"}}
2. If we pass a request body without 'enabled' property, it could make the user enabled.
openstack user show acc163d0efa14fe5b84e1dcc62ff6404 +--------------------+----------------------------------+ | Field | Value | +--------------------+----------------------------------+ | default_project_id | e9b5b0575cad498f8fce9e39ef209411 | | domain_id | default | | enabled | False | | id | acc163d0efa14fe5b84e1dcc62ff6404 | | name | test_user | +--------------------+----------------------------------+
curl -g -i -X PUT http://10.239.159.68/identity_v2_admin/v2.0/users/acc163d0efa14fe5b84e1dcc62ff6404/OS-KSADM/enabled -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token:
{"user": {"username": "test_user", "name": "test_user", "extra": {}, "enabled": false, "id": "acc163d0efa14fe5b84e1dcc62ff6404", "tenantId": "e9b5b0575cad498f8fce9e39ef209411"}}
Nothing changed, the user is still disabled.
Enable user {userId} /OS-KSADM/ enabled
===========
PUT /v2.0/users/
The above API doesn't work, there are two issue here.
1. The API unnecessarily need a request body
url -g -i -X PUT http:// 10.239. 159.68/ identity_ v2_admin/ v2.0/users/ acc163d0efa14fe 5b84e1dcc62ff64 04/OS-KSADM/ enabled -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token:
{"error": {"message": "set_user_enabled() takes exactly 4 arguments (3 given)", "code": 400, "title": "Bad Request"}}
2. If we pass a request body without 'enabled' property, it could make the user enabled.
openstack user show acc163d0efa14fe 5b84e1dcc62ff64 04 ------- ------- +------ ------- ------- ------- ------- + ------- ------- +------ ------- ------- ------- ------- + f8fce9e39ef2094 11 | 5b84e1dcc62ff64 04 | ------- ------- +------ ------- ------- ------- ------- +
+------
| Field | Value |
+------
| default_project_id | e9b5b0575cad498
| domain_id | default |
| enabled | False |
| id | acc163d0efa14fe
| name | test_user |
+------
curl -g -i -X PUT http:// 10.239. 159.68/ identity_ v2_admin/ v2.0/users/ acc163d0efa14fe 5b84e1dcc62ff64 04/OS-KSADM/ enabled -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token:
{"user": {"username": "test_user", "name": "test_user", "extra": {}, "enabled": false, "id": "acc163d0efa14f e5b84e1dcc62ff6 404", "tenantId": "e9b5b0575cad49 8f8fce9e39ef209 411"}}
Nothing changed, the user is still disabled.