[
https://issues.apache.org/jira/browse/RANGER-4056?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17684759#comment-17684759
]
Ramachandran commented on RANGER-4056:
--------------------------------------
As part of service/xusers/users endpoint for the create user is not honouring
to associate the group for the given user
[[email protected]] Is this the expected behaviour for this API?
{code:java}
public VXUser createXUserWithOutLogin(VXUser vXUser) {
checkAdminAccess();
xaBizUtil.blockAuditorRoleUser();
validatePassword(vXUser);
VXUser ret = xUserService.createXUserWithOutLogin(vXUser);
updateUserStoreVersion("createXUserWithOutLogin(" + vXUser.getName() + ")");
return ret;
}
public VXUser createXUserWithOutLogin(VXUser vxUser) {
XXUser xxUser = daoManager.getXXUser().findByUserName(vxUser.getName());
boolean userExists = true;
if (xxUser == null) {
xxUser = new XXUser();
userExists = false;
}
XXPortalUser xxPortalUser = daoManager.getXXPortalUser().findByLoginId(
vxUser.getName());
if (xxPortalUser != null
&& xxPortalUser.getUserSource() == RangerCommonEnums.USER_EXTERNAL) {
vxUser.setIsVisible(xxUser.getIsVisible());
}
xxUser = mapViewToEntityBean(vxUser, xxUser, 0);
XXPortalUser xXPortalUser =
daoManager.getXXPortalUser().getById(createdByUserId);
if (xXPortalUser != null) {
xxUser.setAddedByUserId(createdByUserId);
xxUser.setUpdatedByUserId(createdByUserId);
}
if (userExists) {
xxUser = getDao().update(xxUser);
} else {
xxUser = getDao().create(xxUser);
}
vxUser = postCreate(xxUser);
return vxUser;
}
{code}
> Not able to attach a user to a group while creating it from
> service/xusers/users endpoint.
> ------------------------------------------------------------------------------------------
>
> Key: RANGER-4056
> URL: https://issues.apache.org/jira/browse/RANGER-4056
> Project: Ranger
> Issue Type: Bug
> Components: Ranger
> Affects Versions: 2.3.0
> Reporter: Kundan Kumar Jha
> Assignee: Ramachandran
> Priority: Major
>
> Problem statement:
> While creating a user from the service/xusers/users its not attaching the
> group in the groupNameList.
> Steps to reproduce:
> Create user by doing post request on service/xusers/users endpoint with
> paylload having "public" as group in it.
> Payload:
> { "name":"temp_user_abc_123", "firstName":"user1", "lastName": "user1",
> "loginId": "user1", "emailAddress" : null, "description" : "user1 desc",
> "password" : "user1Pass@123", "groupIdList":[1], "groupNameList":["public"],
> "status":1, "isVisible":1, "userRoleList": [ "ROLE_USER" ], "userSource": 0 }
>
> Response:
> { "id": 321, "createDate": "2023-01-17T06:18:58Z", "updateDate":
> "2023-01-17T06:18:58Z", "owner": "Admin", "updatedBy": "Admin",
> "name": "temp_user_abc_123", "description": "user1 desc",
> "groupIdList": [], "groupNameList": [], "status": 0, "isVisible":
> 1, "userSource": 0, "userRoleList": [ "ROLE_USER" ] }
>
> In the payload we have provided the "public" as group in groupNameList but in
> the response the groupNameList is empty.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)