if called with no sections, just no-op. this behavior is just moved into
the scope from Course#instructors_in_charge_of(student) so it can be
reused elsewhere later
Change-Id: I574e90a5565993e8969f344f0bbffe51d5160941
Reviewed-on: https://gerrit.instructure.com/8794
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
Test Plan:
* create a course with assignment that is not muted
* csv should not have muted line
* create a course with a muted assignment
* csv should have muted line
* attempt import csv without muted assignments row to grades
* attempt import csv with muted assignment row to grades
* muted assignmet row should not impact grade import
closes#6390
Change-Id: Iab7c1d9c93e15a15e0ef1797cceee536aa2447ab
Reviewed-on: https://gerrit.instructure.com/8308
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
when course import is happening, display notification on
course home page that explains why some content may not
be visible.
test plan:
* create new course;
* verify that no message displays on course home page;
* start course import (or create a CourseImport
in the console);
* verify that course import notification appears on course
home page;
* complete CourseImport or set its workflow_state to either
'completed' or 'failed.'
* verify that course import notification no longer appears.
Change-Id: Ia62fbf9d8d1a36440d4f36d28ee4ebc83fe8668d
Reviewed-on: https://gerrit.instructure.com/8624
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
The previous method of mapping over the entire submissions array once for
each student was inefficient for courses with a large number of
submissions (which is typically students * assignments)
refs #7235
test plan:
* download the csv from the gradebook
* re-upload the csv to the gradebook, verify that things work as before
* on a large course, this should be significantly faster than the
previous code. however, it could still timeout on a huge course.
this won't be completely solved until we refactor and make this an
async process.
Change-Id: Icd2d7aae79fa933f1338de0b1c18a7219d772e93
Reviewed-on: https://gerrit.instructure.com/8642
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
We want to show all sections that a user belongs to when building groups, and
make sure that section-restricted groups take into account multiple sections.
The data model already (mostly) supported this, but the UI did not.
Test plan:
- create a course with > 2 sections, > 2 users, at least one in multiple
sections.
- Go to the groups page, make sure that both sections show up under the user.
- Make the group category section-restricted, make sure things work as you
expect.
Change-Id: Ic13bc81cf62811a0e5dcb9572240fae685056989
Reviewed-on: https://gerrit.instructure.com/8435
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Just fire off the kaltura upload jobs in the background, so that the
import can continue. Attachments in the special media_objects export
folder will still be deleted when those uploads complete.
Note we still wait for canvas common cartidge imports, since we need the
completed media object imports in order to translate the rich text
content. We plan to address this limitation later.
test plan:
* do a course import from a source other than canvas CC, verify that
the import finishes without waiting on Kaltura.
* do a course import from a canvas CC package with
some audio/video. Verify that the import finishes after waiting on
kaltura, but the attachments in /media_objects are removed as the
kaltura jobs complete.
fixes#5383
Change-Id: I7dbf12c211fc332fe9d4f16bc4d31fd0656c1941
Reviewed-on: https://gerrit.instructure.com/8031
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
fixes#6769, #6939
Test plan:
- enable caching with redis or memcached
- log in to a course page
- use the api to add an external tool with course navigation (see the
redmine bug)
- refresh (you should see the external tool in the navigation)
- delete the external tool
- refresh (nav item should be gone)
Change-Id: I734bd726818ea84ffe333597eb0197db2200c235
Reviewed-on: https://gerrit.instructure.com/8141
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
don't try and accept! (or reject!) when they're not actually invited.
only show "invitation accepted/rejected" flashes when it actually
happened. don't allow previewing invitees to see unpublished courses.
don't show invitation related flashes when displaying a "you can't look
at this" page. fixes#6708.
test-plan:
- create unpublished courses in the default account and in a
non-default account
- create a user for each course and invite them as students to the courses
- try and visit the courses as the respective students
- both should see the "this course hasn't been published yet" page
- both should see no flash-notice on that page
- neither should be accepted to their course
- create a user and invite them to one of the courses as a teacher
- try and visit the course as the teacher
- should not see the "this course hasn't been published yet" page
Change-Id: I5e6ce4541621bdc3d6dac0efe62a2741f7addabf
Reviewed-on: https://gerrit.instructure.com/8079
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
provides a role override permission for viewing discussions. primarily useful
for disallowing observers from reading discussion, although by default it is
enabled.
test plan:
- create a course
- create a discussion (d1) in that course
- create a discussion assignment (d2) in that course
- log in as an observer and make sure you can see both discussions above
- log in as an admin and revoke the read_forum permission for observers
- log back in as the observer and make sure you can't see the discussions
- also check that the assignment shows the assignment page, but does not
redirect to the associated discussion.
Change-Id: I4c6441c781c24e6aadacbfc23dcc307c772ecd2c
Reviewed-on: https://gerrit.instructure.com/8069
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
fixes#6194
test-plan:
- create a course
- create a user
- add the user to the course as a designer
(course.add_designer(user).accept in script/console)
- the user should be able to do almost everything a teacher can in the
course
- the user should *not* be able to view grades or user notes
- the user should *not* be included in the course roster
Change-Id: Id0e642fb19906529627917fffac26f0dae378bcc
Reviewed-on: https://gerrit.instructure.com/8047
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jacob Fugal <jacob@instructure.com>
test-plan:
- create a course A
- create a graded quiz in course A
- create a course B
- go to import content from course A into course B
- make sure "Copy Everything from A", "Quizzes for A", and the
specific quiz from A are all unchecked.
- check the assignment for the specific quiz from A.
- click "Import Course Content"
- the quiz should be imported from A to B without error
Change-Id: I88511511f6c8494ec04d551af3f15a2b32e374f1
Reviewed-on: https://gerrit.instructure.com/7914
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
this hasn't been released yet, and doesn't actually mean anything
test plan: run the specs
Change-Id: I391623e63fa7710717c26f33dac9c5ae220577e3
Reviewed-on: https://gerrit.instructure.com/7902
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
just make Account#root_account return self if it is a root account
test plan:
* run existing specs
Change-Id: Iff3f621bb722e0f5e90659c4b711d48d8d3c510f
Reviewed-on: https://gerrit.instructure.com/7700
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
new api available at /courses/:course_id/enrollments.
takes params:
* enrollment[user_id]
* enrollment[type]
* enrollment[workflow_state]
* enrollment[sis_source_id]
* enrollment[course_section_id]
* enrollment[limit_privileges_to_course_section]
affects: api
test plan:
* post all params and ensure that new enrollment is
created;
* post params with workflow_state of active and
verify that user is properly enrolled in course;
* post only user_id and type to verify that they
are only required params;
* post as unauthorized user to verify that 401 is
returned;
* post without user_id and/or type to verify that
error message is returned with 403 status.
Change-Id: I38e8df930efb2793bf0fa6a190f74f7fb37c7f78
Reviewed-on: https://gerrit.instructure.com/7375
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
enrollments previously had attribute
"limit_priveleges_to_course_section," but should
be spelled "privileges." replaced spelling in a
migration and across app.
affects: enrollments model
test plan:
* run specs
Change-Id: I15dcf9a023ead9bb1aed42abc2d1a7c233610840
Reviewed-on: https://gerrit.instructure.com/7431
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
The learning outcome UI has some bugs that allow you to
drag groups into other groups. This causes groups to have
multiple parents and so they'll show up on the page more
than once. Once that happens you can even drag a group
into itself. Once in that state loading the outcomes
page would cause an infinite render.
This commit makes the page render even with the existing
bad data. It also prevents groups from being added to a
group of any of its ancestors. It also fixes groups
having multiple parents.
This commit doesn't address the current bugs in the UI that
allowed these problems to happen, it just prevents those
from creating relationship loops.
Test Plan:
* Load outcomes page and create two groups
* Drag one group into the other group
* Refresh page, there should not be two of the group you dragged
* If you want to test the page loading despite existing bad relations:
* Create a content tag that makes a group point to itself like the specs do. (You can't make this happen in the UI anymore)
* Loading the outcomes page shouldn't freeze
Change-Id: I416e99b3bc57a3b8c82db5cc895bccd141dc3dab
closes: #6384
Reviewed-on: https://gerrit.instructure.com/7559
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
courses can now be created by posting to
/api/v1/accounts/:account_id/courses. it accepts
the following params:
* account_id
* offer
* course[name]
* course[course_code]
* course[start_at]
* course[conclude_at]
* course[license]
* course[is_public]
* course[allow_student_wiki_edits]
* course[allow_student_assignment_edits]
* course[allow_wiki_comments]
* course[allow_student_forum_attachments]
* course[open_enrollment]
* course[self_enrollment]
* course[sis_source_id]
* course[sis_name]
* course[sis_course_code]
test plan:
* post the above params to /api/v1/accounts/:account_id/courses
as a site or account admin and verify that a new course is
created;
* post an empty params[:course] to the api as a site or account
admin and verify that it creates a course named 'Unnamed
Course.'
* attempt to create a course as a non-admin user and verify
that a '401 Unauthorized' response is returned.
* attempt to create a new course as a site or account admin and
set the 'offer' param to true. verify that the course is
immediately available.
Change-Id: Ie5f9af8bfe3a7ec189c5532b73f5ab28314d02cb
Reviewed-on: https://gerrit.instructure.com/7330
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
refs #6440
we know for a fact that we don't fully support multiple student
enrollments in different sections of a course, but deleting duplicate
enrollments on gradebook load is a solution that is causing more trouble
than the original problem, especially because it's such a random event.
this exposes a known issue, where if you filter the gradebook by
section, the student will appear in one of their sections but not the
other.
test plan: enroll a student in multiple sections, either through SIS or
the console. going to the gradebook should not delete any of the
enrollments, but downloading the csv should still only list the student
once. and re-uploading the csv with a changed grade for that student
should work. you'll see other weirdness, like the student will have the
course listed twice in their dropdown. these are known issues discussed
in the the ticket.
Change-Id: I78c3ed513ce3986e90c65d51562bbc4b24439661
Reviewed-on: https://gerrit.instructure.com/7540
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
test plan:
* set up an account with a course
* start netcat in listening mode
* enable the grade export plugin for the course to post to your netcat
instance
* visit the course as a teacher and set up some assignments with grades
* publish the grades
Change-Id: I7f5b6b264b70ffe06c38f29ad52ee1d4694e5a8d
Reviewed-on: https://gerrit.instructure.com/7279
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
test plan: enroll a teacher in an active course; set the dates for
the associated term in the past. log in as the user,
they should still be able to see the course settings page, but
not change anything
Change-Id: I27cbdc961e977c1ae1c70ae5198b6f8478430f1a
Reviewed-on: https://gerrit.instructure.com/7077
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
fixes#6142
test plan: Create a course and enroll some students. Move the course to
another root account. The following SQL query should return 0:
SELECT COUNT(e.id) FROM enrollments e
INNER JOIN courses c ON e.course_id = c.id
WHERE e.root_account_id != c.root_account_id
To test the migration, mess up some of the enrollment
root_account_ids:
UPDATE enrollments SET root_account_id = 99
Before migrating, the SELECT COUNT snippet above should return
false, after migrating, it should return true.
Change-Id: I9b18dded8a763a8a05f5e631907f77b4e9a1bd49
Reviewed-on: https://gerrit.instructure.com/7081
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
refs #5833
testplan: enable open registration, invite a user, have that user accept
and create a new account. Then invite with the same e-mail again,
login as the old user, and the invitation should be visible in the UI.
Accept the invitation, using the existing account, and the enrollment
should not be duplicated in the UI.
Change-Id: I64c886617f87f64bad35593229ee18434163ca7b
Reviewed-on: https://gerrit.instructure.com/6778
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Test plan:
* use the /api/v1/courses/:course_id/course_copy endpoint to start a course copy
* use the returned status url to make sure the status works
* when the copy is complete make sure the course has all expected data
closes#6250
Change-Id: I95c2567d0a566d97836579dd3b7b0a224328ec38
Reviewed-on: https://gerrit.instructure.com/7032
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
also add a checkbox for admins to only search for existing users
(i.e. ignore open registration)
Change-Id: I84d2ba7992339b37506e41a50c336325af0ac73b
testplan:
* add a student to a course as a TA
* add a user to an account or a course as an admin, with and without
open registration, with and without manage_user_logins permission,
with and without checking "search only existing users" (not all
combinations applicable, each underlying condition is checked in
specs)
Reviewed-on: https://gerrit.instructure.com/6969
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
External tools weren't copied when copying a course
so that is implemented here as well
test plan:
Export/Import:
* Create an external tool assignment
* export the course
* import the course into a new course
* set the secrets on the external tool
* make sure the assignment works in the new course
Copy:
* Copy a course into a new course
* make sure the assignment works
refs #5892
Change-Id: I4aab8966b53ca2d144fddd71eefd0acbdb7c0bff
Reviewed-on: https://gerrit.instructure.com/6958
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
fixes#5824
testplan: for each sort criteria, make a number of assignments that
differ in every field but the already matched sort criteria, and
make sure the sort order is right in the csv.
sort criteria are whether or not there is a due date, due date,
assignment group, position, and title
Change-Id: Ia18f32de5ab2f44e3e64b582cca3df1bedd9553a
Reviewed-on: https://gerrit.instructure.com/6791
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
teachers and TAs can be limited to a specific section, in which case we
need to enforce those limitations in the submissions api.
testplan: set up a course with 2+ sections, and a teacher who is only
allowed to access 1 of those sections. then verify:
* GET /submissions should not list users in other sections
* GET /submissions/:id for a user in another section should 404
* PUT /submissions/:id for a user in another section should 404
* GET for_students with user ids in other sections should not return those users
* all of the above should return no submissions if the user attempts to access the api via /sections/:section_id of the other section
close#5859
Change-Id: I102b13d1462f588277ca559f418785452e58e816
Reviewed-on: https://gerrit.instructure.com/6796
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
By properly configuring external tools (see
/spec/models/course_spec/rb:898 for examples) they can
be added as left-side navigation links to a course,
an account, or to the user profile section of Canvas.
testing notes:
- you have to manually set options on the external tool:
- for user navigation the tool needs to be created on the root account
with the following settings:
{:user_navigation => {:url => <url>, :text => <tab label>} }
(there are also some optional language options you can set using
the :labels attribute)
- for account navigation it's the same
- for course navigation it's the same, except with :course_navigation
there's also some additional options:
:visibility => <value> // public, members, admins
:default => <value> // disabled, enabled
test plan:
- configure a user navigation tool at the root account level,
make sure it shows up in the user's profile section
- configure a course navigation tool at the account level,
make sure it shows up in the course's navigation
- configure a course navigation tool at the course level,
make sure it shows up in the course's navigation
- make sure :default => 'disabled' course navigation tools don't
appear by default in the navigation, but can be enabled on
the course settings page
- make sure :visibility => 'members' only shows up for course members
- make sure :visibility => 'admins' only shows up for course admins
- configure an account navigation tool at the account level,
make sure it shows up in the account's navigation, and
any sub-account's navigation
Change-Id: I977da3c6b89a9e32b4cff4c2b6b221f8162782ff
Reviewed-on: https://gerrit.instructure.com/5427
Reviewed-by: Brian Whitmer <brian@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
also, make the random assignment happen on the server via an ajax call.
before, it would make one ajax call per student assigned, which is
rather inefficient when there are many students to assign.
fixes#6099
Change-Id: I89e5059fa1bd42b1a25e5cb88d552841c426530a
Reviewed-on: https://gerrit.instructure.com/6576
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
* expose sortable name directly to the user
* don't downcase it
* use a LOWER(sortable_name) index for postgres
* set sortable name as "last_name, first_name" explicitly for SIS imports
* populate sortable name intelligently in the UI
Change-Id: I476641f4817e27a11b573d91f102c5a74d3eba26
Reviewed-on: https://gerrit.instructure.com/6512
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Reviewed-by: Ryan Florence <ryanf@instructure.com>
note that it's not strictly broken by #5833's changes, because it
didn't work for existing users before (it would ask you to login
if you weren't, and you put in an existing e-mail address, and then
it would ask you to login again if you were already logged in).
Change-Id: Idb84397ad90987076c8e717863be496fc825b77e
Reviewed-on: https://gerrit.instructure.com/6481
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
fixes#5573, #5572, #5753
* communication channels are now only unique within a single user
* UserList changes
* Always resolve pseudonym#unique_ids
* Support looking up by SMS CCs
* Option to either require e-mails match an existing CC,
or e-mails that don't match a Pseudonym will always be
returned unattached (relying on better merging behavior
to not have a gazillion accounts created)
* Method to return users, creating new ones (*without* a
Pseudonym) if necessary. (can't create with a pseudonym,
since Pseudonym#unique_id is still unique, I can't have
multiple outstanding users with the same unique_id)
* EnrollmentsFromUserList is mostly gutted, now using UserList's
functionality directy.
* Use UserList for adding account admins, removing the now
unused Account#add_admin => User#find_by_email/User#assert_by_email
codepath
* Update UsersController#create to not worry about duplicate
communication channels
* Remove AccountsController#add_user, and just use
UsersController#create
* Change SIS::UserImporter to send out a merge opportunity
e-mail if a conflicting CC is found (but still create the CC)
* In /profile, don't worry about conflicting CCs (the CC confirmation
process will now allow merging)
* Remove CommunicationChannelsController#try_merge and #merge
* For the non-simple case of CoursesController#enrollment_invitation
redirect to /register (CommunicationsChannelController#confirm)
* Remove CoursesController#transfer_enrollment
* Move PseudonymsController#registration_confirmation to
CommunicationChannelsController#confirm (have to be able to
register an account without a Pseudonym yet)
* Fold the old direct confirm functionality in, if there are
no available merge opportunities
* Allow merging the new account with the currently logged in user
* Allow changing the Pseudonym#unique_id when registering a new
account (since there might be conflicts)
* Display a list of merge opportunities based on conflicting
communication channels
* Provide link(s) to log in as the other user,
redirecting back to the registration page after login is
complete (to complete the merge as the current user)
* Remove several assert_* methods that are no longer needed
* Update PseudonymSessionsController a bit to deal with the new
way of dealing with conflicting CCs (especially CCs from LDAP),
and to redirect back to the registration/confirmation page when
attempting to do a merge
* Expose the open_registration setting; use it to control if
inviting users to a course is able to create new users
Change-Id: If2f38818a71af656854d3bf8431ddbf5dcb84691
Reviewed-on: https://gerrit.instructure.com/6149
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
One in course copy, and one in common cartridge export.
refs #5739
Change-Id: I4ba016f643a22f0cf3f6dbbe6b00dcd7d228a10a
Reviewed-on: https://gerrit.instructure.com/5979
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
added/changed functionality:
* search for course sections
* browse and select groups/sections/enrollment types (e.g. all
teachers) within a course
* browse and select enrollment types within a section
* changed toggle vs. drilldown input handling (e.g. clicking on an
expandable element now always expands it, unless you click on the
checkbox)
* "Select All" checkbox within groups and enrollment types
Change-Id: I13baa9e8b98abc5b5ec6dfb4cfbd1021160f65cc
Reviewed-on: https://gerrit.instructure.com/5955
Tested-by: Hudson <hudson@instructure.com>
Tested-by: Jon Jensen <jon@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
a course will have content tags for both learning outcomes and learning
outcome groups. the latter still use a tag_type of
'learning_outcome_association' (maybe a bug?). course.learning_outcomes
could then choose one of these content_tags, and pull in a completely
unrelated outcome that happened to have the same id as the group from
the content_tag row.
fixes#5831
Change-Id: I1be7e579147331165fbfb7c241c224a255561715
Reviewed-on: https://gerrit.instructure.com/5977
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>