diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 05114f318..7e02c2bba 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -121,10 +121,32 @@ Added number of distinct active users with the role in the scopes of the requested types that the caller can view. ``updated_at`` is ``null`` for static roles. * Added ``get_visible_role_user_counts`` to the public API to count those users. +* Added the ``courses.manage_bulk_learner_grading`` permission for using grading tools on all + learners, granted to Course Admin only. +* Added the ``courses.view_learner_course_status`` permission for viewing a learner's course + status in the Instructor Dashboard, granted to Course Admin and Course Staff. Changed ======== +* **Breaking**: The Instructor Dashboard permissions now declare dependencies (ADR 0034). + ``courses.manage_learner_grading`` and ``courses.manage_learner_extensions`` depend on + ``courses.view_learner_course_status``, ``courses.manage_bulk_learner_grading`` depends on + ``courses.manage_learner_grading``, and ``courses.view_gradebook`` depends on + ``courses.view_course_info``. A role in a schema file outside this package that grants one of these + permissions without its direct and indirect dependencies now fails validation in + ``load_authz_schema``, even if the file declares ``schema_version: "1.0"``. To migrate, add the + missing dependencies to the ``permissions`` of each affected role, or to its ``add_permissions`` + extension. A file that redefines one of these permissions must also declare the same + ``depends_on`` in a ``1.1`` file. +* **Breaking**: ``courses.manage_learner_grading`` now covers grading tools for individual learners + only. Use ``courses.manage_bulk_learner_grading`` for all learners. Course Staff, and custom roles + that grant ``courses.manage_learner_grading``, do not get the new permission. +* ``courses.view_course_info`` now also covers background task status. +* Updated course permission and category descriptions to match the Roles and Permissions Matrix. The + grading permissions are displayed as ``Manage learner grading`` and ``Manage bulk learner + grading``. Apart from the changes listed in this release, role grants and permission checks are + unchanged. * Updated the course permission categories and permissions to match the Roles and Permissions console proposal. ``View course info`` and ``View checklists`` move to ``Course access & content``, ``Export tags`` moves to ``Tags``, and the group configuration permissions move to ``Cohorts & content groups``. The ``course_information`` and ``course_other`` categories are removed. ``Course team & groups``, ``Grading``, ``Advanced & certificates``, and ``Import / export`` are renamed, the category IDs ``course_cohorts``, ``course_team_group``, ``course_grading``, and ``course_advanced_certificates`` become ``course_cohorts_content_groups``, ``course_team``, ``course_grading_settings``, and ``course_advanced_settings_certificates``, and several category and permission descriptions now name Studio and the Instructor Dashboard. ``courses.manage_taxonomies`` is now hidden. Role grants are unchanged. * Static roles may declare an empty permission list when ``role_extensions`` contribute their permissions. Permission lists used by extension edits remain non-empty. * Built-in Content Library and course authorization definitions now live in capability applets. The compiled authorization schema, the permission constants, and the role keys remain unchanged. diff --git a/docs/concepts/core_roles_and_permissions/course_roles.rst b/docs/concepts/core_roles_and_permissions/course_roles.rst index 4e059cea0..ad5db0432 100644 --- a/docs/concepts/core_roles_and_permissions/course_roles.rst +++ b/docs/concepts/core_roles_and_permissions/course_roles.rst @@ -33,98 +33,138 @@ Permissions The following permissions are associated with the course roles: -Course Access & Content -========================= -- **View course** (``courses.view_course``): Allows users to view the course and access the course outline in read-only mode. -- **Edit course content** (``courses.edit_course_content``): Allows users to edit course content, outline, units, and components. -- **Publish course content** (``courses.publish_course_content``): Allows users to publish course content. +Course access & content +======================= -Library Updates -======================== -- **View library updates** (``courses.view_library_updates``): Allows users to view library updates in read-only mode. -- **Manage library updates** (``courses.manage_library_updates``): Allows users to accept or reject library updates in Studio. +Permissions for accessing the course, viewing course and learner information, and managing course content. -Course Updates & Handouts -=========================== -- **View course updates** (``courses.view_course_updates``): Allows users to view course updates and handouts. -- **Manage course updates** (``courses.manage_course_updates``): Allows users to manage course updates and handouts, including creating, editing, and deleting. +- **View course** (``courses.view_course``): Find the course on the Studio home page and open its outline in read-only mode. Use “View Live” to preview the course as a learner in the LMS. +- **Edit course content** (``courses.edit_course_content``): Edit the course outline, units, and components. +- **Publish course content** (``courses.publish_course_content``): Make course content visible to learners. +- **View course info** (``courses.view_course_info``): View general course information, enrollment counts, and the status of background tasks in the Instructor Dashboard. +- **View checklists** (``courses.view_checklists``): See the course launch checklist in Studio. +- **View learner course status** (``courses.view_learner_course_status``): Access learner profile information, enrollment status, and course progress. -Pages & Resources -==================== -- **View pages & resources** (``courses.view_pages_and_resources``): Allows users to view pages and resources. -- **Manage pages & resources** (``courses.manage_pages_and_resources``): Allows users to edit pages and resources, including toggles and content managed from that section. +Course team +=========== -Files -======= -- **View files** (``courses.view_files``): Allows users to view the Files page. -- **Create files** (``courses.create_files``): Allows users to upload files. -- **Edit files** (``courses.edit_files``): Allows users to perform non-destructive file actions, such as lock or unlock. -- **Delete files** (``courses.delete_files``): Allows users to delete files. - -Schedule & Details -=================== -- **View schedule and details** (``courses.view_schedule_and_details``): Allows users to view the course schedule and details. -- **Edit schedule** (``courses.edit_schedule``): Allows users to edit the course schedule. -- **Edit course details** (``courses.edit_details``): Allows users to edit course details, including summary, pacing, and prerequisites. - -Grading -========= -- **View grading settings** (``courses.view_grading_settings``): Allows users to view grading settings. -- **Edit grading settings** (``courses.edit_grading_settings``): Allows users to edit grading settings. - -Course Team & Groups -==================== -- **View course team** (``courses.view_course_team``): Allows users to view the course team roster. -- **Manage course team** (``courses.manage_course_team``): Allows users to edit course team membership and roles. -- **View group configurations** (``courses.view_group_configurations``): Allows users to view content groups. -- **Manage group configuration** (``courses.manage_group_configurations``): Allows users to manage content groups. - -Tags & Taxonomies +Permissions for viewing course team members and managing course role assignments. + +- **View course team** (``courses.view_course_team``): View course team members and their assigned roles in the Roles and Permissions console or on the Course Team tab in the Instructor Dashboard. +- **Manage course team** (``courses.manage_course_team``): Add, change, or remove role assignments for this course from the Roles and Permissions console or the Instructor Dashboard. + +Schedule & details +================== + +Permissions for viewing and editing the course schedule and details in Studio. + +- **View schedule & details** (``courses.view_schedule_and_details``): View course start and end dates, enrollment dates, pacing, the course summary, and prerequisites. +- **Edit schedule** (``courses.edit_schedule``): Update course start and end dates, enrollment dates, and pacing settings. +- **Edit course details** (``courses.edit_details``): Update course information including the course summary, pacing, and prerequisites. + +Advanced settings & certificates +================================ + +Permissions for viewing and managing advanced course settings and course certificates in Studio. + +- **View advanced settings** (``courses.view_advanced_settings``): View advanced settings in Studio, including proctoring, timed exams, LTI tools, enrollment limits, and custom display options. +- **Manage advanced settings** (``courses.manage_advanced_settings``): Edit technical course configurations in the Advanced Settings page in Studio. +- **View certificates** (``courses.view_certificates``): See the course certificate settings. +- **Manage certificates** (``courses.manage_certificates``): Create and edit course certificates, including certificate design and eligibility settings. + +Pages & resources ================= -- **Manage tags** (``courses.manage_tags``): Allows users to create, edit, and delete tags. -- **Manage taxonomies** (``courses.manage_taxonomies``): Allows users to create, edit, and delete taxonomies. -Advanced & Certificates -======================= -- **View advanced settings** (``courses.view_advanced_settings``): Allows users to view advanced settings. -- **Manage advanced settings** (``courses.manage_advanced_settings``): Allows users to edit advanced settings. -- **View certificates** (``courses.view_certificates``): Allows users to view certificates. -- **Manage certificates** (``courses.manage_certificates``): Allows users to edit certificates. +Permissions for viewing and managing course pages and additional learning resources. -Import / Export -================ -- **Import course** (``courses.import_course``): Allows users to import course content. -- **Export course** (``courses.export_course``): Allows users to export course content. -- **Export tags** (``courses.export_tags``): Allows users to export tags. +- **View pages & resources** (``courses.view_pages_and_resources``): View course pages, learning resources, and feature settings in Studio. +- **Manage pages & resources** (``courses.manage_pages_and_resources``): Turn course features such as Discussions, Wiki, Notes, Calculator, and Live on or off. Create, edit, and configure textbooks and custom pages. -Course Information -================== -- **View course info** (``courses.view_course_info``): Allows users to view general course information and enrollment counts. +Course updates & handouts +========================= + +Permissions for viewing and managing course announcements and handouts. + +- **View course updates** (``courses.view_course_updates``): See course announcements and handouts visible to learners. +- **Manage course updates** (``courses.manage_course_updates``): Create, edit, and delete course announcements and handouts. + +Files +===== + +Permissions for viewing and managing files and assets uploaded to the course. + +- **View files** (``courses.view_files``): View the list of uploaded course files and assets. +- **Create files** (``courses.create_files``): Upload new files and assets to the course. +- **Edit files** (``courses.edit_files``): Perform non-destructive actions on files, such as locking or unlocking them. +- **Delete files** (``courses.delete_files``): Permanently remove files and assets from the course. + +Library updates +=============== + +Permissions for reviewing and applying content updates from linked libraries. + +- **View library updates** (``courses.view_library_updates``): Review pending updates from linked content libraries. +- **Manage library updates** (``courses.manage_library_updates``): Accept or reject pending updates from linked content libraries. + +Tags +==== + +Permissions for managing course tags and exporting tag data. + +- **Manage tags** (``courses.manage_tags``): Create, edit, and delete tags on this course. +- **Export tags** (``courses.export_tags``): Download the tag data associated with this course. + +Course import & export +====================== + +Permissions for importing and exporting course content. + +- **Import course** (``courses.import_course``): Import course content from a file. This is a high-privilege action that can overwrite most course content and settings. +- **Export course** (``courses.export_course``): Download course content as a file for backup or reuse on another platform. Enrollments =========== -- **View enrollments** (``courses.view_enrollments``): Allows users to view and search course enrollments and check a learner's enrollment status. -- **Enroll learners** (``courses.enroll_learners``): Allows users to enroll learners in the course, individually or in bulk. -- **Unenroll learners** (``courses.unenroll_learners``): Allows users to remove learners' enrollments from the course. -Learner Grading +Permissions for viewing and managing learner enrollments in the Instructor Dashboard. + +- **View enrollments** (``courses.view_enrollments``): View and search course enrollments and check a learner's enrollment status. +- **Enroll learners** (``courses.enroll_learners``): Enroll learners in the course, individually or in bulk. +- **Unenroll learners** (``courses.unenroll_learners``): Unenroll learners from the course. + +Cohorts & content groups +======================== + +Permissions for organizing learners into cohorts in the Instructor Dashboard and configuring content groups in Studio. + +- **View cohorts** (``courses.view_cohorts``): View course cohorts, their configuration, and their members. +- **Manage cohorts** (``courses.manage_cohorts``): Enable cohorts, create and configure them, and assign or move learners between cohorts manually or by uploading a CSV file. +- **View group configurations** (``courses.view_group_configurations``): View the course’s content groups and their settings in Studio. +- **Manage group configurations** (``courses.manage_group_configurations``): Create and configure content groups in Studio to make course content available to specific learners. + +Grading settings +================ + +Permissions for viewing and editing course grading settings. + +- **View grading settings** (``courses.view_grading_settings``): View the course's grading configuration, including assignment types and the grading scale, in Studio or from the Instructor Dashboard. +- **Edit grading settings** (``courses.edit_grading_settings``): Update the grading configuration for the course, including assignment types and grading scale. + +Learner grading =============== -- **View gradebook** (``courses.view_gradebook``): Allows users to view grades for learners enrolled in the course. -- **Manage learner grading** (``courses.manage_learner_grading``): Allows users to use grading tools for an individual learner or all learners, including viewing learner progress, resetting attempts, rescoring submissions, overriding scores, and deleting learner problem state. -Learner Extensions +Permissions for viewing learner grades and using grading tools in the Instructor Dashboard. + +- **View gradebook** (``courses.view_gradebook``): View grades for learners enrolled in the course. +- **Manage learner grading** (``courses.manage_learner_grading``): Use grading tools for individual learners. Reset attempts, rescore submissions, override scores, and clear saved problem state. +- **Manage bulk learner grading** (``courses.manage_bulk_learner_grading``): Use grading tools for all learners in the course. Reset attempts, rescore submissions, and clear saved problem state in bulk. + +Learner extensions ================== -- **View learner extensions** (``courses.view_learner_extensions``): Allows users to view and search learner extensions and their extended due dates. -- **Manage learner extensions** (``courses.manage_learner_extensions``): Allows users to grant or modify individual learner extensions and reset due dates to the course default. -Cohorts -======= -- **View cohorts** (``courses.view_cohorts``): Allows users to view course cohorts, their configuration, and their members. -- **Manage cohorts** (``courses.manage_cohorts``): Allows users to enable, create, and configure cohorts, and to assign or move learners between cohorts. +Permissions for viewing and managing individual learner extensions in the Instructor Dashboard. -Other -===== -- **View checklists** (``courses.view_checklists``): Allows users to view checklists. +- **View learner extensions** (``courses.view_learner_extensions``): Find granted extensions and see the updated due dates. +- **Manage learner extensions** (``courses.manage_learner_extensions``): Grant or change extensions for individual learners, or restore the original course due dates. .. _Course RP Summary Table: @@ -139,84 +179,83 @@ Roles and Permissions Summary Table ============================================= ============== ============== ===================== ============== Permissions Course Admin Course Staff Course Editor Course Auditor ============================================= ============== ============== ===================== ============== - **Tags & Taxonomies** + **Course access & content** --------------------------------------------- -------------- -------------- --------------------- -------------- - courses.manage_tags ✅ ✅ ✅ ❌ - courses.manage_taxonomies ✅ ❌ ❌ ❌ - **Updates & Handouts** + courses.view_course ✅ ✅ ✅ ✅ + courses.edit_course_content ✅ ✅ ✅ ❌ + courses.publish_course_content ✅ ✅ ❌ ❌ + courses.view_course_info ✅ ✅ ❌ ❌ + courses.view_checklists ✅ ✅ ✅ ✅ + courses.view_learner_course_status ✅ ✅ ❌ ❌ + **Course team** --------------------------------------------- -------------- -------------- --------------------- -------------- - courses.view_course_updates ✅ ✅ ✅ ✅ - courses.manage_course_updates ✅ ✅ ✅ ❌ - **Advanced & Certificates** + courses.view_course_team ✅ ✅ ✅ ✅ + courses.manage_course_team ✅ ❌ ❌ ❌ + **Schedule & details** + --------------------------------------------- -------------- -------------- --------------------- -------------- + courses.view_schedule_and_details ✅ ✅ ✅ ✅ + courses.edit_schedule ✅ ✅ ❌ ❌ + courses.edit_details ✅ ✅ ✅ ❌ + **Advanced settings & certificates** --------------------------------------------- -------------- -------------- --------------------- -------------- courses.view_advanced_settings ✅ ✅ ✅ ✅ courses.manage_advanced_settings ✅ ✅ ❌ ❌ courses.view_certificates ✅ ✅ ✅ ✅ courses.manage_certificates ✅ ✅ ❌ ❌ - **Access & Content** + **Pages & resources** --------------------------------------------- -------------- -------------- --------------------- -------------- - courses.view_course ✅ ✅ ✅ ✅ - courses.publish_course_content ✅ ✅ ❌ ❌ - courses.edit_course_content ✅ ✅ ✅ ❌ + courses.view_pages_and_resources ✅ ✅ ✅ ✅ + courses.manage_pages_and_resources ✅ ✅ ✅ ❌ + **Course updates & handouts** + --------------------------------------------- -------------- -------------- --------------------- -------------- + courses.view_course_updates ✅ ✅ ✅ ✅ + courses.manage_course_updates ✅ ✅ ✅ ❌ **Files** --------------------------------------------- -------------- -------------- --------------------- -------------- courses.view_files ✅ ✅ ✅ ✅ courses.create_files ✅ ✅ ✅ ❌ courses.edit_files ✅ ✅ ✅ ❌ courses.delete_files ✅ ✅ ❌ ❌ - **Schedule & Details** - --------------------------------------------- -------------- -------------- --------------------- -------------- - courses.view_schedule_and_details ✅ ✅ ✅ ✅ - courses.edit_schedule ✅ ✅ ❌ ❌ - courses.edit_details ✅ ✅ ✅ ❌ - **Library Updates** + **Library updates** --------------------------------------------- -------------- -------------- --------------------- -------------- courses.view_library_updates ✅ ✅ ✅ ✅ courses.manage_library_updates ✅ ✅ ✅ ❌ - **Grading** - --------------------------------------------- -------------- -------------- --------------------- -------------- - courses.view_grading_settings ✅ ✅ ✅ ✅ - courses.edit_grading_settings ✅ ✅ ✅ ❌ - **Pages & Resources** + **Tags** --------------------------------------------- -------------- -------------- --------------------- -------------- - courses.view_pages_and_resources ✅ ✅ ✅ ✅ - courses.manage_pages_and_resources ✅ ✅ ✅ ❌ - **Import / Export** + courses.manage_tags ✅ ✅ ✅ ❌ + courses.export_tags ✅ ✅ ❌ ❌ + **Course import & export** --------------------------------------------- -------------- -------------- --------------------- -------------- courses.import_course ✅ ✅ ❌ ❌ courses.export_course ✅ ✅ ❌ ❌ - courses.export_tags ✅ ✅ ❌ ❌ - **Team & Groups** - --------------------------------------------- -------------- -------------- --------------------- -------------- - courses.view_course_team ✅ ✅ ✅ ✅ - courses.view_group_configurations ✅ ✅ ✅ ✅ - courses.manage_group_configurations ✅ ✅ ✅ ❌ - courses.manage_course_team ✅ ❌ ❌ ❌ - **Course Information** - --------------------------------------------- -------------- -------------- --------------------- -------------- - courses.view_course_info ✅ ✅ ❌ ❌ **Enrollments** --------------------------------------------- -------------- -------------- --------------------- -------------- courses.view_enrollments ✅ ✅ ❌ ❌ courses.enroll_learners ✅ ✅ ❌ ❌ courses.unenroll_learners ✅ ✅ ❌ ❌ - **Learner Grading** + **Cohorts & content groups** + --------------------------------------------- -------------- -------------- --------------------- -------------- + courses.view_cohorts ✅ ✅ ❌ ❌ + courses.manage_cohorts ✅ ✅ ❌ ❌ + courses.view_group_configurations ✅ ✅ ✅ ✅ + courses.manage_group_configurations ✅ ✅ ✅ ❌ + **Grading settings** + --------------------------------------------- -------------- -------------- --------------------- -------------- + courses.view_grading_settings ✅ ✅ ✅ ✅ + courses.edit_grading_settings ✅ ✅ ✅ ❌ + **Learner grading** --------------------------------------------- -------------- -------------- --------------------- -------------- courses.view_gradebook ✅ ✅ ❌ ❌ courses.manage_learner_grading ✅ ✅ ❌ ❌ - **Learner Extensions** + courses.manage_bulk_learner_grading ✅ ❌ ❌ ❌ + **Learner extensions** --------------------------------------------- -------------- -------------- --------------------- -------------- courses.view_learner_extensions ✅ ✅ ❌ ❌ courses.manage_learner_extensions ✅ ✅ ❌ ❌ - **Cohorts** - --------------------------------------------- -------------- -------------- --------------------- -------------- - courses.view_cohorts ✅ ✅ ❌ ❌ - courses.manage_cohorts ✅ ✅ ❌ ❌ - **Other** - --------------------------------------------- -------------- -------------- --------------------- -------------- - courses.view_checklists ✅ ✅ ✅ ✅ ============================================= ============== ============== ===================== ============== +This matrix shows which permissions each course role grants across Studio, the Instructor Dashboard, and the Roles and Permissions console. Some roles may also grant permissions managed elsewhere. + .. END COURSE RP TABLE **Maintenance chart** diff --git a/docs/decisions/0034-permission-dependencies-in-authorization-schema.rst b/docs/decisions/0034-permission-dependencies-in-authorization-schema.rst index 76771a618..c3a842e07 100644 --- a/docs/decisions/0034-permission-dependencies-in-authorization-schema.rst +++ b/docs/decisions/0034-permission-dependencies-in-authorization-schema.rst @@ -59,7 +59,7 @@ Validation rejects: * a dependency whose scope namespaces do not include every scope namespace of the dependent permission; and * a role whose resolved permissions, after role extensions are applied, include a permission but not all of its direct and indirect dependencies. -The last rule means a role always lists every permission it grants, and a ``remove_permissions`` extension cannot remove a dependency that another permission on the role still needs. It applies to roles and role extensions in every file, regardless of the ``schema_version`` the file declares. +The last rule means a role always lists every permission it grants, and a ``remove_permissions`` extension cannot remove a dependency that another permission on the role still needs. It applies to roles and role extensions in every file, regardless of the ``schema_version`` the file declares. Because of this, ``1.0`` files keep their format, but they are not guaranteed to stay valid: adding ``depends_on`` to a permission can make a ``1.0`` role that grants it without its dependencies fail validation. Once the schema is part of a stable release, a change that makes previously valid files fail validation requires a major version bump. 4. Casbin representation ======================== diff --git a/docs/references/compiled-schema.yaml b/docs/references/compiled-schema.yaml index ec37a9061..de08ab63e 100644 --- a/docs/references/compiled-schema.yaml +++ b/docs/references/compiled-schema.yaml @@ -53,8 +53,10 @@ roles: - courses.manage_learner_extensions - courses.view_cohorts - courses.view_course_info + - courses.view_learner_course_status - courses.view_learner_extensions learner_grading: + - courses.manage_bulk_learner_grading - courses.manage_learner_grading - courses.view_gradebook course_auditor: @@ -189,6 +191,7 @@ roles: - courses.manage_learner_extensions - courses.view_cohorts - courses.view_course_info + - courses.view_learner_course_status - courses.view_learner_extensions learner_grading: - courses.manage_learner_grading @@ -504,7 +507,7 @@ permissions: namespace: courses name: export_course display_name: Export course - description: Download the course content as a file for backup or reuse in another platform. + description: Download course content as a file for backup or reuse on another platform. category_id: course_import_export scopes: - course-v1 @@ -607,6 +610,19 @@ permissions: icon: Settings hidden: false depends_on: [] + courses.manage_bulk_learner_grading: + applet: learner_grading + namespace: courses + name: manage_bulk_learner_grading + display_name: Manage bulk learner grading + description: Use grading tools for all learners in the course. Reset attempts, rescore submissions, and clear saved problem state in bulk. + category_id: course_learner_grading + scopes: + - course-v1 + icon: Settings + hidden: false + depends_on: + - courses.manage_learner_grading courses.manage_certificates: applet: course_authoring namespace: courses @@ -624,7 +640,7 @@ permissions: namespace: courses name: manage_cohorts display_name: Manage cohorts - description: Enable cohorts, create and configure cohorts, and assign or move learners between cohorts manually or through CSV uploads. + description: Enable cohorts, create and configure them, and assign or move learners between cohorts manually or by uploading a CSV file. category_id: course_cohorts_content_groups scopes: - course-v1 @@ -660,7 +676,7 @@ permissions: namespace: courses name: manage_group_configurations display_name: Manage group configurations - description: Create and manage content groups used to target course content to specific learners. + description: Create and configure content groups in Studio to make course content available to specific learners. category_id: course_cohorts_content_groups scopes: - course-v1 @@ -672,31 +688,33 @@ permissions: namespace: courses name: manage_learner_extensions display_name: Manage learner extensions - description: Grant or modify individual learner extensions and reset due dates to the course default. + description: Grant or change extensions for individual learners, or restore the original course due dates. category_id: course_learner_extensions scopes: - course-v1 icon: Settings hidden: false - depends_on: [] + depends_on: + - courses.view_learner_course_status courses.manage_learner_grading: applet: learner_grading namespace: courses name: manage_learner_grading display_name: Manage learner grading - description: Use grading tools for an individual learner or all learners. Includes viewing learner progress, resetting attempts, rescoring submissions, overriding scores, deleting learner problem state, and checking task status where available. + description: Use grading tools for individual learners. Reset attempts, rescore submissions, override scores, and clear saved problem state. category_id: course_learner_grading scopes: - course-v1 icon: Settings hidden: false - depends_on: [] + depends_on: + - courses.view_learner_course_status courses.manage_library_updates: applet: course_authoring namespace: courses name: manage_library_updates display_name: Manage library updates - description: Accept or reject pending updates from content libraries linked to this course. + description: Accept or reject pending updates from linked content libraries. category_id: course_library_updates scopes: - course-v1 @@ -708,7 +726,7 @@ permissions: namespace: courses name: manage_pages_and_resources display_name: Manage pages & resources - description: Enable or disable course features such as Discussions, the Wiki, Notes, Calculator, and Live. Create and edit Textbooks and Custom pages, and manage their configurations. + description: Turn course features such as Discussions, Wiki, Notes, Calculator, and Live on or off. Create, edit, and configure textbooks and custom pages. category_id: course_pages_resources scopes: - course-v1 @@ -756,7 +774,7 @@ permissions: namespace: courses name: unenroll_learners display_name: Unenroll learners - description: Remove learners' enrollments from the course. + description: Unenroll learners from the course. category_id: course_enrollments scopes: - course-v1 @@ -768,7 +786,7 @@ permissions: namespace: courses name: view_advanced_settings display_name: View advanced settings - description: Access the Advanced Settings page in Studio. This covers a wide range of technical course configurations, including proctoring, timed exams, LTI tools, enrollment limits, and custom display options. + description: View advanced settings in Studio, including proctoring, timed exams, LTI tools, enrollment limits, and custom display options. category_id: course_advanced_settings_certificates scopes: - course-v1 @@ -816,7 +834,7 @@ permissions: namespace: courses name: view_course display_name: View course - description: See the course in the Studio home and access the course outline in read-only mode. Includes the "View Live" option to preview the course as a learner in the LMS. + description: Find the course on the Studio home page and open its outline in read-only mode. Use “View Live” to preview the course as a learner in the LMS. category_id: course_access_content scopes: - course-v1 @@ -828,7 +846,7 @@ permissions: namespace: courses name: view_course_info display_name: View course info - description: View general course information and enrollment counts in the Instructor Dashboard. + description: View general course information, enrollment counts, and the status of background tasks in the Instructor Dashboard. category_id: course_access_content scopes: - course-v1 @@ -840,7 +858,7 @@ permissions: namespace: courses name: view_course_team display_name: View course team - description: See who has a role assigned to this course in the Roles and Permissions console or on the Course Team tab in the Instructor Dashboard. + description: View course team members and their assigned roles in the Roles and Permissions console or on the Course Team tab in the Instructor Dashboard. category_id: course_team scopes: - course-v1 @@ -876,7 +894,7 @@ permissions: namespace: courses name: view_files display_name: View files - description: See the list of files and assets uploaded to the course. + description: View the list of uploaded course files and assets. category_id: course_files scopes: - course-v1 @@ -894,7 +912,8 @@ permissions: - course-v1 icon: RemoveRedEye hidden: false - depends_on: [] + depends_on: + - courses.view_course_info courses.view_grading_settings: applet: course_authoring namespace: courses @@ -912,19 +931,31 @@ permissions: namespace: courses name: view_group_configurations display_name: View group configurations - description: See the list of content groups and their configurations for this course. + description: View the course’s content groups and their settings in Studio. category_id: course_cohorts_content_groups scopes: - course-v1 icon: RemoveRedEye hidden: false depends_on: [] + courses.view_learner_course_status: + applet: learner_administration + namespace: courses + name: view_learner_course_status + display_name: View learner course status + description: Access learner profile information, enrollment status, and course progress. + category_id: course_access_content + scopes: + - course-v1 + icon: RemoveRedEye + hidden: false + depends_on: [] courses.view_learner_extensions: applet: learner_administration namespace: courses name: view_learner_extensions display_name: View learner extensions - description: View and search granted learner extensions and their extended due dates. + description: Find granted extensions and see the updated due dates. category_id: course_learner_extensions scopes: - course-v1 @@ -936,7 +967,7 @@ permissions: namespace: courses name: view_library_updates display_name: View library updates - description: View pending updates from content libraries linked to this course. + description: Review pending updates from linked content libraries. category_id: course_library_updates scopes: - course-v1 @@ -948,7 +979,7 @@ permissions: namespace: courses name: view_pages_and_resources display_name: View pages & resources - description: See the Pages & Resources section in Studio. + description: View course pages, learning resources, and feature settings in Studio. category_id: course_pages_resources scopes: - course-v1 @@ -960,7 +991,7 @@ permissions: namespace: courses name: view_schedule_and_details display_name: View schedule & details - description: See the course schedule (start and end dates, enrollment dates, and pacing settings) and course details (summary, pacing, and prerequisites). + description: View course start and end dates, enrollment dates, pacing, the course summary, and prerequisites. category_id: course_schedule_details scopes: - course-v1 @@ -971,7 +1002,7 @@ categories: course_access_content: applet: course_authoring display_name: Course access & content - description: Permissions for accessing the course and its launch checklist in Studio, managing course content, and viewing the course overview in the Instructor Dashboard. + description: Permissions for accessing the course, viewing course and learner information, and managing course content. icon: BookOpen hidden: false course_advanced_settings_certificates: @@ -983,7 +1014,7 @@ categories: course_cohorts_content_groups: applet: learner_administration display_name: Cohorts & content groups - description: Permissions for viewing and managing cohorts in the Instructor Dashboard and configuring content groups in Studio. + description: Permissions for organizing learners into cohorts in the Instructor Dashboard and configuring content groups in Studio. icon: Groups hidden: false course_enrollments: @@ -1013,7 +1044,7 @@ categories: course_learner_extensions: applet: learner_administration display_name: Learner extensions - description: Permissions for viewing and managing individual due date extensions from the Date Extensions tab in the Instructor Dashboard. + description: Permissions for viewing and managing individual learner extensions in the Instructor Dashboard. icon: Event hidden: false course_learner_grading: @@ -1031,7 +1062,7 @@ categories: course_library_updates: applet: course_authoring display_name: Library updates - description: Permissions for reviewing and managing updates made to content libraries connected to the course. + description: Permissions for reviewing and applying content updates from linked libraries. icon: LibraryBooks hidden: false course_pages_resources: @@ -1043,7 +1074,7 @@ categories: course_schedule_details: applet: course_authoring display_name: Schedule & details - description: Permissions for viewing and editing the course schedule and course information. + description: Permissions for viewing and editing the course schedule and details in Studio. icon: Calendar hidden: false course_tags_taxonomies: @@ -1061,7 +1092,7 @@ categories: course_updates_handouts: applet: course_authoring display_name: Course updates & handouts - description: Permissions for viewing and managing course updates and handouts that are visible to learners. + description: Permissions for viewing and managing course announcements and handouts. icon: Sync hidden: false library: diff --git a/src/openedx_authz/applets/course_authoring/schema/permissions.yaml b/src/openedx_authz/applets/course_authoring/schema/permissions.yaml index fd43f88af..ccb1133f3 100644 --- a/src/openedx_authz/applets/course_authoring/schema/permissions.yaml +++ b/src/openedx_authz/applets/course_authoring/schema/permissions.yaml @@ -9,15 +9,15 @@ priority: 100 permission_categories: - id: course_access_content display_name: Course access & content - description: Permissions for accessing the course and its launch checklist in Studio, managing course content, and viewing the course overview in the Instructor Dashboard. + description: Permissions for accessing the course, viewing course and learner information, and managing course content. icon: BookOpen - id: course_library_updates display_name: Library updates - description: Permissions for reviewing and managing updates made to content libraries connected to the course. + description: Permissions for reviewing and applying content updates from linked libraries. icon: LibraryBooks - id: course_updates_handouts display_name: Course updates & handouts - description: Permissions for viewing and managing course updates and handouts that are visible to learners. + description: Permissions for viewing and managing course announcements and handouts. icon: Sync - id: course_pages_resources display_name: Pages & resources @@ -29,7 +29,7 @@ permission_categories: icon: Folder - id: course_schedule_details display_name: Schedule & details - description: Permissions for viewing and editing the course schedule and course information. + description: Permissions for viewing and editing the course schedule and details in Studio. icon: Calendar - id: course_grading_settings display_name: Grading settings @@ -56,7 +56,7 @@ permissions: - namespace: courses name: view_course display_name: View course - description: See the course in the Studio home and access the course outline in read-only mode. Includes the "View Live" option to preview the course as a learner in the LMS. + description: Find the course on the Studio home page and open its outline in read-only mode. Use “View Live” to preview the course as a learner in the LMS. category_id: course_access_content scopes: - course-v1 @@ -80,7 +80,7 @@ permissions: - namespace: courses name: view_library_updates display_name: View library updates - description: View pending updates from content libraries linked to this course. + description: Review pending updates from linked content libraries. category_id: course_library_updates scopes: - course-v1 @@ -88,7 +88,7 @@ permissions: - namespace: courses name: manage_library_updates display_name: Manage library updates - description: Accept or reject pending updates from content libraries linked to this course. + description: Accept or reject pending updates from linked content libraries. category_id: course_library_updates scopes: - course-v1 @@ -112,7 +112,7 @@ permissions: - namespace: courses name: view_pages_and_resources display_name: View pages & resources - description: See the Pages & Resources section in Studio. + description: View course pages, learning resources, and feature settings in Studio. category_id: course_pages_resources scopes: - course-v1 @@ -120,7 +120,7 @@ permissions: - namespace: courses name: manage_pages_and_resources display_name: Manage pages & resources - description: Enable or disable course features such as Discussions, the Wiki, Notes, Calculator, and Live. Create and edit Textbooks and Custom pages, and manage their configurations. + description: Turn course features such as Discussions, Wiki, Notes, Calculator, and Live on or off. Create, edit, and configure textbooks and custom pages. category_id: course_pages_resources scopes: - course-v1 @@ -128,7 +128,7 @@ permissions: - namespace: courses name: view_files display_name: View files - description: See the list of files and assets uploaded to the course. + description: View the list of uploaded course files and assets. category_id: course_files scopes: - course-v1 @@ -160,7 +160,7 @@ permissions: - namespace: courses name: view_schedule_and_details display_name: View schedule & details - description: See the course schedule (start and end dates, enrollment dates, and pacing settings) and course details (summary, pacing, and prerequisites). + description: View course start and end dates, enrollment dates, pacing, the course summary, and prerequisites. category_id: course_schedule_details scopes: - course-v1 @@ -200,7 +200,7 @@ permissions: - namespace: courses name: view_course_team display_name: View course team - description: See who has a role assigned to this course in the Roles and Permissions console or on the Course Team tab in the Instructor Dashboard. + description: View course team members and their assigned roles in the Roles and Permissions console or on the Course Team tab in the Instructor Dashboard. category_id: course_team scopes: - course-v1 @@ -216,7 +216,7 @@ permissions: - namespace: courses name: view_group_configurations display_name: View group configurations - description: See the list of content groups and their configurations for this course. + description: View the course’s content groups and their settings in Studio. category_id: course_cohorts_content_groups scopes: - course-v1 @@ -224,7 +224,7 @@ permissions: - namespace: courses name: manage_group_configurations display_name: Manage group configurations - description: Create and manage content groups used to target course content to specific learners. + description: Create and configure content groups in Studio to make course content available to specific learners. category_id: course_cohorts_content_groups scopes: - course-v1 @@ -240,7 +240,7 @@ permissions: - namespace: courses name: view_advanced_settings display_name: View advanced settings - description: Access the Advanced Settings page in Studio. This covers a wide range of technical course configurations, including proctoring, timed exams, LTI tools, enrollment limits, and custom display options. + description: View advanced settings in Studio, including proctoring, timed exams, LTI tools, enrollment limits, and custom display options. category_id: course_advanced_settings_certificates scopes: - course-v1 @@ -280,7 +280,7 @@ permissions: - namespace: courses name: export_course display_name: Export course - description: Download the course content as a file for backup or reuse in another platform. + description: Download course content as a file for backup or reuse on another platform. category_id: course_import_export scopes: - course-v1 diff --git a/src/openedx_authz/applets/enrollments/schema/permissions.yaml b/src/openedx_authz/applets/enrollments/schema/permissions.yaml index 1426f4db5..20ac8f63f 100644 --- a/src/openedx_authz/applets/enrollments/schema/permissions.yaml +++ b/src/openedx_authz/applets/enrollments/schema/permissions.yaml @@ -29,7 +29,7 @@ permissions: - namespace: courses name: unenroll_learners display_name: Unenroll learners - description: Remove learners' enrollments from the course. + description: Unenroll learners from the course. category_id: course_enrollments scopes: - course-v1 diff --git a/src/openedx_authz/applets/learner_administration/README.rst b/src/openedx_authz/applets/learner_administration/README.rst index 663915194..48895c3cd 100644 --- a/src/openedx_authz/applets/learner_administration/README.rst +++ b/src/openedx_authz/applets/learner_administration/README.rst @@ -1,6 +1,6 @@ Learner Administration ###################### -This applet owns the permissions for viewing course information and managing learner extensions and cohorts, which belong to the Support Learning bounded context. It adds those permissions to the ``course_admin`` and ``course_staff`` roles through role extensions. ``constants.py`` contains its permission objects. +This applet owns the permissions for viewing course information and a learner's course status, and managing learner extensions and cohorts, which belong to the Support Learning bounded context. It adds those permissions to the ``course_admin`` and ``course_staff`` roles through role extensions. ``constants.py`` contains its permission objects. The applet is an internal package, so clients import these constants from ``openedx_authz.authz``. The existing ``openedx_authz.constants.permissions`` path remains a compatibility export. diff --git a/src/openedx_authz/applets/learner_administration/constants.py b/src/openedx_authz/applets/learner_administration/constants.py index 7b26cc8e9..d8f8c00a1 100644 --- a/src/openedx_authz/applets/learner_administration/constants.py +++ b/src/openedx_authz/applets/learner_administration/constants.py @@ -4,6 +4,7 @@ __all__ = [ "COURSES_VIEW_COURSE_INFO", + "COURSES_VIEW_LEARNER_COURSE_STATUS", "COURSES_VIEW_LEARNER_EXTENSIONS", "COURSES_MANAGE_LEARNER_EXTENSIONS", "COURSES_VIEW_COHORTS", @@ -17,6 +18,11 @@ effect="allow", ) +COURSES_VIEW_LEARNER_COURSE_STATUS = PermissionData( + action=ActionData(external_key=f"{COURSES_NAMESPACE}.view_learner_course_status"), + effect="allow", +) + COURSES_VIEW_LEARNER_EXTENSIONS = PermissionData( action=ActionData(external_key=f"{COURSES_NAMESPACE}.view_learner_extensions"), effect="allow", diff --git a/src/openedx_authz/applets/learner_administration/schema/permissions.yaml b/src/openedx_authz/applets/learner_administration/schema/permissions.yaml index 795edd33c..ec38c5ce5 100644 --- a/src/openedx_authz/applets/learner_administration/schema/permissions.yaml +++ b/src/openedx_authz/applets/learner_administration/schema/permissions.yaml @@ -1,4 +1,4 @@ -schema_version: "1.0" +schema_version: "1.1" priority: 100 # Icons are Paragon icon names (@openedx/paragon/icons). @@ -6,18 +6,26 @@ priority: 100 permission_categories: - id: course_learner_extensions display_name: Learner extensions - description: Permissions for viewing and managing individual due date extensions from the Date Extensions tab in the Instructor Dashboard. + description: Permissions for viewing and managing individual learner extensions in the Instructor Dashboard. icon: Event - id: course_cohorts_content_groups display_name: Cohorts & content groups - description: Permissions for viewing and managing cohorts in the Instructor Dashboard and configuring content groups in Studio. + description: Permissions for organizing learners into cohorts in the Instructor Dashboard and configuring content groups in Studio. icon: Groups permissions: - namespace: courses name: view_course_info display_name: View course info - description: View general course information and enrollment counts in the Instructor Dashboard. + description: View general course information, enrollment counts, and the status of background tasks in the Instructor Dashboard. + category_id: course_access_content + scopes: + - course-v1 + icon: RemoveRedEye + - namespace: courses + name: view_learner_course_status + display_name: View learner course status + description: Access learner profile information, enrollment status, and course progress. category_id: course_access_content scopes: - course-v1 @@ -25,7 +33,7 @@ permissions: - namespace: courses name: view_learner_extensions display_name: View learner extensions - description: View and search granted learner extensions and their extended due dates. + description: Find granted extensions and see the updated due dates. category_id: course_learner_extensions scopes: - course-v1 @@ -33,11 +41,13 @@ permissions: - namespace: courses name: manage_learner_extensions display_name: Manage learner extensions - description: Grant or modify individual learner extensions and reset due dates to the course default. + description: Grant or change extensions for individual learners, or restore the original course due dates. category_id: course_learner_extensions scopes: - course-v1 icon: Settings + depends_on: + - courses.view_learner_course_status - namespace: courses name: view_cohorts display_name: View cohorts @@ -49,7 +59,7 @@ permissions: - namespace: courses name: manage_cohorts display_name: Manage cohorts - description: Enable cohorts, create and configure cohorts, and assign or move learners between cohorts manually or through CSV uploads. + description: Enable cohorts, create and configure them, and assign or move learners between cohorts manually or by uploading a CSV file. category_id: course_cohorts_content_groups scopes: - course-v1 diff --git a/src/openedx_authz/applets/learner_administration/schema/role_extensions.yaml b/src/openedx_authz/applets/learner_administration/schema/role_extensions.yaml index 278f5e852..78d4dead6 100644 --- a/src/openedx_authz/applets/learner_administration/schema/role_extensions.yaml +++ b/src/openedx_authz/applets/learner_administration/schema/role_extensions.yaml @@ -5,6 +5,7 @@ role_extensions: - role_id: course_admin add_permissions: - courses.view_course_info + - courses.view_learner_course_status - courses.view_learner_extensions - courses.manage_learner_extensions - courses.view_cohorts @@ -13,6 +14,7 @@ role_extensions: - role_id: course_staff add_permissions: - courses.view_course_info + - courses.view_learner_course_status - courses.view_learner_extensions - courses.manage_learner_extensions - courses.view_cohorts diff --git a/src/openedx_authz/applets/learner_grading/README.rst b/src/openedx_authz/applets/learner_grading/README.rst index 50b7a7a2f..0d0c69df4 100644 --- a/src/openedx_authz/applets/learner_grading/README.rst +++ b/src/openedx_authz/applets/learner_grading/README.rst @@ -1,6 +1,6 @@ Learner Grading ############### -This applet owns the permissions for viewing the gradebook and using grading tools for individual learners, which belong to the Consuming Learning Content bounded context. It adds those permissions to the ``course_admin`` and ``course_staff`` roles through role extensions. ``constants.py`` contains its permission objects. +This applet owns the permissions for viewing the gradebook and using grading tools for individual learners or all learners, which belong to the Consuming Learning Content bounded context. It adds those permissions to the ``course_admin`` and ``course_staff`` roles through role extensions. ``constants.py`` contains its permission objects. The applet is an internal package, so clients import these constants from ``openedx_authz.authz``. The existing ``openedx_authz.constants.permissions`` path remains a compatibility export. diff --git a/src/openedx_authz/applets/learner_grading/constants.py b/src/openedx_authz/applets/learner_grading/constants.py index 52a2e1e9e..40ba2eb4f 100644 --- a/src/openedx_authz/applets/learner_grading/constants.py +++ b/src/openedx_authz/applets/learner_grading/constants.py @@ -5,6 +5,7 @@ __all__ = [ "COURSES_VIEW_GRADEBOOK", "COURSES_MANAGE_LEARNER_GRADING", + "COURSES_MANAGE_BULK_LEARNER_GRADING", ] COURSES_NAMESPACE = "courses" @@ -18,3 +19,8 @@ action=ActionData(external_key=f"{COURSES_NAMESPACE}.manage_learner_grading"), effect="allow", ) + +COURSES_MANAGE_BULK_LEARNER_GRADING = PermissionData( + action=ActionData(external_key=f"{COURSES_NAMESPACE}.manage_bulk_learner_grading"), + effect="allow", +) diff --git a/src/openedx_authz/applets/learner_grading/schema/permissions.yaml b/src/openedx_authz/applets/learner_grading/schema/permissions.yaml index 8079550f0..0efece71a 100644 --- a/src/openedx_authz/applets/learner_grading/schema/permissions.yaml +++ b/src/openedx_authz/applets/learner_grading/schema/permissions.yaml @@ -1,4 +1,4 @@ -schema_version: "1.0" +schema_version: "1.1" priority: 100 # Icons are Paragon icon names (@openedx/paragon/icons). @@ -18,11 +18,25 @@ permissions: scopes: - course-v1 icon: RemoveRedEye + depends_on: + - courses.view_course_info - namespace: courses name: manage_learner_grading display_name: Manage learner grading - description: Use grading tools for an individual learner or all learners. Includes viewing learner progress, resetting attempts, rescoring submissions, overriding scores, deleting learner problem state, and checking task status where available. + description: Use grading tools for individual learners. Reset attempts, rescore submissions, override scores, and clear saved problem state. category_id: course_learner_grading scopes: - course-v1 icon: Settings + depends_on: + - courses.view_learner_course_status + - namespace: courses + name: manage_bulk_learner_grading + display_name: Manage bulk learner grading + description: Use grading tools for all learners in the course. Reset attempts, rescore submissions, and clear saved problem state in bulk. + category_id: course_learner_grading + scopes: + - course-v1 + icon: Settings + depends_on: + - courses.manage_learner_grading diff --git a/src/openedx_authz/applets/learner_grading/schema/role_extensions.yaml b/src/openedx_authz/applets/learner_grading/schema/role_extensions.yaml index 1253e143b..a732cd1c4 100644 --- a/src/openedx_authz/applets/learner_grading/schema/role_extensions.yaml +++ b/src/openedx_authz/applets/learner_grading/schema/role_extensions.yaml @@ -6,6 +6,7 @@ role_extensions: add_permissions: - courses.view_gradebook - courses.manage_learner_grading + - courses.manage_bulk_learner_grading - role_id: course_staff add_permissions: diff --git a/src/openedx_authz/tests/role_permissions.py b/src/openedx_authz/tests/role_permissions.py index 04f75c505..e189fd1a1 100644 --- a/src/openedx_authz/tests/role_permissions.py +++ b/src/openedx_authz/tests/role_permissions.py @@ -18,6 +18,7 @@ COURSES_LEGACY_LIMITED_STAFF_ROLE_PERMISSIONS, COURSES_LEGACY_STAFF_ROLE_PERMISSIONS, COURSES_MANAGE_ADVANCED_SETTINGS, + COURSES_MANAGE_BULK_LEARNER_GRADING, COURSES_MANAGE_CERTIFICATES, COURSES_MANAGE_COHORTS, COURSES_MANAGE_COURSE_TEAM, @@ -44,6 +45,7 @@ COURSES_VIEW_GRADEBOOK, COURSES_VIEW_GRADING_SETTINGS, COURSES_VIEW_GROUP_CONFIGURATIONS, + COURSES_VIEW_LEARNER_COURSE_STATUS, COURSES_VIEW_LEARNER_EXTENSIONS, COURSES_VIEW_LIBRARY_UPDATES, COURSES_VIEW_PAGES_AND_RESOURCES, @@ -135,6 +137,7 @@ INSTRUCTOR_DASHBOARD_PERMISSIONS = [ COURSES_VIEW_COURSE_INFO, + COURSES_VIEW_LEARNER_COURSE_STATUS, COURSES_VIEW_ENROLLMENTS, COURSES_ENROLL_LEARNERS, COURSES_UNENROLL_LEARNERS, @@ -165,6 +168,7 @@ *COURSE_STAFF_PERMISSIONS[1:], COURSES_MANAGE_COURSE_TEAM, COURSES_MANAGE_TAXONOMIES, + COURSES_MANAGE_BULK_LEARNER_GRADING, ] COURSE_LIMITED_STAFF_PERMISSIONS = [ diff --git a/src/openedx_authz/tests/schema/test_dependency_enforcement.py b/src/openedx_authz/tests/schema/test_dependency_enforcement.py index fce2d828d..78aa9f305 100644 --- a/src/openedx_authz/tests/schema/test_dependency_enforcement.py +++ b/src/openedx_authz/tests/schema/test_dependency_enforcement.py @@ -28,6 +28,16 @@ ("content_libraries.edit_library_collection", "content_libraries.view_library"), } +# The dependencies between the Instructor Dashboard permissions. +INSTRUCTOR_DASHBOARD_G2_ROWS = { + ("courses.manage_learner_grading", "courses.view_learner_course_status"), + ("courses.manage_learner_extensions", "courses.view_learner_course_status"), + ("courses.manage_bulk_learner_grading", "courses.manage_learner_grading"), + ("courses.view_gradebook", "courses.view_course_info"), +} + +BUILT_IN_G2_ROWS = LEGACY_LIBRARY_G2_ROWS | INSTRUCTOR_DASHBOARD_G2_ROWS + # One concrete scope per scope type, for assigning roles in the enforcement check. SCOPES = { "lib": make_scope_key("lib", "lib:DependencyOrg:dependency_library"), @@ -50,14 +60,14 @@ def seed_legacy_g2_rows() -> None: class TestBuiltInDependencyRows(AuthzEnforcerTestMixin, TestCase): - """Applying the built-in schema stores the library dependencies as ``g2`` rows.""" + """Applying the built-in schema stores its dependencies as ``g2`` rows.""" - def test_fresh_install_gets_the_legacy_library_g2_rows(self): - """A database that never loaded ``authz.policy`` gets the same rows it used to declare.""" + def test_fresh_install_gets_the_built_in_g2_rows(self): + """A new database gets the library rows ``authz.policy`` declared and the Instructor Dashboard rows.""" SchemaPipeline().apply() - assert stored_g2_rows() == LEGACY_LIBRARY_G2_ROWS - assert AuthzPermissionDependency.objects.count() == len(LEGACY_LIBRARY_G2_ROWS) + assert stored_g2_rows() == BUILT_IN_G2_ROWS + assert AuthzPermissionDependency.objects.count() == len(BUILT_IN_G2_ROWS) def test_rows_from_authz_policy_are_adopted_without_writes(self): """An existing installation keeps its ``g2`` rows, and the loader records that it owns them.""" @@ -65,10 +75,10 @@ def test_rows_from_authz_policy_are_adopted_without_writes(self): result = SchemaPipeline().apply() - assert result.added_action_rows == 0 + assert result.added_action_rows == len(INSTRUCTOR_DASHBOARD_G2_ROWS) assert result.removed_action_rows == 0 - assert CasbinRule.objects.filter(ptype="g2").count() == len(LEGACY_LIBRARY_G2_ROWS) - assert AuthzPermissionDependency.objects.count() == len(LEGACY_LIBRARY_G2_ROWS) + assert CasbinRule.objects.filter(ptype="g2").count() == len(BUILT_IN_G2_ROWS) + assert AuthzPermissionDependency.objects.count() == len(BUILT_IN_G2_ROWS) def test_reapplying_changes_nothing(self): """A second apply of the same schema writes no ``g2`` rows and reports no change.""" @@ -77,7 +87,7 @@ def test_reapplying_changes_nothing(self): result = SchemaPipeline().apply() assert result.unchanged is True - assert stored_g2_rows() == LEGACY_LIBRARY_G2_ROWS + assert stored_g2_rows() == BUILT_IN_G2_ROWS def test_unmanaged_g2_row_is_kept(self): """A ``g2`` row that no schema declares is left in place.""" @@ -130,3 +140,31 @@ def test_g2_rows_grant_the_dependency_to_a_role_that_does_not_list_it(self): assert enforcer.enforce(user, make_action_key("content_libraries.edit_library_content"), scope) assert enforcer.enforce(user, make_action_key("content_libraries.view_library"), scope) assert not enforcer.enforce(user, make_action_key("content_libraries.view_library_team"), scope) + + def test_bulk_grading_includes_its_direct_and_indirect_dependencies(self): + """A role with only the bulk grading permission can also grade one learner and view their status.""" + enforcer = AuthzEnforcer.get_enforcer() + user, role = make_user_key("bulk_grader"), make_role_key("bulk_grader_role") + scope = SCOPES["course-v1"] + enforcer.add_policy(role, make_action_key("courses.manage_bulk_learner_grading"), "course-v1^*", "allow") + enforcer.add_grouping_policy(user, role, scope) + + assert enforcer.enforce(user, make_action_key("courses.manage_learner_grading"), scope) + assert enforcer.enforce(user, make_action_key("courses.view_learner_course_status"), scope) + assert not enforcer.enforce(user, make_action_key("courses.view_course_info"), scope) + + def test_only_course_admin_can_grade_all_learners(self): + """Course Staff can grade one learner at a time, and only Course Admin can grade all of them.""" + enforcer = AuthzEnforcer.get_enforcer() + scope = SCOPES["course-v1"] + for role_id, can_grade_all_learners in (("course_admin", True), ("course_staff", False)): + with self.subTest(role_id=role_id): + user = make_user_key(f"grader_{role_id}") + enforcer.add_grouping_policy(user, make_role_key(role_id), scope) + + assert enforcer.enforce(user, make_action_key("courses.view_learner_course_status"), scope) + assert enforcer.enforce(user, make_action_key("courses.manage_learner_grading"), scope) + assert ( + enforcer.enforce(user, make_action_key("courses.manage_bulk_learner_grading"), scope) + is can_grade_all_learners + ) diff --git a/src/openedx_authz/tests/test_imports.py b/src/openedx_authz/tests/test_imports.py index 1c45764ac..c3935f923 100644 --- a/src/openedx_authz/tests/test_imports.py +++ b/src/openedx_authz/tests/test_imports.py @@ -78,8 +78,15 @@ def test_applet_permission_constants_are_reexported(self): ), "openedx_authz.applets.course_team_roles.constants": ("COURSES_LEGACY_INSTRUCTOR_ROLE_PERMISSIONS",), "openedx_authz.applets.enrollments.constants": ("COURSES_VIEW_ENROLLMENTS",), - "openedx_authz.applets.learner_grading.constants": ("COURSES_VIEW_GRADEBOOK",), - "openedx_authz.applets.learner_administration.constants": ("COURSES_VIEW_COURSE_INFO",), + "openedx_authz.applets.learner_grading.constants": ( + "COURSES_VIEW_GRADEBOOK", + "COURSES_MANAGE_LEARNER_GRADING", + "COURSES_MANAGE_BULK_LEARNER_GRADING", + ), + "openedx_authz.applets.learner_administration.constants": ( + "COURSES_VIEW_COURSE_INFO", + "COURSES_VIEW_LEARNER_COURSE_STATUS", + ), } for module_name, names in applet_constants.items():