<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: REST API URL to change the user role in Ranger? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/REST-API-URL-to-change-the-user-role-in-Ranger/m-p/134375#M97037</link>
    <description>&lt;P&gt;It worked, thanks a lot &lt;A rel="user" href="https://community.cloudera.com/users/510/jhorsch.html" nodeid="510"&gt;@jhorsch&lt;/A&gt;. I was missing some mandatory fields in json payload, that should be the reason for the error.&lt;/P&gt;</description>
    <pubDate>Sat, 03 Sep 2016 07:14:05 GMT</pubDate>
    <dc:creator>mrizvi</dc:creator>
    <dc:date>2016-09-03T07:14:05Z</dc:date>
    <item>
      <title>REST API URL to change the user role in Ranger?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/REST-API-URL-to-change-the-user-role-in-Ranger/m-p/134371#M97033</link>
      <description>&lt;P&gt;Right now, Ranger provides two roles - "Admin" and "User". When I added a new user in OS, Ranger usersync created its login credentials for Ranger UI but the role appointed is User. I am trying the following REST API to change the role to Admin so that it can create new policies:&lt;/P&gt;&lt;P&gt;curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -u admin:admin &lt;A href="http://sandbox.hortonworks.com:6080/service/xusers/users" target="_blank"&gt;http://sandbox.hortonworks.com:6080/service/xusers/users&lt;/A&gt; -d '{"name":"tom","role":["ROLE_SYS_ADMIN"]}'&lt;/P&gt;&lt;P&gt;There is no output or any error. Please help&lt;/P&gt;</description>
      <pubDate>Sat, 03 Sep 2016 04:49:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/REST-API-URL-to-change-the-user-role-in-Ranger/m-p/134371#M97033</guid>
      <dc:creator>mrizvi</dc:creator>
      <dc:date>2016-09-03T04:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: REST API URL to change the user role in Ranger?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/REST-API-URL-to-change-the-user-role-in-Ranger/m-p/134372#M97034</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/10331/mrizvi.html" nodeid="10331"&gt;@mrizvi&lt;/A&gt;&lt;P&gt; Please use  /service/users end point and for update use PUT.&lt;/P&gt;&lt;P&gt;curl -u admin:admin -X PUT -H "Accept: application/json" -H "Content-Type: application/json" &lt;A href="http://`hostname" target="_blank"&gt;http://`hostname&lt;/A&gt; -f`:6080/service/users -d @test.json&lt;/P&gt;&lt;P&gt;where test.json is your json pay-load.&lt;/P&gt;</description>
      <pubDate>Sat, 03 Sep 2016 05:21:44 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/REST-API-URL-to-change-the-user-role-in-Ranger/m-p/134372#M97034</guid>
      <dc:creator>rmani</dc:creator>
      <dc:date>2016-09-03T05:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: REST API URL to change the user role in Ranger?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/REST-API-URL-to-change-the-user-role-in-Ranger/m-p/134373#M97035</link>
      <description>&lt;P&gt;Thanks &lt;A rel="user" href="https://community.cloudera.com/users/218/rmani.html" nodeid="218"&gt;@Ramesh Mani&lt;/A&gt;, Just tried this, still nothing happened. I guess there is a problem with json payload. I am using '{"name":"tom","userRoleList":"ROLE_SYS_ADMIN"}'&lt;/P&gt;</description>
      <pubDate>Sat, 03 Sep 2016 05:32:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/REST-API-URL-to-change-the-user-role-in-Ranger/m-p/134373#M97035</guid>
      <dc:creator>mrizvi</dc:creator>
      <dc:date>2016-09-03T05:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: REST API URL to change the user role in Ranger?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/REST-API-URL-to-change-the-user-role-in-Ranger/m-p/134374#M97036</link>
      <description>&lt;P&gt;There is a great article already on this site describing how to do this. &lt;/P&gt;&lt;P&gt;&lt;A href="https://community.hortonworks.com/articles/49439/how-to-use-api-curl-commands-to-create-internal-ra.html" target="_blank"&gt;https://community.hortonworks.com/articles/49439/how-to-use-api-curl-commands-to-create-internal-ra.html&lt;/A&gt; &lt;/P&gt;&lt;P&gt;Here is how I was able to do this:&lt;/P&gt;&lt;P&gt;First capture the current users information:&lt;/P&gt;&lt;PRE&gt;curl -s -u admin:admin -H "Accept: application/json" -H "Content-Type: application/json" -X GET &lt;A href="http://127.0.0.1:6080/service/xusers/users/8" target="_blank"&gt;http://127.0.0.1:6080/service/xusers/users/8&lt;/A&gt; &amp;gt; /tmp/curl.out &lt;/PRE&gt;&lt;P&gt;File contents:&lt;/P&gt;&lt;P&gt;{"id":8,"createDate":"2016-03-14T14:41:05Z","updateDate":"2016-09-02T23:07:10Z","owner":"rangerusersync","updatedBy":"Admin","name":"HDP","firstName":"HDP","lastName":"HDP","emailAddress":"HDP@sandbox.hortonworks.com", "password":"*****","description":"HDP - add from Unix box","groupIdList":[6],"groupNameList":["root"],"status":0,"isVisible":1,"userSource":0,"userRoleList":["ROLE_USER"]} &lt;/P&gt;&lt;P&gt;Modified to include mandatory fields and values to update:&lt;/P&gt;&lt;P&gt;{"id":8,"name":"HDP","firstName":"HDP","lastName":"HDP","emailAddress":"HDP@sandbox.hortonworks.com","description":"HDP - add from Unix box","userRoleList":["ROLE_SYS_ADM"]}&lt;/P&gt;&lt;P&gt;Update the users information and read it back:&lt;/P&gt;&lt;PRE&gt;curl -u admin:admin -v -i -s -X PUT -H "Accept: application/json" -H "Content-Type: application/json" &lt;A href="http://127.0.0.1:6080/service/xusers/secure/users/8" target="_blank"&gt;http://127.0.0.1:6080/service/xusers/secure/users/8&lt;/A&gt; -d @/tmp/curl.out
curl -s -u admin:admin -H "Accept: application/json" -H "Content-Type: application/json" -X GET &lt;A href="http://127.0.0.1:6080/service/xusers/users/8" target="_blank"&gt;http://127.0.0.1:6080/service/xusers/users/8&lt;/A&gt;
&lt;/PRE&gt;&lt;P&gt;{"id":8,"createDate":"2016-03-14T14:41:05Z","updateDate":"2016-09-02T23:08:49Z","owner":"rangerusersync","updatedBy":"Admin","name":"HDP","firstName":"HDP","lastName":"HDP","emailAddress":"HDP@sandbox.hortonworks.com","password":"*****","description":"HDP - add from Unix box","groupIdList":[6],"groupNameList":["root"],"status":0,"isVisible":1,"userSource":0,"userRoleList":["ROLE_SYS_ADM"]}&lt;/P&gt;</description>
      <pubDate>Sat, 03 Sep 2016 06:22:42 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/REST-API-URL-to-change-the-user-role-in-Ranger/m-p/134374#M97036</guid>
      <dc:creator>jhorsch</dc:creator>
      <dc:date>2016-09-03T06:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: REST API URL to change the user role in Ranger?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/REST-API-URL-to-change-the-user-role-in-Ranger/m-p/134375#M97037</link>
      <description>&lt;P&gt;It worked, thanks a lot &lt;A rel="user" href="https://community.cloudera.com/users/510/jhorsch.html" nodeid="510"&gt;@jhorsch&lt;/A&gt;. I was missing some mandatory fields in json payload, that should be the reason for the error.&lt;/P&gt;</description>
      <pubDate>Sat, 03 Sep 2016 07:14:05 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/REST-API-URL-to-change-the-user-role-in-Ranger/m-p/134375#M97037</guid>
      <dc:creator>mrizvi</dc:creator>
      <dc:date>2016-09-03T07:14:05Z</dc:date>
    </item>
  </channel>
</rss>

