use of org.apache.ranger.view.VXString in project ranger by apache.
the class UserMgr method setUserRoles.
/**
* @param userId
* @param vStringRolesList
*/
public void setUserRoles(Long userId, List<VXString> vStringRolesList) {
List<String> stringRolesList = new ArrayList<String>();
for (VXString vXString : vStringRolesList) {
stringRolesList.add(vXString.getValue());
}
xUserMgr.checkAccessRoles(stringRolesList);
rangerBizUtil.blockAuditorRoleUser();
VXPortalUser oldUserProfile = getUserProfile(userId);
xUserMgr.updateUserRolesPermissions(oldUserProfile, stringRolesList);
}
use of org.apache.ranger.view.VXString in project ranger by apache.
the class ServiceDBStore method getPolicyVersionList.
public VXString getPolicyVersionList(Long policyId) {
List<Integer> versionList = daoMgr.getXXDataHist().getVersionListOfObject(policyId, AppConstants.CLASS_TYPE_RANGER_POLICY);
VXString vXString = new VXString();
vXString.setValue(StringUtils.join(versionList, ","));
return vXString;
}
use of org.apache.ranger.view.VXString in project ranger by apache.
the class TestXUserREST method test99deleteUsersByUserName.
@Test
public void test99deleteUsersByUserName() {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
String TestforceDeleteStr = "true";
boolean forceDelete = false;
Mockito.when(request.getParameter("forceDelete")).thenReturn(TestforceDeleteStr);
VXString testVXString = new VXString();
testVXString.setValue("User1");
VXUser testVXUser = createVXUser();
VXStringList vxStringList = createVXStringList();
Mockito.when(xUserService.getXUserByUserName(testVXString.getValue())).thenReturn(testVXUser);
forceDelete = true;
Mockito.doNothing().when(xUserMgr).deleteXUser(testVXUser.getId(), forceDelete);
xUserRest.deleteUsersByUserName(request, vxStringList);
Mockito.verify(xUserMgr).deleteXUser(testVXUser.getId(), forceDelete);
Mockito.verify(xUserService).getXUserByUserName(testVXString.getValue());
Mockito.verify(request).getParameter("forceDelete");
}
use of org.apache.ranger.view.VXString in project ranger by apache.
the class TestXUserREST method test100deleteUsersByUserNameNull.
@Test
public void test100deleteUsersByUserNameNull() {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
String TestforceDeleteStr = "false";
boolean forceDelete = true;
Mockito.when(request.getParameter("forceDelete")).thenReturn(TestforceDeleteStr);
VXString testVXString = new VXString();
testVXString.setValue("User1");
VXUser testVXUser = createVXUser();
VXStringList vxStringList = createVXStringList();
Mockito.when(xUserService.getXUserByUserName(testVXString.getValue())).thenReturn(testVXUser);
forceDelete = false;
Mockito.doNothing().when(xUserMgr).deleteXUser(testVXUser.getId(), forceDelete);
xUserRest.deleteUsersByUserName(request, vxStringList);
Mockito.verify(xUserMgr).deleteXUser(testVXUser.getId(), forceDelete);
Mockito.verify(xUserService).getXUserByUserName(testVXString.getValue());
Mockito.verify(request).getParameter("forceDelete");
}
use of org.apache.ranger.view.VXString in project ranger by apache.
the class TestXUserREST method test112deleteUsersByUserNameNull.
@Test
public void test112deleteUsersByUserNameNull() {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
String TestforceDeleteStr = "true";
Mockito.when(request.getParameter("forceDelete")).thenReturn(TestforceDeleteStr);
VXString testVXString = new VXString();
testVXString.setValue(null);
VXStringList vxStringList = createVXStringListGroup();
List<VXString> testVXStrings = new ArrayList<VXString>();
testVXStrings.add(testVXString);
vxStringList.setVXStrings(testVXStrings);
xUserRest.deleteGroupsByGroupName(request, vxStringList);
Mockito.verify(request).getParameter("forceDelete");
}
Aggregations