Buzz API

How to determine if an enrollment belongs to a teacher?

Follow
Answered
Matthew Marichiba

I'm using `listenrollments` to pull back enrollments for several courses, and I want to process the students in the courses. However, listenrollments brings back both student and teacher enrollments. At a glance how can I determine if an enrollment belongs to a teacher? I see `role` and `privileges` properties on enrollment records, but I don't see an obvious signal that means Teacher.

Thanks!

Comments (5)

Sort by
Matthew Marichiba

I think I may have answered the inverse of my question, to identify students:

Students appear to be the records with privileges == 131073, which is 0x20000 (read course) + 0x01 (participate).

Can it be said that anything with privileges != 131073 is a teacher, or at least a user with elevated course privileges?

 

0 Comment actions Permalink
Brad Marshall
  • Agilix team member

Good question, Matthew. By using that command, you would have to evaluate the 'role' or 'privileges' values to understand if it is a student or a teacher. If you can loop through multiple courses, you could use the ListEntityEnrollments command and pass the 'privileges' attribute with a value of "1", which is the student-only 'participate' bit.

If you really need to use ListEnrollments, then you can 'select=enrollmentmetrics.' Only student enrollments would have this value, but will have a performance toll on the command. But...there is no guarantee that we won't eventually have 'enrollmentmetrics' for teacher enrollments in the future.

Does this help?

0 Comment actions Permalink
Brad Marshall
  • Agilix team member

Hey Matthew, in your implementation, yes, you can say that value 131073 is a student. If these users were created in Buzz, then this is a good way to identify them.

0 Comment actions Permalink
Matthew Marichiba

Thanks, Brad. This is helpful. It looks like getting a course list and then iterating over those courses with  ListEntityEnrollments might be the best approach for us. In this case, what would be the indicator of a teacher be?

ListEntityEnrollments with privileges=
16777216 (0x1000000, GradeAssignment) seems like a good indicator that a user is a teacher.

0 Comment actions Permalink
Brad Marshall
  • Agilix team member

That is a good one. Depends you guys use teachers in a course versus other non-student enrollments. So, it could be ViewGradebook or an actually grading bit. Whatever is unique between a teacher and any other non-student enrollment, should be used.

0 Comment actions Permalink
Please sign in to leave a comment.