Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

delete user REST API in ranger 0.7 is not deleting

avatar
Guru
[s0998dnz@m1.hdp22 ~]$ curl -s -u admin:admin -H "Accept: application/json" -H "Content-Type: application/json" -X GET http://m1.hdp22:6080/service/xusers/secure/users/416 | python -m json.tool
{
    "createDate": "2017-09-22T14:19:47Z", 
    "description": "user1 desc", 
    "firstName": "user1", 
    "groupIdList": [
        2, 
        12
    ], 
    "groupNameList": [
        "gg_s7_data1_home_s5", 
        "dl-go-hadoop-users"
    ], 
    "id": 416, 
    "isVisible": 0, 
    "lastName": "user1", 
    "name": "user1", 
    "owner": "admin admin", 
    "password": "*****", 
    "status": 1, 
    "updateDate": "2017-09-22T14:20:13Z", 
    "updatedBy": "admin admin", 
    "userRoleList": [
        "ROLE_USER"
    ], 
    "userSource": 0
}
[s0998dnz@m1.hdp22 ~]$ curl -u admin:admin -v -i -s -X DELETE -H "Content-Type: application/json" http://m1.hdp22:6080/service/xusers/users/416
* About to connect() to m1.hdp22 port 6080 (#0)
*   Trying 172.29.90.10... connected
* Connected to m1.hdp22 (172.29.90.10) port 6080 (#0)
* Server auth using Basic with user 'admin'
> DELETE /service/xusers/users/416 HTTP/1.1
> Authorization: Basic c2F1cmt1bWE6U2VwdEAyMDE0
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: m1.hdp22:6080
> Accept: */*
> Content-Type: application/json
> 
< HTTP/1.1 204 No Content
HTTP/1.1 204 No Content
< Server: Apache-Coyote/1.1
Server: Apache-Coyote/1.1
< Set-Cookie: RANGERADMINSESSIONID=21FBD20B95E71693980D2118C4A65BD2; Path=/; HttpOnly
Set-Cookie: RANGERADMINSESSIONID=21FBD20B95E71693980D2118C4A65BD2; Path=/; HttpOnly
< X-Frame-Options: DENY
X-Frame-Options: DENY
< Date: Fri, 22 Sep 2017 14:44:31 GMT
Date: Fri, 22 Sep 2017 14:44:31 GMT


< 
* Connection #0 to host m1.hdp22 left intact
* Closing connection #0


[s0998dnz@m1.hdp22 ~]$ curl -s -u admin:admin -H "Accept: application/json" -H "Content-Type: application/json" -X GET http://m1.hdp22:6080/service/xusers/secure/users/416 | python -m json.tool
{
    "createDate": "2017-09-22T14:19:47Z", 
    "description": "user1 desc", 
    "firstName": "user1", 
    "groupIdList": [
        2, 
        12
    ], 
    "groupNameList": [
        "gg_s7_data1_home_s5", 
        "dl-go-hadoop-users"
    ], 
    "id": 416, 
    "isVisible": 0, 
    "lastName": "user1", 
    "name": "user1", 
    "owner": "admin admin", 
    "password": "*****", 
    "status": 1, 
    "updateDate": "2017-09-22T14:20:13Z", 
    "updatedBy": "admin admin", 
    "userRoleList": [
        "ROLE_USER"
    ], 
    "userSource": 0
}


1 ACCEPTED SOLUTION

avatar

Usually the delete calls for users do a soft delete, i.e. they change the status of the user to be not visible. Try passing forceDelete=true to the URL to achieve hard delete.

View solution in original post

2 REPLIES 2

avatar

Usually the delete calls for users do a soft delete, i.e. they change the status of the user to be not visible. Try passing forceDelete=true to the URL to achieve hard delete.

avatar
Guru

thanks @vperiasamy. I used forceDelete=true and its deleted user from ranger.

curl -u admin:admin -v -i -s -X DELETE -H "Content-Type: application/json" http://m1.hdp22:6080/service/xusers/users/416?forceDelete=true