def get_user_login_info(login, users, user_login_rel):
    """
    Return a dict of data for each user; it's important
    that the users remain in the same order.
    """
    login_is_active = login.is_active and login.machine.is_active
    info = []
    for user in users:
        is_allowed = (user.pk, login.pk) in user_login_rel
        is_active = user.is_active and login_is_active
        verb = 'is' if is_active else 'would be'
        adjective = 'permitted to access' if is_allowed else 'forbidden from'
        explanations = []
        if not user.is_active:
            explanations.append('user were active')
        if not login.is_active:
            explanations.append('login were active')
        if not login.machine.is_active:
            explanations.append('machine were active')
        if_ = ' if ' if is_allowed else ' even if '
        explanation = if_ + ' and '.join(explanations) if explanations else ''
        tooltip = '%s %s %s %s@%s%s' % (user, verb, adjective, login.
            username, login.machine.hostname or login.machine.ip, explanation)
        info.append({'is_active': is_active, 'is_allowed': is_allowed,
            'action': 'deny' if is_allowed else 'permit', 'tooltip':
            tooltip, 'user': user})
    return info
