You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by "Karthik Kothareddy (karthikk) [CONT - Type 2]" <ka...@micron.com> on 2017/08/09 16:58:43 UTC

RE: [EXT] Re: Updating users through Rest API

Matt,

Sorry I forgot to update the  community on this. I tried what you suggested and it worked like magic. So the right way to do it is 

1. Create a user first and get his UID, do not give him a UID and give Version: 0 (POST)
2. Get a UserGroup (json format). (GET)
3. Add the new user using UserGroup json returned from Step-2. Add UID and respective version, permissions to the Json. (PUT)

I hope the procedure is similar for the access policies.

Thanks
Karthik

-----Original Message-----
From: Matt Gilman [mailto:matt.c.gilman@gmail.com] 
Sent: Friday, August 04, 2017 10:31 AM
To: dev@nifi.apache.org
Subject: [EXT] Re: Updating users through Rest API

Karthik,

Group membership is managed through the group. So you would need to update the group by adding the user identifier to the users list and 'PUT' that.
To see these requests in action, I would suggest opening the Developer Tools of your browser as the UI uses the REST API exclusively.

Please let me know if you have any follow-up questions.

Thanks

Matt

On Fri, Aug 4, 2017 at 11:50 AM, Karthik Kothareddy (karthikk) [CONT - Type 2] <ka...@micron.com> wrote:

> Hello All,
>
> I am trying to add/update users through REST API, I am using 
> InvokeHTTP to do that, I tried simple addition of user with the below 
> Json and it worked perfectly.
>
> {
>   "revision" : {
>     "version" : 0
>   },
>   "permissions" : {
>     "canRead" : true,
>     "canWrite" : false
>   },
>   "component" : {
>     "identity" : "testuser"
>   }
> }
>
> However, once the user is added I am trying to add him to the user 
> groups that I have for my instance. I'm using the json that I got by 
> querying a different user by (/tenants/users/{id}). I have updated all 
> the UID in the returned json to match the other user and use this PUT 
> /tenants/users/{id} for the update. It doesn't seem to have any effect 
> on the "testuser", it still says he does not belong any group. Can 
> anyone help me with some examples on how to effectively add/update users.
>
> Thanks for your time,
>
> -Karthik
>