@Transactional
  public synchronized void addMemberToGroup(GroupEntity groupEntity, UserEntity userEntity)
      throws AmbariException {

    if (groupEntity == null) {
      throw new NullPointerException();
    }

    if (userEntity == null) {
      throw new NullPointerException();
    }

    if (!isUserInGroup(userEntity, groupEntity)) {
      final MemberEntity memberEntity = new MemberEntity();
      memberEntity.setGroup(groupEntity);
      memberEntity.setUser(userEntity);
      userEntity.getMemberEntities().add(memberEntity);
      groupEntity.getMemberEntities().add(memberEntity);
      memberDAO.create(memberEntity);
      userDAO.merge(userEntity);
      groupDAO.merge(groupEntity);
    }
  }
Revokes Ambari Administrator privileges from provided user.

@param userEntity the user
ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java