def apply_ticket_permissions(env, req, tickets):
    """Apply permissions to a set of milestone tickets as returned by
    `get_tickets_for_milestone()`."""
    return [t for t in tickets
            if 'TICKET_VIEW' in req.perm('ticket', t['id'])]
dataset/ETHPy150Open edgewall/trac/trac/ticket/roadmap.py/apply_ticket_permissions/original