Search in sources :

Example 11 with XXModuleDef

use of org.apache.ranger.entity.XXModuleDef in project ranger by apache.

the class TestUserMgr method test17ChangeEmailAddressAsKeyAdmin.

@Test
public void test17ChangeEmailAddressAsKeyAdmin() {
    setupKeyAdmin();
    XXPortalUserDao userDao = Mockito.mock(XXPortalUserDao.class);
    XXPortalUserRoleDao roleDao = Mockito.mock(XXPortalUserRoleDao.class);
    XXUserPermissionDao xUserPermissionDao = Mockito.mock(XXUserPermissionDao.class);
    XXGroupPermissionDao xGroupPermissionDao = Mockito.mock(XXGroupPermissionDao.class);
    XXModuleDefDao xModuleDefDao = Mockito.mock(XXModuleDefDao.class);
    XXModuleDef xModuleDef = Mockito.mock(XXModuleDef.class);
    VXPortalUser userProfile = userProfile();
    XXPortalUser userKeyAdmin = new XXPortalUser();
    userKeyAdmin.setEmailAddress(userProfile.getEmailAddress());
    userKeyAdmin.setFirstName(userProfile.getFirstName());
    userKeyAdmin.setLastName(userProfile.getLastName());
    userKeyAdmin.setLoginId(userProfile.getLoginId());
    String encryptedPwd = userMgr.encrypt(userProfile.getLoginId(), userProfile.getPassword());
    userKeyAdmin.setPassword(encryptedPwd);
    userKeyAdmin.setUserSource(userProfile.getUserSource());
    userKeyAdmin.setPublicScreenName(userProfile.getPublicScreenName());
    userKeyAdmin.setId(userProfile.getId());
    VXPasswordChange changeEmail = new VXPasswordChange();
    changeEmail.setEmailAddress("testuser@test.com");
    changeEmail.setId(userKeyAdmin.getId());
    changeEmail.setLoginId(userKeyAdmin.getLoginId());
    changeEmail.setOldPassword(userProfile.getPassword());
    XXPortalUserRole XXPortalUserRole = new XXPortalUserRole();
    XXPortalUserRole.setId(userId);
    XXPortalUserRole.setUserRole("ROLE_USER");
    List<XXPortalUserRole> list = new ArrayList<XXPortalUserRole>();
    list.add(XXPortalUserRole);
    List<XXUserPermission> xUserPermissionsList = new ArrayList<XXUserPermission>();
    XXUserPermission xUserPermissionObj = new XXUserPermission();
    xUserPermissionObj.setAddedByUserId(userId);
    xUserPermissionObj.setCreateTime(new Date());
    xUserPermissionObj.setId(userId);
    xUserPermissionObj.setIsAllowed(1);
    xUserPermissionObj.setModuleId(1L);
    xUserPermissionObj.setUpdatedByUserId(userId);
    xUserPermissionObj.setUpdateTime(new Date());
    xUserPermissionObj.setUserId(userId);
    xUserPermissionsList.add(xUserPermissionObj);
    List<XXGroupPermission> xGroupPermissionList = new ArrayList<XXGroupPermission>();
    XXGroupPermission xGroupPermissionObj = new XXGroupPermission();
    xGroupPermissionObj.setAddedByUserId(userId);
    xGroupPermissionObj.setCreateTime(new Date());
    xGroupPermissionObj.setId(userId);
    xGroupPermissionObj.setIsAllowed(1);
    xGroupPermissionObj.setModuleId(1L);
    xGroupPermissionObj.setUpdatedByUserId(userId);
    xGroupPermissionObj.setUpdateTime(new Date());
    xGroupPermissionObj.setGroupId(userId);
    xGroupPermissionList.add(xGroupPermissionObj);
    VXUserPermission userPermission = new VXUserPermission();
    userPermission.setId(1L);
    userPermission.setIsAllowed(1);
    userPermission.setModuleId(1L);
    userPermission.setUserId(userId);
    userPermission.setUserName("xyz");
    userPermission.setOwner("admin");
    VXGroupPermission groupPermission = new VXGroupPermission();
    groupPermission.setId(1L);
    groupPermission.setIsAllowed(1);
    groupPermission.setModuleId(1L);
    groupPermission.setGroupId(userId);
    groupPermission.setGroupName("xyz");
    groupPermission.setOwner("admin");
    Mockito.when(stringUtil.validateEmail(Mockito.anyString())).thenReturn(true);
    Mockito.when(stringUtil.equals(Mockito.anyString(), Mockito.anyString())).thenReturn(true);
    Mockito.when(stringUtil.normalizeEmail(Mockito.anyString())).thenReturn(changeEmail.getEmailAddress());
    Mockito.when(daoManager.getXXPortalUser()).thenReturn(userDao);
    Mockito.when(daoManager.getXXPortalUserRole()).thenReturn(roleDao);
    Mockito.when(roleDao.findByParentId(Mockito.anyLong())).thenReturn(list);
    Mockito.when(daoManager.getXXUserPermission()).thenReturn(xUserPermissionDao);
    Mockito.when(daoManager.getXXGroupPermission()).thenReturn(xGroupPermissionDao);
    Mockito.when(xUserPermissionDao.findByUserPermissionIdAndIsAllowed(userProfile.getId())).thenReturn(xUserPermissionsList);
    Mockito.when(xGroupPermissionDao.findbyVXPortalUserId(userProfile.getId())).thenReturn(xGroupPermissionList);
    Mockito.when(xGroupPermissionService.populateViewBean(xGroupPermissionObj)).thenReturn(groupPermission);
    Mockito.when(xUserPermissionService.populateViewBean(xUserPermissionObj)).thenReturn(userPermission);
    Mockito.when(daoManager.getXXModuleDef()).thenReturn(xModuleDefDao);
    Mockito.when(xModuleDefDao.findByModuleId(Mockito.anyLong())).thenReturn(xModuleDef);
    Mockito.doNothing().when(rangerBizUtil).blockAuditorRoleUser();
    VXPortalUser dbVXPortalUser = userMgr.changeEmailAddress(userKeyAdmin, changeEmail);
    Assert.assertNotNull(dbVXPortalUser);
    Assert.assertEquals(userId, dbVXPortalUser.getId());
    Assert.assertEquals(userProfile.getLastName(), dbVXPortalUser.getLastName());
    Assert.assertEquals(changeEmail.getLoginId(), dbVXPortalUser.getLoginId());
    Assert.assertEquals(changeEmail.getEmailAddress(), dbVXPortalUser.getEmailAddress());
}
Also used : XXGroupPermission(org.apache.ranger.entity.XXGroupPermission) VXPasswordChange(org.apache.ranger.view.VXPasswordChange) XXUserPermissionDao(org.apache.ranger.db.XXUserPermissionDao) XXGroupPermissionDao(org.apache.ranger.db.XXGroupPermissionDao) ArrayList(java.util.ArrayList) XXModuleDefDao(org.apache.ranger.db.XXModuleDefDao) VXString(org.apache.ranger.view.VXString) XXUserPermission(org.apache.ranger.entity.XXUserPermission) Date(java.util.Date) VXUserPermission(org.apache.ranger.view.VXUserPermission) XXPortalUserRoleDao(org.apache.ranger.db.XXPortalUserRoleDao) XXPortalUser(org.apache.ranger.entity.XXPortalUser) XXModuleDef(org.apache.ranger.entity.XXModuleDef) VXGroupPermission(org.apache.ranger.view.VXGroupPermission) XXPortalUserDao(org.apache.ranger.db.XXPortalUserDao) VXPortalUser(org.apache.ranger.view.VXPortalUser) XXPortalUserRole(org.apache.ranger.entity.XXPortalUserRole) Test(org.junit.Test)

Example 12 with XXModuleDef

use of org.apache.ranger.entity.XXModuleDef in project ranger by apache.

the class TestUserMgr method test29DeactivateUser.

@Test
public void test29DeactivateUser() {
    setup();
    XXPortalUserDao userDao = Mockito.mock(XXPortalUserDao.class);
    XXPortalUserRoleDao roleDao = Mockito.mock(XXPortalUserRoleDao.class);
    XXUserPermissionDao xUserPermissionDao = Mockito.mock(XXUserPermissionDao.class);
    XXGroupPermissionDao xGroupPermissionDao = Mockito.mock(XXGroupPermissionDao.class);
    VXGroupPermission vXGroupPermission = Mockito.mock(VXGroupPermission.class);
    XXModuleDefDao xModuleDefDao = Mockito.mock(XXModuleDefDao.class);
    XXModuleDef xModuleDef = Mockito.mock(XXModuleDef.class);
    VXUserPermission vXUserPermission = Mockito.mock(VXUserPermission.class);
    VXPortalUser userProfile = userProfile();
    XXPortalUser user = new XXPortalUser();
    user.setEmailAddress(userProfile.getEmailAddress());
    user.setFirstName(userProfile.getFirstName());
    user.setLastName(userProfile.getLastName());
    user.setLoginId(userProfile.getLoginId());
    user.setPassword(userProfile.getPassword());
    user.setUserSource(userProfile.getUserSource());
    user.setPublicScreenName(userProfile.getPublicScreenName());
    user.setId(userProfile.getId());
    List<XXUserPermission> xUserPermissionsList = new ArrayList<XXUserPermission>();
    XXUserPermission xUserPermissionObj = new XXUserPermission();
    xUserPermissionObj.setAddedByUserId(userId);
    xUserPermissionObj.setCreateTime(new Date());
    xUserPermissionObj.setId(userId);
    xUserPermissionObj.setIsAllowed(1);
    xUserPermissionObj.setModuleId(1L);
    xUserPermissionObj.setUpdatedByUserId(userId);
    xUserPermissionObj.setUpdateTime(new Date());
    xUserPermissionObj.setUserId(userId);
    xUserPermissionsList.add(xUserPermissionObj);
    List<XXGroupPermission> xGroupPermissionList = new ArrayList<XXGroupPermission>();
    XXGroupPermission xGroupPermissionObj = new XXGroupPermission();
    xGroupPermissionObj.setAddedByUserId(userId);
    xGroupPermissionObj.setCreateTime(new Date());
    xGroupPermissionObj.setId(userId);
    xGroupPermissionObj.setIsAllowed(1);
    xGroupPermissionObj.setModuleId(1L);
    xGroupPermissionObj.setUpdatedByUserId(userId);
    xGroupPermissionObj.setUpdateTime(new Date());
    xGroupPermissionObj.setGroupId(userId);
    xGroupPermissionList.add(xGroupPermissionObj);
    XXPortalUserRole XXPortalUserRole = new XXPortalUserRole();
    XXPortalUserRole.setId(userId);
    XXPortalUserRole.setUserRole("ROLE_USER");
    List<XXPortalUserRole> list = new ArrayList<XXPortalUserRole>();
    list.add(XXPortalUserRole);
    Mockito.when(daoManager.getXXPortalUser()).thenReturn(userDao);
    Mockito.when(userDao.update(user)).thenReturn(user);
    Mockito.when(daoManager.getXXPortalUserRole()).thenReturn(roleDao);
    Mockito.when(roleDao.findByParentId(Mockito.anyLong())).thenReturn(list);
    Mockito.when(daoManager.getXXUserPermission()).thenReturn(xUserPermissionDao);
    Mockito.when(xUserPermissionDao.findByUserPermissionIdAndIsAllowed(userProfile.getId())).thenReturn(xUserPermissionsList);
    Mockito.when(daoManager.getXXGroupPermission()).thenReturn(xGroupPermissionDao);
    Mockito.when(xGroupPermissionDao.findbyVXPortalUserId(userProfile.getId())).thenReturn(xGroupPermissionList);
    Mockito.when(xGroupPermissionService.populateViewBean(xGroupPermissionObj)).thenReturn(vXGroupPermission);
    Mockito.when(daoManager.getXXModuleDef()).thenReturn(xModuleDefDao);
    Mockito.when(xModuleDefDao.findByModuleId(Mockito.anyLong())).thenReturn(xModuleDef);
    Mockito.when(xUserPermissionService.populateViewBean(xUserPermissionObj)).thenReturn(vXUserPermission);
    Mockito.doNothing().when(rangerBizUtil).blockAuditorRoleUser();
    VXPortalUser dbVXPortalUser = userMgr.deactivateUser(user);
    Assert.assertNotNull(dbVXPortalUser);
    Assert.assertEquals(user.getId(), dbVXPortalUser.getId());
    Assert.assertEquals(user.getFirstName(), dbVXPortalUser.getFirstName());
    Assert.assertEquals(user.getFirstName(), dbVXPortalUser.getFirstName());
    Assert.assertEquals(user.getLastName(), dbVXPortalUser.getLastName());
    Assert.assertEquals(user.getLoginId(), dbVXPortalUser.getLoginId());
    Mockito.verify(daoManager).getXXPortalUser();
    Mockito.verify(daoManager).getXXUserPermission();
    Mockito.verify(daoManager).getXXGroupPermission();
    Mockito.verify(xUserPermissionService).populateViewBean(xUserPermissionObj);
    Mockito.verify(xGroupPermissionService).populateViewBean(xGroupPermissionObj);
}
Also used : XXGroupPermission(org.apache.ranger.entity.XXGroupPermission) XXUserPermissionDao(org.apache.ranger.db.XXUserPermissionDao) XXGroupPermissionDao(org.apache.ranger.db.XXGroupPermissionDao) ArrayList(java.util.ArrayList) XXModuleDefDao(org.apache.ranger.db.XXModuleDefDao) XXUserPermission(org.apache.ranger.entity.XXUserPermission) VXUserPermission(org.apache.ranger.view.VXUserPermission) Date(java.util.Date) XXPortalUserRoleDao(org.apache.ranger.db.XXPortalUserRoleDao) XXPortalUser(org.apache.ranger.entity.XXPortalUser) XXModuleDef(org.apache.ranger.entity.XXModuleDef) VXGroupPermission(org.apache.ranger.view.VXGroupPermission) XXPortalUserDao(org.apache.ranger.db.XXPortalUserDao) VXPortalUser(org.apache.ranger.view.VXPortalUser) XXPortalUserRole(org.apache.ranger.entity.XXPortalUserRole) Test(org.junit.Test)

Example 13 with XXModuleDef

use of org.apache.ranger.entity.XXModuleDef in project ranger by apache.

the class TestUserMgr method test16ChangeEmailAddressAsAdmin.

@Test
public void test16ChangeEmailAddressAsAdmin() {
    setup();
    XXPortalUserDao userDao = Mockito.mock(XXPortalUserDao.class);
    XXPortalUserRoleDao roleDao = Mockito.mock(XXPortalUserRoleDao.class);
    XXUserPermissionDao xUserPermissionDao = Mockito.mock(XXUserPermissionDao.class);
    XXGroupPermissionDao xGroupPermissionDao = Mockito.mock(XXGroupPermissionDao.class);
    XXModuleDefDao xModuleDefDao = Mockito.mock(XXModuleDefDao.class);
    XXModuleDef xModuleDef = Mockito.mock(XXModuleDef.class);
    VXPortalUser userProfile = userProfile();
    XXPortalUser user = new XXPortalUser();
    user.setEmailAddress(userProfile.getEmailAddress());
    user.setFirstName(userProfile.getFirstName());
    user.setLastName(userProfile.getLastName());
    user.setLoginId(userProfile.getLoginId());
    String encryptedPwd = userMgr.encrypt(userProfile.getLoginId(), userProfile.getPassword());
    user.setPassword(encryptedPwd);
    user.setUserSource(userProfile.getUserSource());
    user.setPublicScreenName(userProfile.getPublicScreenName());
    user.setId(userProfile.getId());
    VXPasswordChange changeEmail = new VXPasswordChange();
    changeEmail.setEmailAddress("testuser@test.com");
    changeEmail.setId(user.getId());
    changeEmail.setLoginId(user.getLoginId());
    changeEmail.setOldPassword(userProfile.getPassword());
    XXPortalUserRole XXPortalUserRole = new XXPortalUserRole();
    XXPortalUserRole.setId(userId);
    XXPortalUserRole.setUserRole("ROLE_USER");
    List<XXPortalUserRole> list = new ArrayList<XXPortalUserRole>();
    list.add(XXPortalUserRole);
    List<XXUserPermission> xUserPermissionsList = new ArrayList<XXUserPermission>();
    XXUserPermission xUserPermissionObj = new XXUserPermission();
    xUserPermissionObj.setAddedByUserId(userId);
    xUserPermissionObj.setCreateTime(new Date());
    xUserPermissionObj.setId(userId);
    xUserPermissionObj.setIsAllowed(1);
    xUserPermissionObj.setModuleId(1L);
    xUserPermissionObj.setUpdatedByUserId(userId);
    xUserPermissionObj.setUpdateTime(new Date());
    xUserPermissionObj.setUserId(userId);
    xUserPermissionsList.add(xUserPermissionObj);
    List<XXGroupPermission> xGroupPermissionList = new ArrayList<XXGroupPermission>();
    XXGroupPermission xGroupPermissionObj = new XXGroupPermission();
    xGroupPermissionObj.setAddedByUserId(userId);
    xGroupPermissionObj.setCreateTime(new Date());
    xGroupPermissionObj.setId(userId);
    xGroupPermissionObj.setIsAllowed(1);
    xGroupPermissionObj.setModuleId(1L);
    xGroupPermissionObj.setUpdatedByUserId(userId);
    xGroupPermissionObj.setUpdateTime(new Date());
    xGroupPermissionObj.setGroupId(userId);
    xGroupPermissionList.add(xGroupPermissionObj);
    VXUserPermission userPermission = new VXUserPermission();
    userPermission.setId(1L);
    userPermission.setIsAllowed(1);
    userPermission.setModuleId(1L);
    userPermission.setUserId(userId);
    userPermission.setUserName("xyz");
    userPermission.setOwner("admin");
    VXGroupPermission groupPermission = new VXGroupPermission();
    groupPermission.setId(1L);
    groupPermission.setIsAllowed(1);
    groupPermission.setModuleId(1L);
    groupPermission.setGroupId(userId);
    groupPermission.setGroupName("xyz");
    groupPermission.setOwner("admin");
    Mockito.when(stringUtil.validateEmail(Mockito.anyString())).thenReturn(true);
    Mockito.when(stringUtil.equals(Mockito.anyString(), Mockito.anyString())).thenReturn(true);
    Mockito.when(stringUtil.normalizeEmail(Mockito.anyString())).thenReturn(changeEmail.getEmailAddress());
    Mockito.when(daoManager.getXXPortalUser()).thenReturn(userDao);
    Mockito.when(daoManager.getXXPortalUserRole()).thenReturn(roleDao);
    Mockito.when(userDao.update(user)).thenReturn(user);
    Mockito.when(roleDao.findByParentId(Mockito.anyLong())).thenReturn(list);
    Mockito.when(daoManager.getXXUserPermission()).thenReturn(xUserPermissionDao);
    Mockito.when(daoManager.getXXGroupPermission()).thenReturn(xGroupPermissionDao);
    Mockito.when(xUserPermissionDao.findByUserPermissionIdAndIsAllowed(userProfile.getId())).thenReturn(xUserPermissionsList);
    Mockito.when(xGroupPermissionDao.findbyVXPortalUserId(userProfile.getId())).thenReturn(xGroupPermissionList);
    Mockito.when(xGroupPermissionService.populateViewBean(xGroupPermissionObj)).thenReturn(groupPermission);
    Mockito.when(xUserPermissionService.populateViewBean(xUserPermissionObj)).thenReturn(userPermission);
    Mockito.when(daoManager.getXXModuleDef()).thenReturn(xModuleDefDao);
    Mockito.when(xModuleDefDao.findByModuleId(Mockito.anyLong())).thenReturn(xModuleDef);
    Mockito.doNothing().when(rangerBizUtil).blockAuditorRoleUser();
    VXPortalUser dbVXPortalUser = userMgr.changeEmailAddress(user, changeEmail);
    Assert.assertNotNull(dbVXPortalUser);
    Assert.assertEquals(userId, dbVXPortalUser.getId());
    Assert.assertEquals(userProfile.getLastName(), dbVXPortalUser.getLastName());
    Assert.assertEquals(changeEmail.getLoginId(), dbVXPortalUser.getLoginId());
    Assert.assertEquals(changeEmail.getEmailAddress(), dbVXPortalUser.getEmailAddress());
}
Also used : XXGroupPermission(org.apache.ranger.entity.XXGroupPermission) VXPasswordChange(org.apache.ranger.view.VXPasswordChange) XXUserPermissionDao(org.apache.ranger.db.XXUserPermissionDao) XXGroupPermissionDao(org.apache.ranger.db.XXGroupPermissionDao) ArrayList(java.util.ArrayList) XXModuleDefDao(org.apache.ranger.db.XXModuleDefDao) VXString(org.apache.ranger.view.VXString) XXUserPermission(org.apache.ranger.entity.XXUserPermission) Date(java.util.Date) VXUserPermission(org.apache.ranger.view.VXUserPermission) XXPortalUserRoleDao(org.apache.ranger.db.XXPortalUserRoleDao) XXPortalUser(org.apache.ranger.entity.XXPortalUser) XXModuleDef(org.apache.ranger.entity.XXModuleDef) VXGroupPermission(org.apache.ranger.view.VXGroupPermission) XXPortalUserDao(org.apache.ranger.db.XXPortalUserDao) VXPortalUser(org.apache.ranger.view.VXPortalUser) XXPortalUserRole(org.apache.ranger.entity.XXPortalUserRole) Test(org.junit.Test)

Example 14 with XXModuleDef

use of org.apache.ranger.entity.XXModuleDef in project ranger by apache.

the class TestXUserMgr method test33updateXModuleDefPermission.

@Test
public void test33updateXModuleDefPermission() {
    XXModuleDefDao xModuleDefDao = Mockito.mock(XXModuleDefDao.class);
    XXModuleDef xModuleDef = Mockito.mock(XXModuleDef.class);
    XXUserPermissionDao xUserPermissionDao = Mockito.mock(XXUserPermissionDao.class);
    XXGroupPermissionDao xGroupPermissionDao = Mockito.mock(XXGroupPermissionDao.class);
    VXUserPermission vXUserPermission = vXUserPermission();
    VXGroupPermission vXGroupPermission = vXGroupPermission();
    VXModuleDef vXModuleDef = vXModuleDef();
    Mockito.when(xModuleDefService.updateResource(vXModuleDef)).thenReturn(vXModuleDef);
    Mockito.when(daoManager.getXXModuleDef()).thenReturn(xModuleDefDao);
    Mockito.when(xModuleDefDao.getById(userId)).thenReturn(xModuleDef);
    Mockito.when(xModuleDefService.populateViewBean(xModuleDef)).thenReturn(vXModuleDef);
    Mockito.when(daoManager.getXXUserPermission()).thenReturn(xUserPermissionDao);
    Mockito.when(daoManager.getXXGroupPermission()).thenReturn(xGroupPermissionDao);
    XXGroupUserDao xGrpUserDao = Mockito.mock(XXGroupUserDao.class);
    Mockito.when(daoManager.getXXGroupUser()).thenReturn(xGrpUserDao);
    UserSessionBase userSession = Mockito.mock(UserSessionBase.class);
    Set<UserSessionBase> userSessions = new HashSet<UserSessionBase>();
    userSessions.add(userSession);
    Mockito.when(xGroupPermissionService.createResource((VXGroupPermission) Mockito.any())).thenReturn(vXGroupPermission);
    Mockito.when(xUserPermissionService.createResource((VXUserPermission) Mockito.any())).thenReturn(vXUserPermission);
    Mockito.when(sessionMgr.getActiveUserSessionsForPortalUserId(userId)).thenReturn(userSessions);
    VXModuleDef dbMuduleDef = xUserMgr.updateXModuleDefPermission(vXModuleDef);
    Assert.assertEquals(dbMuduleDef, vXModuleDef);
    Assert.assertNotNull(dbMuduleDef);
    Assert.assertEquals(dbMuduleDef, vXModuleDef);
    Assert.assertEquals(dbMuduleDef.getId(), vXModuleDef.getId());
    Assert.assertEquals(dbMuduleDef.getOwner(), vXModuleDef.getOwner());
    Assert.assertEquals(dbMuduleDef.getUpdatedBy(), vXModuleDef.getUpdatedBy());
    Assert.assertEquals(dbMuduleDef.getUrl(), vXModuleDef.getUrl());
    Assert.assertEquals(dbMuduleDef.getAddedById(), vXModuleDef.getAddedById());
    Assert.assertEquals(dbMuduleDef.getCreateDate(), vXModuleDef.getCreateDate());
    Assert.assertEquals(dbMuduleDef.getCreateTime(), vXModuleDef.getCreateTime());
    Assert.assertEquals(dbMuduleDef.getUserPermList(), vXModuleDef.getUserPermList());
    Assert.assertEquals(dbMuduleDef.getGroupPermList(), vXModuleDef.getGroupPermList());
    Mockito.verify(xModuleDefService).updateResource(vXModuleDef);
    Mockito.verify(daoManager).getXXModuleDef();
    Mockito.verify(xModuleDefService).populateViewBean(xModuleDef);
    Mockito.verify(daoManager).getXXUserPermission();
    Mockito.verify(daoManager).getXXGroupPermission();
}
Also used : XXGroupUserDao(org.apache.ranger.db.XXGroupUserDao) XXModuleDef(org.apache.ranger.entity.XXModuleDef) VXGroupPermission(org.apache.ranger.view.VXGroupPermission) VXModuleDef(org.apache.ranger.view.VXModuleDef) XXUserPermissionDao(org.apache.ranger.db.XXUserPermissionDao) XXGroupPermissionDao(org.apache.ranger.db.XXGroupPermissionDao) XXModuleDefDao(org.apache.ranger.db.XXModuleDefDao) VXUserPermission(org.apache.ranger.view.VXUserPermission) UserSessionBase(org.apache.ranger.common.UserSessionBase) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 15 with XXModuleDef

use of org.apache.ranger.entity.XXModuleDef in project ranger by apache.

the class XUserPermissionService method populateViewBean.

@Override
public VXUserPermission populateViewBean(XXUserPermission xObj) {
    VXUserPermission vObj = super.populateViewBean(xObj);
    XXPortalUser xPortalUser = daoManager.getXXPortalUser().getById(xObj.getUserId());
    if (xPortalUser != null) {
        vObj.setUserName(xPortalUser.getLoginId());
    }
    XXModuleDef xModuleDef = daoManager.getXXModuleDef().getById(xObj.getModuleId());
    if (xModuleDef != null) {
        vObj.setModuleName(xModuleDef.getModule());
    }
    return vObj;
}
Also used : XXPortalUser(org.apache.ranger.entity.XXPortalUser) XXModuleDef(org.apache.ranger.entity.XXModuleDef) VXUserPermission(org.apache.ranger.view.VXUserPermission)

Aggregations

XXModuleDef (org.apache.ranger.entity.XXModuleDef)15 XXPortalUser (org.apache.ranger.entity.XXPortalUser)12 XXGroupPermission (org.apache.ranger.entity.XXGroupPermission)11 XXUserPermission (org.apache.ranger.entity.XXUserPermission)11 VXUserPermission (org.apache.ranger.view.VXUserPermission)11 ArrayList (java.util.ArrayList)10 XXPortalUserRoleDao (org.apache.ranger.db.XXPortalUserRoleDao)10 XXPortalUserRole (org.apache.ranger.entity.XXPortalUserRole)10 VXGroupPermission (org.apache.ranger.view.VXGroupPermission)10 VXPortalUser (org.apache.ranger.view.VXPortalUser)10 Test (org.junit.Test)10 Date (java.util.Date)9 VXString (org.apache.ranger.view.VXString)8 XXGroupPermissionDao (org.apache.ranger.db.XXGroupPermissionDao)7 XXUserPermissionDao (org.apache.ranger.db.XXUserPermissionDao)7 XXModuleDefDao (org.apache.ranger.db.XXModuleDefDao)6 XXPortalUserDao (org.apache.ranger.db.XXPortalUserDao)6 VXStringList (org.apache.ranger.view.VXStringList)4 XXGroupUserDao (org.apache.ranger.db.XXGroupUserDao)3 XXUser (org.apache.ranger.entity.XXUser)3