Skip to content

Commit

Permalink
feat: add/remove course staff role events
Browse files Browse the repository at this point in the history
  • Loading branch information
ilee2u committed Sep 19, 2023
1 parent a5e58fe commit 9c62c2d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
13 changes: 13 additions & 0 deletions openedx_events/learning/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,16 @@ class ProgramCertificateData:
status = attr.ib(type=str)
url = attr.ib(type=str)
certificate_available_date = attr.ib(type=datetime, default=None)


attr.s(frozen=True)
class CourseStaffData:
"""
Attributes defined for the Open edX Authentication function to Add Users to a role.
Arguments:
course_key (Course ID): identifier of the course where the user will have staff role assigned/removed
user (UserData): User who will have the "Course Staff" role assigned/removed
"""
course_key = attr.ib(type=str)
user = attr.ib(UserData)
23 changes: 23 additions & 0 deletions openedx_events/learning/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
CohortData,
CourseDiscussionConfigurationData,
CourseEnrollmentData,
CourseStaffData,
PersistentCourseGradeData,
ProgramCertificateData,
UserData,
Expand Down Expand Up @@ -196,3 +197,25 @@
"notification_data": UserNotificationData,
}
)

# .. event_type: org.openedx.learning.user.add.course.staff.role.v1
# .. event_name: ADD_COURSE_STAFF_ROLE
# .. event_description: Assigns the "Course Staff" role to a user.
# .. event_data: CourseStaffData
ADD_COURSE_STAFF_ROLE = OpenEdxPublicSignal(
event_type="org.openedx.learning.user.add.course.staff.role.v1",
data={
"course_staff_data": CourseStaffData,
}
)

# .. event_type: org.openedx.learning.user.remove.course.staff.role.v1
# .. event_name: REMOVE_COURSE_STAFF_ROLE
# .. event_description: Removes the "Course Staff" role from a user.
# .. event_data: CourseStaffData
REMOVE_COURSE_STAFF_ROLE = OpenEdxPublicSignal(
event_type="org.openedx.learning.user.remove.course.staff.role.v1",
data={
"course_staff_data": CourseStaffData,
}
)

0 comments on commit 9c62c2d

Please sign in to comment.