Since this modal will be used everywhere in Canvas, support
students and users with no enrollments creating courses (when enabled
at the root account). Students will see all accounts where they have
enrollments; users with no enrollments will only see the manually-
created courses subaccount. Don't show homeroom sync options to
students/users with no enrollments. Expose the manually-created
courses subaccount ID/basic info through a new API.
flag = create_course_subaccount_picker
closes LS-2678
Test plan:
- Enable root account FF: create_course_subaccount_picker
- In root account settings, allow techers, students, and users with
no enrollments to create courses
- Login to k5 dashboard as an admin and click the + (New Subject)
button
- Expect to see a manageable_courses network request and a dropdown
to select an account (along with the checkbox to sync homerooms)
- Login and open the modal as a teacher
- Expect to see an enrollments network request and a dropdown with
all the accounts where the user has a teacher enrollment (and the
homeroom sync checkbox)
- Login and open the modal as a student
- Expect another enrollments network request and a dropdown with all
their accounts (if there's more than one)
- Expect to not see the sync options
- Login as a user with no enrollments
- Expect a network request to the manually_created_courses_account api
- Expect to not see a dropdown with accounts or the sync options
- Disable 'X can create courses' at the root account and expect the
associated users to no longer see the create course modal at all
- With FF disabled, expect course creation to work as before
Change-Id: I0e7d49628ce6395fd366037a3134133084fe6275
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274986
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Peyton Craighill <pcraighill@instructure.com>
Reviewed-by: Robin Kuss <rkuss@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>