From ce05325d05775858a11a8dca224ec39a4bdd4db2 Mon Sep 17 00:00:00 2001 From: Zachary Hancock Date: Mon, 19 Feb 2024 07:58:14 -0500 Subject: [PATCH] refactor: removed unused permission events (#314) --- CHANGELOG.rst | 6 ++ openedx_events/__init__.py | 2 +- ...e+students+permission+added+v1_schema.avsc | 75 ------------------- ...students+permission+removed+v1_schema.avsc | 75 ------------------- openedx_events/learning/data.py | 43 ----------- openedx_events/learning/signals.py | 23 ------ 6 files changed, 7 insertions(+), 217 deletions(-) delete mode 100644 openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+user+manage+students+permission+added+v1_schema.avsc delete mode 100644 openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+user+manage+students+permission+removed+v1_schema.avsc diff --git a/CHANGELOG.rst b/CHANGELOG.rst index bb762d15..82dae104 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -14,6 +14,12 @@ Change Log Unreleased ---------- +[9.5.2] - 2024-02-13 +-------------------- +Removed +~~~~~~~ +* Remove unused ``MANAGE_STUDENTS_PERMISSION_ADDED`` and ``MANAGE_STUDENTS_PERMISSION_REMOVED`` events in learning + [9.5.1] - 2024-02-12 -------------------- Changed diff --git a/openedx_events/__init__.py b/openedx_events/__init__.py index c1a3f1e7..51393c30 100644 --- a/openedx_events/__init__.py +++ b/openedx_events/__init__.py @@ -5,4 +5,4 @@ more information about the project. """ -__version__ = "9.5.1" +__version__ = "9.5.2" diff --git a/openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+user+manage+students+permission+added+v1_schema.avsc b/openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+user+manage+students+permission+added+v1_schema.avsc deleted file mode 100644 index 33ff3d5d..00000000 --- a/openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+user+manage+students+permission+added+v1_schema.avsc +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "CloudEvent", - "type": "record", - "doc": "Avro Event Format for CloudEvents created with openedx_events/schema", - "fields": [ - { - "name": "course_staff_data", - "type": { - "name": "ManageStudentsPermissionData", - "type": "record", - "fields": [ - { - "name": "user", - "type": { - "name": "UserData", - "type": "record", - "fields": [ - { - "name": "id", - "type": "long" - }, - { - "name": "is_active", - "type": "boolean" - }, - { - "name": "pii", - "type": { - "name": "UserPersonalData", - "type": "record", - "fields": [ - { - "name": "username", - "type": "string" - }, - { - "name": "email", - "type": "string" - }, - { - "name": "name", - "type": "string" - } - ] - } - } - ] - } - }, - { - "name": "permission", - "type": "string" - }, - { - "name": "course_key", - "type": [ - "null", - "string" - ], - "default": null - }, - { - "name": "org", - "type": [ - "null", - "string" - ], - "default": null - } - ] - } - } - ], - "namespace": "org.openedx.learning.user.manage.students.permission.added.v1" -} \ No newline at end of file diff --git a/openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+user+manage+students+permission+removed+v1_schema.avsc b/openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+user+manage+students+permission+removed+v1_schema.avsc deleted file mode 100644 index 99224a26..00000000 --- a/openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+user+manage+students+permission+removed+v1_schema.avsc +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "CloudEvent", - "type": "record", - "doc": "Avro Event Format for CloudEvents created with openedx_events/schema", - "fields": [ - { - "name": "course_staff_data", - "type": { - "name": "ManageStudentsPermissionData", - "type": "record", - "fields": [ - { - "name": "user", - "type": { - "name": "UserData", - "type": "record", - "fields": [ - { - "name": "id", - "type": "long" - }, - { - "name": "is_active", - "type": "boolean" - }, - { - "name": "pii", - "type": { - "name": "UserPersonalData", - "type": "record", - "fields": [ - { - "name": "username", - "type": "string" - }, - { - "name": "email", - "type": "string" - }, - { - "name": "name", - "type": "string" - } - ] - } - } - ] - } - }, - { - "name": "permission", - "type": "string" - }, - { - "name": "course_key", - "type": [ - "null", - "string" - ], - "default": null - }, - { - "name": "org", - "type": [ - "null", - "string" - ], - "default": null - } - ] - } - } - ], - "namespace": "org.openedx.learning.user.manage.students.permission.removed.v1" -} \ No newline at end of file diff --git a/openedx_events/learning/data.py b/openedx_events/learning/data.py index e8c6bc2f..c9659ff3 100644 --- a/openedx_events/learning/data.py +++ b/openedx_events/learning/data.py @@ -349,49 +349,6 @@ class CourseAccessRoleData: role = attr.ib(type=str) -@attr.s(frozen=True) -class ManageStudentsPermissionData: - """ - Attributes defined for the Open edX to represent users that can manage students within a course/org. - - IMPORTANT: - edX currently uses roles, and only roles, to decide what kind of access a user has. - - There is an ongoing project to replace this roles-only system with a system that uses roles that are - made up of permissions, which is being worked on in parallel with another project to emit events - whenever users are assigned any type of "Course Staff" role. - - It's unclear what the state of this roles/permissions project will be the time the events project - is completed, so each project's respective teams will stay in touch with each other. - - For now, we're making a best effort to publish this an event that will regard the permission(s) - we'd expect to "filter" for in the future (For more info, please check out this document: - https://docs.google.com/spreadsheets/d/1htsV0eWq5-y96DZ5A245ukfZ4_qeH0KjHVaOyfqD8OA/edit#gid=908503896) - and not for the roles we have now. Likely this/these permission(s) will be something like `manage_students`, - but we need to evaluate how this will align with some possible future roles such as `limited_staff` or `ccx`. - - As such, the current plan is to do one of the following once the roles/permissions project's - feature branch is merged to master: - 1. Modify this event to "filter" by the correct permissions once the - 2. As a backup plan, make a new event if this proves too difficult. - - Until either of these plans are executed, this comment under the IMPORTANT header should stay put. - - Arguments: - user (UserData): User who will have a role/permission assigned/removed. - permission (str): The permission the user is being assigned. - course_key (Course ID): identifier of the course where the user will have staff role assigned/removed. - A blank course_id implies org wide role. - org (str): identifier of the org where the user will have staff role assigned/removed. - A blank org is for global group based roles such as course creator (may be deprecated). - """ - - user = attr.ib(type=UserData) - permission = attr.ib(type=str) - course_key = attr.ib(type=str, default=None) - org = attr.ib(type=str, default=None) - - @attr.s(frozen=True) class DiscussionThreadData: """ diff --git a/openedx_events/learning/signals.py b/openedx_events/learning/signals.py index ed36fab4..1a9c6f07 100644 --- a/openedx_events/learning/signals.py +++ b/openedx_events/learning/signals.py @@ -17,7 +17,6 @@ CourseNotificationData, DiscussionThreadData, ExamAttemptData, - ManageStudentsPermissionData, PersistentCourseGradeData, ProgramCertificateData, UserData, @@ -279,28 +278,6 @@ } ) -# .. event_type: org.openedx.learning.user.manage.students.permission.added.v1 -# .. event_name: MANAGE_STUDENTS_PERMISSION_ADDED -# .. event_description: Emitted when permission to manage students within a course is given to a user. -# .. event_data: ManageStudentsPermissionData -MANAGE_STUDENTS_PERMISSION_ADDED = OpenEdxPublicSignal( - event_type="org.openedx.learning.user.manage.students.permission.added.v1", - data={ - "course_staff_data": ManageStudentsPermissionData, - } -) - -# .. event_type: org.openedx.learning.user.manage.students.permission.removed.v1 -# .. event_name: MANAGE_STUDENTS_PERMISSION_REMOVED -# .. event_description: Emitted when permission to manage students within a course is removed from a user. -# .. event_data: ManageStudentsPermissionData -MANAGE_STUDENTS_PERMISSION_REMOVED = OpenEdxPublicSignal( - event_type="org.openedx.learning.user.manage.students.permission.removed.v1", - data={ - "course_staff_data": ManageStudentsPermissionData, - } -) - # .. event_type: org.openedx.learning.forum.thread.created.v1 # .. event_name: FORUM_THREAD_CREATED # .. event_description: Emitted when a new thread is created in a discussion