arcgis-rest-js icon indicating copy to clipboard operation
arcgis-rest-js copied to clipboard

Elevating User Level

Open FardoshtAmirpanahi opened this issue 4 years ago • 4 comments

I am trying to elevate a user level from "1" to "2". The following Update method returns successfully, but the user level stays at "1". updateUser({authentication: this.adminSession, user:{username:this.member.username, level: "2" }}).then(response => { alert("Update Successful"); }).catch(error => { alert(error); }) Best regards, Fardosht

FardoshtAmirpanahi avatar Jun 29 '20 00:06 FardoshtAmirpanahi

Both under ArcGIS API for Python and REST API there is a separate method to update user level. I couldn't find a similar method under ArcGIS REST JS.

I very much appreciate it if someone could suggest a workaround. I have spent a lot of time on this dashboard to have to abandon it for this one functionality.

https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#user https://developers.arcgis.com/rest/users-groups-and-items/update-user-level.htm

Best Regards, Fardosht

FardoshtAmirpanahi avatar Jul 01 '20 12:07 FardoshtAmirpanahi

Can anyone help me with this?

FardoshtAmirpanahi avatar Aug 05 '20 17:08 FardoshtAmirpanahi

have you tried passing that value as an integer instead of a string?

updateUser({
  authentication: this.adminSession, 
  user: { 
    username:this.member.username, 
    level: 2 
  }
})

if that doesn't work i don't have a better idea than sniffing the web traffic in ArcGIS Online and seeing if you can spot the difference in the request there.

jgravois avatar Aug 05 '20 18:08 jgravois

Thanks jgravois for your sugession. I have almost exact the same code. Even thought the alert shows response was successful, the user's level does not change.

I checked the this.member.level is 2. I even tried "2".

updateUser({ authentication: this.adminSession, user:{ username:this.member.username, level: this.member.level } }).then(response => { alert(response.success) }).catch(error => { alert(error); })

All the best, Fardosht

FardoshtAmirpanahi avatar Aug 05 '20 19:08 FardoshtAmirpanahi