You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ranger.apache.org by Burak Emre Kabakcı <em...@rakam.io> on 2018/06/04 13:38:06 UTC

Fetch users via RESTFul API

AFAIK, the latest version of the documentation of RESTFul API is here:
https://cwiki.apache.org/confluence/display/RANGER/Apache+Ranger+0.6+-+REST+APIs+for+Service+Definition%2C+Service+and+Policy+Management#ApacheRanger0.6-RESTAPIsforServiceDefinition,ServiceandPolicyManagement-SearchPoliciesinaService

I'm trying to fetch the all users via RESTFul API and the policies attached
to them but I couldn't find the Users API in the documentation. All I can
fetch is the service definitions and the policies attached to users but
that's not enough for me to integrate Ranger into our application. Is there
any API in order to fetch the users and their groups, if not, is there any
workaround that I can use?

Best,
Emre

Re: Fetch users via RESTFul API

Posted by Pradeep Agrawal <pr...@freestoneinfotech.com>.
Hi Vipin,

There is not much difference actually now, earlier it was planned that
users type API shall be exclusive to handle x_portal_user table data
and xusers API
shall be for x_user table data. but Ranger is using mostly xusers API and
from the same API, it accesses the x_portal_user table data as well.
Developers are rarely adding any new endpoints in users API, but they do
update it whenever required.

On Tue, Jun 5, 2018 at 5:51 AM, Vipin Rathor <v....@gmail.com> wrote:

> Hey Vel,
> Thanks for sharing a great resource. Bookmark'ed now. :)
>
> In fact, I'd be interested to know what is the difference between "xusers"
> and "users" types of APIs. Any quick thought on that?
>
> On Mon, Jun 4, 2018 at 4:20 PM, Velmurugan Periasamy <
> vperiasamy@hortonworks.com> wrote:
>
>> You can also refer http://ranger.apache.org/apidocs/index.html
>>
>> From: Burak Emre Kabakcı <em...@rakam.io>
>> Reply-To: "user@ranger.apache.org" <us...@ranger.apache.org>
>> Date: Monday, June 4, 2018 at 7:13 PM
>> To: "user@ranger.apache.org" <us...@ranger.apache.org>
>> Cc: "user@ranger.incubator.apache.org" <us...@ranger.incubator.apache.org>
>> Subject: Re: Fetch users via RESTFul API
>>
>> Ah, this is a great tip! Now I can inspect the XHR requests to find out
>> which API endpoints I should use. Thanks Vipin!
>>
>> On Tue, Jun 5, 2018 at 1:30 AM Vipin Rathor <v....@gmail.com> wrote:
>>
>>> Hello Emre,
>>>
>>> You can try hitting this API: "/service/xusers/users?page=0&
>>> pageSize=25&startIndex=0"
>>> This gives you list of user records with group names in this XML format:
>>> <vXUsers>
>>> <createDate>2018-02-20T02:05:00.502Z</createDate>
>>> <id>40</id>
>>> <owner>Admin</owner>
>>> <updateDate>2018-02-20T02:05:00.644Z</updateDate>
>>> <updatedBy>Admin</updatedBy>
>>> <description>d44003875 - add from Unix box</description>
>>> <firstName>d44003875</firstName>
>>> <groupIdList>15</groupIdList>
>>> <groupIdList>14</groupIdList>
>>> <groupIdList>17</groupIdList>
>>> <groupNameList>hr</groupNameList>
>>> <groupNameList>hadoop-users</groupNameList>
>>> <groupNameList>Remote Desktop Users</groupNameList>
>>> <isVisible>1</isVisible>
>>> <lastName>d44003875</lastName>
>>> <name>d44003875</name>
>>> <password>*****</password>
>>> <userRoleList>ROLE_USER</userRoleList>
>>> <userSource>1</userSource>
>>> </vXUsers>
>>>
>>> This is actually how Ranger Admin UI gets the users' list. Similarly,
>>> try "/service/xusers/groups?page=0&pageSize=25&startIndex=0" for groups.
>>>
>>> Hope this helps.
>>>
>>> Regards,
>>> Vipin
>>>
>>> On Mon, Jun 4, 2018 at 6:38 AM, Burak Emre Kabakcı <em...@rakam.io>
>>> wrote:
>>>
>>>> AFAIK, the latest version of the documentation of RESTFul API is here:
>>>> https://cwiki.apache.org/confluence/display/RANGER/Apa
>>>> che+Ranger+0.6+-+REST+APIs+for+Service+Definition%2C+Service
>>>> +and+Policy+Management#ApacheRanger0.6-RESTAPIsforServiceDef
>>>> inition,ServiceandPolicyManagement-SearchPoliciesinaService
>>>>
>>>> I'm trying to fetch the all users via RESTFul API and the policies
>>>> attached to them but I couldn't find the Users API in the documentation.
>>>> All I can fetch is the service definitions and the policies attached to
>>>> users but that's not enough for me to integrate Ranger into our
>>>> application. Is there any API in order to fetch the users and their groups,
>>>> if not, is there any workaround that I can use?
>>>>
>>>> Best,
>>>> Emre
>>>>
>>>
>>>
>>>
>>> --
>>> -Rathor
>>>
>>
>
>
> --
> -Rathor
>

Re: Fetch users via RESTFul API

Posted by Vipin Rathor <v....@gmail.com>.
Hey Vel,
Thanks for sharing a great resource. Bookmark'ed now. :)

In fact, I'd be interested to know what is the difference between "xusers"
and "users" types of APIs. Any quick thought on that?

On Mon, Jun 4, 2018 at 4:20 PM, Velmurugan Periasamy <
vperiasamy@hortonworks.com> wrote:

> You can also refer http://ranger.apache.org/apidocs/index.html
>
> From: Burak Emre Kabakcı <em...@rakam.io>
> Reply-To: "user@ranger.apache.org" <us...@ranger.apache.org>
> Date: Monday, June 4, 2018 at 7:13 PM
> To: "user@ranger.apache.org" <us...@ranger.apache.org>
> Cc: "user@ranger.incubator.apache.org" <us...@ranger.incubator.apache.org>
> Subject: Re: Fetch users via RESTFul API
>
> Ah, this is a great tip! Now I can inspect the XHR requests to find out
> which API endpoints I should use. Thanks Vipin!
>
> On Tue, Jun 5, 2018 at 1:30 AM Vipin Rathor <v....@gmail.com> wrote:
>
>> Hello Emre,
>>
>> You can try hitting this API: "/service/xusers/users?page=0&
>> pageSize=25&startIndex=0"
>> This gives you list of user records with group names in this XML format:
>> <vXUsers>
>> <createDate>2018-02-20T02:05:00.502Z</createDate>
>> <id>40</id>
>> <owner>Admin</owner>
>> <updateDate>2018-02-20T02:05:00.644Z</updateDate>
>> <updatedBy>Admin</updatedBy>
>> <description>d44003875 - add from Unix box</description>
>> <firstName>d44003875</firstName>
>> <groupIdList>15</groupIdList>
>> <groupIdList>14</groupIdList>
>> <groupIdList>17</groupIdList>
>> <groupNameList>hr</groupNameList>
>> <groupNameList>hadoop-users</groupNameList>
>> <groupNameList>Remote Desktop Users</groupNameList>
>> <isVisible>1</isVisible>
>> <lastName>d44003875</lastName>
>> <name>d44003875</name>
>> <password>*****</password>
>> <userRoleList>ROLE_USER</userRoleList>
>> <userSource>1</userSource>
>> </vXUsers>
>>
>> This is actually how Ranger Admin UI gets the users' list. Similarly, try
>> "/service/xusers/groups?page=0&pageSize=25&startIndex=0" for groups.
>>
>> Hope this helps.
>>
>> Regards,
>> Vipin
>>
>> On Mon, Jun 4, 2018 at 6:38 AM, Burak Emre Kabakcı <em...@rakam.io> wrote:
>>
>>> AFAIK, the latest version of the documentation of RESTFul API is here:
>>> https://cwiki.apache.org/confluence/display/RANGER/
>>> Apache+Ranger+0.6+-+REST+APIs+for+Service+Definition%2C+
>>> Service+and+Policy+Management#ApacheRanger0.6-
>>> RESTAPIsforServiceDefinition,ServiceandPolicyManagement-
>>> SearchPoliciesinaService
>>>
>>> I'm trying to fetch the all users via RESTFul API and the policies
>>> attached to them but I couldn't find the Users API in the documentation.
>>> All I can fetch is the service definitions and the policies attached to
>>> users but that's not enough for me to integrate Ranger into our
>>> application. Is there any API in order to fetch the users and their groups,
>>> if not, is there any workaround that I can use?
>>>
>>> Best,
>>> Emre
>>>
>>
>>
>>
>> --
>> -Rathor
>>
>


-- 
-Rathor

Re: Fetch users via RESTFul API

Posted by Velmurugan Periasamy <vp...@hortonworks.com>.
You can also refer http://ranger.apache.org/apidocs/index.html

From: Burak Emre Kabakci <em...@rakam.io>>
Reply-To: "user@ranger.apache.org<ma...@ranger.apache.org>" <us...@ranger.apache.org>>
Date: Monday, June 4, 2018 at 7:13 PM
To: "user@ranger.apache.org<ma...@ranger.apache.org>" <us...@ranger.apache.org>>
Cc: "user@ranger.incubator.apache.org<ma...@ranger.incubator.apache.org>" <us...@ranger.incubator.apache.org>>
Subject: Re: Fetch users via RESTFul API

Ah, this is a great tip! Now I can inspect the XHR requests to find out which API endpoints I should use. Thanks Vipin!

On Tue, Jun 5, 2018 at 1:30 AM Vipin Rathor <v....@gmail.com>> wrote:
Hello Emre,

You can try hitting this API: "/service/xusers/users?page=0&pageSize=25&startIndex=0"
This gives you list of user records with group names in this XML format:
<vXUsers>
<createDate>2018-02-20T02:05:00.502Z</createDate>
<id>40</id>
<owner>Admin</owner>
<updateDate>2018-02-20T02:05:00.644Z</updateDate>
<updatedBy>Admin</updatedBy>
<description>d44003875 - add from Unix box</description>
<firstName>d44003875</firstName>
<groupIdList>15</groupIdList>
<groupIdList>14</groupIdList>
<groupIdList>17</groupIdList>
<groupNameList>hr</groupNameList>
<groupNameList>hadoop-users</groupNameList>
<groupNameList>Remote Desktop Users</groupNameList>
<isVisible>1</isVisible>
<lastName>d44003875</lastName>
<name>d44003875</name>
<password>*****</password>
<userRoleList>ROLE_USER</userRoleList>
<userSource>1</userSource>
</vXUsers>

This is actually how Ranger Admin UI gets the users' list. Similarly, try "/service/xusers/groups?page=0&pageSize=25&startIndex=0" for groups.

Hope this helps.

Regards,
Vipin

On Mon, Jun 4, 2018 at 6:38 AM, Burak Emre Kabakci <em...@rakam.io>> wrote:
AFAIK, the latest version of the documentation of RESTFul API is here: https://cwiki.apache.org/confluence/display/RANGER/Apache+Ranger+0.6+-+REST+APIs+for+Service+Definition%2C+Service+and+Policy+Management#ApacheRanger0.6-RESTAPIsforServiceDefinition,ServiceandPolicyManagement-SearchPoliciesinaService

I'm trying to fetch the all users via RESTFul API and the policies attached to them but I couldn't find the Users API in the documentation. All I can fetch is the service definitions and the policies attached to users but that's not enough for me to integrate Ranger into our application. Is there any API in order to fetch the users and their groups, if not, is there any workaround that I can use?

Best,
Emre



--
-Rathor

Re: Fetch users via RESTFul API

Posted by Burak Emre Kabakcı <em...@rakam.io>.
Ah, this is a great tip! Now I can inspect the XHR requests to find out
which API endpoints I should use. Thanks Vipin!

On Tue, Jun 5, 2018 at 1:30 AM Vipin Rathor <v....@gmail.com> wrote:

> Hello Emre,
>
> You can try hitting this API:
> "/service/xusers/users?page=0&pageSize=25&startIndex=0"
> This gives you list of user records with group names in this XML format:
> <vXUsers>
> <createDate>2018-02-20T02:05:00.502Z</createDate>
> <id>40</id>
> <owner>Admin</owner>
> <updateDate>2018-02-20T02:05:00.644Z</updateDate>
> <updatedBy>Admin</updatedBy>
> <description>d44003875 - add from Unix box</description>
> <firstName>d44003875</firstName>
> <groupIdList>15</groupIdList>
> <groupIdList>14</groupIdList>
> <groupIdList>17</groupIdList>
> <groupNameList>hr</groupNameList>
> <groupNameList>hadoop-users</groupNameList>
> <groupNameList>Remote Desktop Users</groupNameList>
> <isVisible>1</isVisible>
> <lastName>d44003875</lastName>
> <name>d44003875</name>
> <password>*****</password>
> <userRoleList>ROLE_USER</userRoleList>
> <userSource>1</userSource>
> </vXUsers>
>
> This is actually how Ranger Admin UI gets the users' list. Similarly, try
> "/service/xusers/groups?page=0&pageSize=25&startIndex=0" for groups.
>
> Hope this helps.
>
> Regards,
> Vipin
>
> On Mon, Jun 4, 2018 at 6:38 AM, Burak Emre Kabakcı <em...@rakam.io> wrote:
>
>> AFAIK, the latest version of the documentation of RESTFul API is here:
>> https://cwiki.apache.org/confluence/display/RANGER/Apache+Ranger+0.6+-+REST+APIs+for+Service+Definition%2C+Service+and+Policy+Management#ApacheRanger0.6-RESTAPIsforServiceDefinition,ServiceandPolicyManagement-SearchPoliciesinaService
>>
>> I'm trying to fetch the all users via RESTFul API and the policies
>> attached to them but I couldn't find the Users API in the documentation.
>> All I can fetch is the service definitions and the policies attached to
>> users but that's not enough for me to integrate Ranger into our
>> application. Is there any API in order to fetch the users and their groups,
>> if not, is there any workaround that I can use?
>>
>> Best,
>> Emre
>>
>
>
>
> --
> -Rathor
>

Re: Fetch users via RESTFul API

Posted by Vipin Rathor <v....@gmail.com>.
Hello Emre,

You can try hitting this API:
"/service/xusers/users?page=0&pageSize=25&startIndex=0"
This gives you list of user records with group names in this XML format:
<vXUsers>
<createDate>2018-02-20T02:05:00.502Z</createDate>
<id>40</id>
<owner>Admin</owner>
<updateDate>2018-02-20T02:05:00.644Z</updateDate>
<updatedBy>Admin</updatedBy>
<description>d44003875 - add from Unix box</description>
<firstName>d44003875</firstName>
<groupIdList>15</groupIdList>
<groupIdList>14</groupIdList>
<groupIdList>17</groupIdList>
<groupNameList>hr</groupNameList>
<groupNameList>hadoop-users</groupNameList>
<groupNameList>Remote Desktop Users</groupNameList>
<isVisible>1</isVisible>
<lastName>d44003875</lastName>
<name>d44003875</name>
<password>*****</password>
<userRoleList>ROLE_USER</userRoleList>
<userSource>1</userSource>
</vXUsers>

This is actually how Ranger Admin UI gets the users' list. Similarly, try
"/service/xusers/groups?page=0&pageSize=25&startIndex=0" for groups.

Hope this helps.

Regards,
Vipin

On Mon, Jun 4, 2018 at 6:38 AM, Burak Emre Kabakcı <em...@rakam.io> wrote:

> AFAIK, the latest version of the documentation of RESTFul API is here:
> https://cwiki.apache.org/confluence/display/RANGER/
> Apache+Ranger+0.6+-+REST+APIs+for+Service+Definition%2C+
> Service+and+Policy+Management#ApacheRanger0.6-
> RESTAPIsforServiceDefinition,ServiceandPolicyManagement-
> SearchPoliciesinaService
>
> I'm trying to fetch the all users via RESTFul API and the policies
> attached to them but I couldn't find the Users API in the documentation.
> All I can fetch is the service definitions and the policies attached to
> users but that's not enough for me to integrate Ranger into our
> application. Is there any API in order to fetch the users and their groups,
> if not, is there any workaround that I can use?
>
> Best,
> Emre
>



-- 
-Rathor