Add a user to a group

    Args:

        name (str):
            The name of the group to modify

        username (str):
            The name of the user to add to the group

    Returns:
        bool: ``True`` if successful, otherwise ``False``

    CLI Example:

    .. code-block:: bash

        salt '*' group.adduser foo username

def adduser(name, username, **kwargs):
    '''
    Add a user to a group

    Args:

        name (str):
            The name of the group to modify

        username (str):
            The name of the user to add to the group

    Returns:
        bool: ``True`` if successful, otherwise ``False``

    CLI Example:

    .. code-block:: bash

        salt '*' group.adduser foo username
    '''
    try:
        group_obj = _get_group_object(name)
    except pywintypes.com_error as exc:
        msg = 'Failed to access group {0}. {1}'.format(
            name, win32api.FormatMessage(exc.excepinfo[5]))
        log.error(msg)
        return False

    existing_members = [_get_username(x) for x in group_obj.members()]
    username = salt.utils.win_functions.get_sam_name(username)

    try:
        if username not in existing_members:
            group_obj.Add('WinNT://' + username.replace('\\', '/'))
            log.info('Added user %s', username)
        else:
            log.warning('User %s is already a member of %s', username, name)
            return False
    except pywintypes.com_error as exc:
        msg = 'Failed to add {0} to group {1}. {2}'.format(
            username, name, win32api.FormatMessage(exc.excepinfo[5]))
        log.error(msg)
        return False

    return True