For the first time such function would have been needed in the grader report (
MDL-26835). It was not implemented in accesslib.php but in grader report. MDL-27322 requests similar functionality to MDL-26835. At this moment I am rewriting attendance module for Moodle 2.0 and I need function that can return enrolled users (user fields + enrolment status) with specified capability ('mod/attforblock:canbelisted') and optionally group.