@Test public void testSetGroupLdap() throws Exception { users.createGroup("group", GroupType.LOCAL); users.setGroupLdap("group"); Assert.assertNotNull(users.getGroup("group")); Assert.assertTrue(users.getGroup("group").isLdapGroup()); try { users.setGroupLdap("fake group"); Assert.fail("It shouldn't be possible to call setGroupLdap() on non-existing group"); } catch (AmbariException ex) { } }
public synchronized void setGroupLdap(String groupName) throws AmbariException { GroupEntity groupEntity = groupDAO.findGroupByName(groupName); if (groupEntity != null) { groupEntity.setGroupType(GroupType.LDAP); groupDAO.merge(groupEntity); } else { throw new AmbariException("Group " + groupName + " doesn't exist"); } }
Users { public synchronized void setGroupLdap(String groupName) throws AmbariException { GroupEntity groupEntity = groupDAO.findGroupByName(groupName); if (groupEntity != null) { groupEntity.setGroupType(GroupType.LDAP); groupDAO.merge(groupEntity); } else { throw new AmbariException("Group " + groupName + " doesn't exist"); } } }
Users { public synchronized void setGroupLdap(String groupName) throws AmbariException { GroupEntity groupEntity = groupDAO.findGroupByName(groupName); if (groupEntity != null) { groupEntity.setGroupType(GroupType.LDAP); groupDAO.merge(groupEntity); } else { throw new AmbariException("Group " + groupName + " doesn't exist"); } }  }
Users { public synchronized void setGroupLdap(String groupName) throws AmbariException { GroupEntity groupEntity = groupDAO.findGroupByName(groupName); if (groupEntity != null) { groupEntity.setGroupType(GroupType.LDAP); groupDAO.merge(groupEntity); } else { throw new AmbariException("Group " + groupName + " doesn't exist"); } }  List<User> getAllUsers(); @Deprecated User getAnyUser(String userName); User getUser(String userName, UserType userType); User getUser(Integer userId); @Deprecated User getUserIfUnique(String userName); synchronized void modifyPassword(String userName, String currentUserPassword, String newPassword); synchronized void setUserActive(String userName, boolean active); synchronized void setUserLdap(String userName); synchronized void setGroupLdap(String groupName); void createUser(String userName, String password); synchronized void createUser(String userName, String password, UserType userType, Boolean active, Boolean
      admin); synchronized void removeUser(User user); Group getGroup(String groupName); Group getGroupByNameAndType(String groupName, GroupType groupType); Collection<User> getGroupMembers(String groupName); @Transactional synchronized void createGroup(String groupName, GroupType groupType); List<Group> getAllGroups(); List<String> getAllMembers(String groupName); @Transactional synchronized void removeGroup(Group group); synchronized void grantAdminPrivilege(Integer userId); synchronized void grantPrivilegeToGroup(Integer groupId, Long resourceId, ResourceType resourceType, String permissionName); synchronized void revokeAdminPrivilege(Integer userId); @Transactional synchronized void addMemberToGroup(String groupName, String userName); @Transactional synchronized void removeMemberFromGroup(String groupName, String userName); synchronized boolean isUserCanBeRemoved(UserEntity userEntity); void processLdapSync(LdapBatchDto batchInfo); Collection<PrivilegeEntity> getUserPrivileges(UserEntity userEntity); Collection<PrivilegeEntity> getGroupPrivileges(GroupEntity groupEntity); Collection<AmbariGrantedAuthority> getUserAuthorities(String userName, UserType userType); }
Users { public synchronized void setGroupLdap(String groupName) throws AmbariException { GroupEntity groupEntity = groupDAO.findGroupByName(groupName); if (groupEntity != null) { groupEntity.setGroupType(GroupType.LDAP); groupDAO.merge(groupEntity); } else { throw new AmbariException("Group " + groupName + " doesn't exist"); } }  List<User> getAllUsers(); @Deprecated User getAnyUser(String userName); User getUser(String userName, UserType userType); User getUser(Integer userId); @Deprecated User getUserIfUnique(String userName); synchronized void modifyPassword(String userName, String currentUserPassword, String newPassword); synchronized void setUserActive(String userName, boolean active); synchronized void setUserLdap(String userName); synchronized void setGroupLdap(String groupName); void createUser(String userName, String password); synchronized void createUser(String userName, String password, UserType userType, Boolean active, Boolean
      admin); synchronized void removeUser(User user); Group getGroup(String groupName); Group getGroupByNameAndType(String groupName, GroupType groupType); Collection<User> getGroupMembers(String groupName); @Transactional synchronized void createGroup(String groupName, GroupType groupType); List<Group> getAllGroups(); List<String> getAllMembers(String groupName); @Transactional synchronized void removeGroup(Group group); synchronized void grantAdminPrivilege(Integer userId); synchronized void grantPrivilegeToGroup(Integer groupId, Long resourceId, ResourceType resourceType, String permissionName); synchronized void revokeAdminPrivilege(Integer userId); @Transactional synchronized void addMemberToGroup(String groupName, String userName); @Transactional synchronized void removeMemberFromGroup(String groupName, String userName); synchronized boolean isUserCanBeRemoved(UserEntity userEntity); void processLdapSync(LdapBatchDto batchInfo); Collection<PrivilegeEntity> getUserPrivileges(UserEntity userEntity); Collection<PrivilegeEntity> getGroupPrivileges(GroupEntity groupEntity); Collection<AmbariGrantedAuthority> getUserAuthorities(String userName, UserType userType);  }