You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[API] OPSAPS-35644 | Add update_user() method to python API client.
Bug: OPSAPS-35644
Issue:
Need update_user() method in python API client.
Implementation:
- Add update_user() python API client.
- Update mock unit test.
Reviewer: alexm, jayesh
Tests:
- Ran updated unit test.
- Wrote a python client program to test update
operation on user.
from cm_api.api_client import ApiResource
from cm_api.endpoints.users import ApiUser
CM_HOST = "bankim-agent-1.vpc.cloudera.com"
CM_PORT = 7180
CM_USERNAME = "admin"
CM_PASSWD = "admin"
api = ApiResource(CM_HOST, CM_PORT, CM_USERNAME, CM_PASSWD, version=7)
for u in api.get_all_users():
print u.name
print ','.join(u.roles)
if u.name == "guest":
n = ApiUser(api, u.name, roles=[ 'ROLE_LIMITED' ])
api.update_user(n)
for u in api.get_all_users():
print u.name
print ','.join(u.roles)
bankim@osboxes:~/scripts$ python user.py
admin
ROLE_ADMIN
guest
ROLE_USER
admin
ROLE_ADMIN
guest
ROLE_LIMITED
0 commit comments