Replies: 6 comments
-
This one is not the simplest as not with a clean public API, but as you said the UI is using the private API to offer this. They are two ways: https://docs.gethue.com/developer/api/ By re-engineering of the POST calls (load/save groups) via the Chrome console or building a small Python code/command that calls the views() https://github.com/cloudera/hue/blob/master/apps/useradmin/src/useradmin/views.py#L519 (which contains the logic, it is not in a dedicated lib unfortunately). Feel free to ask for more clarifying questions, and this is something that we will be happy to help document/push upstream afterwards. |
Beta Was this translation helpful? Give feedback.
-
Hi Romain, Thank you in advance. |
Beta Was this translation helpful? Give feedback.
-
#!/bin/env bash set -eu host="localhost" password=$(cat /home/hadoop/hue-config/hue_access_admin.txt | sed -n 's/admin:(.*)/\1/p') curl ${protocol}://${host}:${port}/hue/accounts/login/?fromModal=true -o /dev/null -D - -c cookies.txt -s curl -i -X POST ${protocol}://${host}:${port}/hue/accounts/login/?fromModal=true -d "username=${user}&password=${password}" -o /dev/null -D - -c cookies.txt -b cookies.txt -H "X-CSRFToken: ${x_csrftoken}" -s curl -X POST ${protocol}://${host}:${port}/useradmin/groups/edit/spark02-user -d "csrfmiddlewaretoken=${x_csrftoken}&name=spark02-user&permissions=1&permissions=2&is_embeddable=true", -b cookies.txt -H "X-CSRFToken: ${x_csrftoken}" |
Beta Was this translation helpful? Give feedback.
-
👍 We could add it to https://docs.gethue.com/administrator/administration/user-management/ as example? |
Beta Was this translation helpful? Give feedback.
-
If you think it would be useful for people - please do. #!/bin/env bash set -eu host="localhost" password=$(cat /home/hadoop/hue-config/hue_access_admin.txt | sed -n 's/admin:(.*)/\1/p') curl ${protocol}://${host}:${port}/hue/accounts/login/?fromModal=true -o /dev/null -D - -c cookies.txt -s curl -i -X POST ${protocol}://${host}:${port}/hue/accounts/login/?fromModal=true -d "username=${user}&password=${password}" -o /dev/null -D - -c cookies.txt -b cookies.txt -H "X-CSRFToken: ${x_csrftoken}" -s curl -X POST ${protocol}://${host}:${port}/useradmin/groups/edit/${group_name} |
Beta Was this translation helpful? Give feedback.
-
Thanks @oskotsky ! Added to the docs via #1539 |
Beta Was this translation helpful? Give feedback.
-
After upgrading to Hue 4.7 we have to (1) create a group, (2) explicitly assign a non-admin user to a group, and (3) set group permissions (was not the case with Hue 4.4). Some of this can be done programmatically:
However, I can't find a way to do (3): programmatically set permissions to a group. What is a programmatic way to do this? This can be done over GUI but we are running Hue on the cloud (fluid cluster) and everything has to be automated. Please advise.
Beta Was this translation helpful? Give feedback.
All reactions