Skip to content

Redirect Instructor Dashboard entry to the first tab the user can access #654

Done
openedx/frontend-app-instructor-dashboard
#281

Description

@BryanttV

Description

In the Learning MFE, the Instructor Dashboard tab links to the Instructor Dashboard MFE, which always lands on the /course_info tab. Users who do not have permission to view that tab end up on a page they cannot use, even when they have access to other tabs. The landing page should depend on the tabs available to the user.

Current Behavior

Clicking the Instructor Dashboard tab in the Learning MFE opens <INSTRUCTOR_MICROFRONTEND_URL>/<course_key>, which always redirects to /course_info. This happens regardless of the user's permissions. If the user lacks courses.view_course_info, they see a page they are not allowed to use instead of a tab they can access.

Expected Behavior

Opening the Instructor Dashboard redirects the user to the first tab, in the dashboard's tab order, that the user has permission to access. /course_info is used only when it is the first accessible tab.

Steps to reproduce

  1. Log in as a user who has access to the Instructor Dashboard but lacks the courses.view_course_info permission for a course.
  2. Open the course in the Learning MFE.
  3. Click the Instructor Dashboard tab.
  4. Observe that the browser lands on /instructor-dashboard/<course_key>/course_info instead of the first tab the user can access.

Acceptance Criteria

  • Opening the Instructor Dashboard from the Learning MFE redirects to the first tab accessible to the user, following the displayed tab order.
  • A user with access to course_info still lands on /course_info.
  • A user without access to course_info lands on the first tab they can access, not on /course_info.
  • A user with no accessible tabs sees a clear no-access state instead of a redirect loop or a blank page.
  • Direct access to a tab the user cannot view remains restricted.
  • Unit tests cover the redirect for users with different sets of permissions.

Technical Notes

  • The redirect is defined in the Instructor Dashboard MFE, not in the Learning MFE. DefaultTabRedirect in src/routes.tsx navigates to the static defaultLandingTabId.
  • defaultLandingTabId is hardcoded as 'course_info' in src/dashboardConfig/configs.tsx.
  • The Learning MFE link comes from get_instructor_dashboard_url() in openedx-platform/lms/djangoapps/instructor/views/instructor_dashboard.py, which builds f'{INSTRUCTOR_MICROFRONTEND_URL}/{course_key}' with no tab information.
  • Permission constants live in src/permissions/constants.ts (for example VIEW_COURSE_INFO). CourseInfoPage already gates its content on courses.view_course_info.
  • The fix should reuse the same tab list and permission checks that the instructor navigation uses (src/instructorNav/), so the landing tab always matches the visible tabs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions