External Tool extension previously needed their own urls,
custom fields, and text. Now they use the settings from
the main tool config as the defaults. So an extension
only needs a hash to be enabled.
Test Plan:
* Add a tool by xml that has custom parameters and that only has the enabled property in the course_navigation settings
* Launch that tool and verify that it used the main tools launch url and custom parameters
closes#8786
Change-Id: If760bbfe5c1dc10814d2a4b900a53abceab08e2e
Reviewed-on: https://gerrit.instructure.com/11700
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
tool_id can be used to associate multiple context_external_tools
with a single third party tool (i.e. to see how many installs
there are of the youtube tool). When tools are launched Canvas
will also track a custom ganalytics event with this tool id.
icon_url is an attribute that can be set in standard LTI
config that we were ignoring before. In the future this may
be added to the UI when picking external tools.
test plan:
- find an external tool with tool_id and icon configs
(there are some examples on lti-examples.heroku.com)
- configure an external tool using this xml
- confirm that tool_id and icon_url were correctly set
(tool.tool_id and tool.settings[:icon_url])
- launch an external tool from within a course
- make sure that nothing breaks
Change-Id: If8d6386e8a919fa70eacd46b4fa6b68ade4b5c7b
Reviewed-on: https://gerrit.instructure.com/10568
Reviewed-by: Brian Whitmer <brian@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
This allows us to have external tools that let the user pick
content to insert that has a different URL than what the tool
is configured to use. That way you could, for example, more
easily have a Khan Academy tool that let you insert Khan
Academy resources as items in a module, instead of just as
content in the WYSIWYG like you get now.
test plan:
- configure the dummy external tool included in Canvas
("<canvasdomain>/selection_test" is the launch URL,
make sure it's a resource_selection tool -- there's
a template xml in spec/fixtures/selection_test_lti.xml)
- use it to insert the blti module link which will be a link
to example.com instead of <canvasdomain>
- verify that the link launches as an lti tool launch
with the dummy tool's credentials (check the request's
POST parameters)
- configure an external tool without resource selection
- pick it from the list of tools to insert an item into a module
- manually edit the link and change the URL to something different
- verify that when clicking the changed URL, Canvas doesn't
know what to do with it (it should redirect back to the modules
page).
Change-Id: Ic2bf3145fe87e19307b185dd1c437f79d1282a49
Reviewed-on: https://gerrit.instructure.com/9914
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
When tools have one of the Canvas LTI extensions set, they
shouldn't be required to have a url or domain. In that case
they also shouldn't show up in the list of tools that can
be used to add items to a module.
test plan:
- try adding a tool by hand with no url or domain
- make sure canvas doesn't let you
- try adding a tool using xml (examples at lti-examples.heroku.com)
that doesn't have url or domain, but does have a canvas lti
extension (any extension other than resource_selection)
- make sure canvas lets you
- this non-url non-domain tool shouldn't show up in the add modules list
- try adding a tool using xml (examples at lti-examples.heroku.com)
that doesn't have url or domain, but does have a canvas lti
extension (specifically resource_selection)
- make sure canvas lets you
- this non-url non-domain tool should show up in the add modules list
Change-Id: Ie575c52da610f41b1afe09fbd838b0fd0da39ff2
Reviewed-on: https://gerrit.instructure.com/10251
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
This is required for LTI conformance
Test Plan:
* Configure a tool as email only
* Launch a tool and verify name info isn't sent
Change-Id: I8d67fa6a8bef7e3ead0a01bd45834976b02e487f
Reviewed-on: https://gerrit.instructure.com/10801
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
* add the foreigner gem so plugins can begin adding foreign keys
immediately
* add an extension to do less locking when creating foreign keys
on postgres 9.1+
* fix a few pieces of code that either don't properly clean up
foreign dependencies, or create objects in the wrong order
to maintain referential integrity
* change the specs to truncate all tables in a single command
for postgres (to avoid referential integrity errors; also
slightly faster)
test plan:
* no user visible functionality should change
Change-Id: I185e478b99fbe598d408912053c34a064aa9c461
Reviewed-on: https://gerrit.instructure.com/10580
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
This is a somewhat significant change. Before, domain-matching
took precedence over url-matching, and account-level tools
took precedence over course-level tools. This didn't make sense
to any of us, but was based on what we thought was part of the
LTI spec.
Turns out it isn't part of the spec, so we're going to take
the opportunity to change the order or precedence to something
that makes sense to us, which is url before domain matching,
and course before account matching. The new code will start at
the course and work up looking for an exact URL match. If it
can't find one then it will start at the course and work up
looking for a domain match, and will use the first one it
comes across.
test plan:
- verify that the following precedence holds:
(you can use the fake lti tool included in canvas to
run these tests, "<canvasdomain>/selection_test" is the
URL to launch. The easiest way to test would be to set
a different consumer key for each tool).
1. course-level url matching
2. sub-account-level url matching
3. root account-level url matching
4. course-level domain matching
5. sub-account-level domain matching
6. root account-level domain matching
Change-Id: If58e055c605524f7a8ea9941c1b71dbcbd5ab816
Reviewed-on: https://gerrit.instructure.com/9913
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
The selective imports mostly worked before, but if a
given section was completely unchecked the previous
code would import it anyway. This fixes that and makes all
the decision code in one place and easy to test.
Test Plan:
* Import a content package and only choose certain items
* Only the items you chose should be imported
closes#5528
Change-Id: Ia6c0c1f5f9a44497053733101140cc74d6239129
Reviewed-on: https://gerrit.instructure.com/9799
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
This adds the ability for ContentMigration to copy courses
by exporting to a content package and then importing that
package. For attachments it just creates a new Attachment
object instead of exporting/importing them.
The course copy API did not change.
The endpoints used by the course copy UI did change and this
commit doesn't allow selective copying, it only has the
option to copy everything. Selective copying will come in
another commit.
There are also various bug fixes for export/import
Test Plan:
* copy a course through the API
* copy a course through the Content Imports path
* copy a course through the Copy Cours button on the course settings page
* export a course
refs #4645
Change-Id: Ie577329ab7caaea8dfb9359542224a1a2657e167
Reviewed-on: https://gerrit.instructure.com/9742
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
It's possible to have two external tools with all the
same configuration except for custom fields. In this case,
inserting two links, one to each tool configuration, would
have resulted in two launches of the same tool because
Canvas was only searching for the first match. This
commit adds an additional "preference" for the specified
tool, so Canvas doesn't just pick the first one, it tries
to pick the preferred one if there's nothing else
trumping that tool in precedence.
This does not fix the problem with having a tool's custom fields
overridden by a different tool that has higher precedence.
fixes#6797
test plan:
- add two external tools to a course with the same configuration
but different custom fields
- add a link to each tool in the course modules
- make sure the two links send over the correct custom fields,
those matching the tool that was picked when inserting the link
Change-Id: I8b037f169cfcfbfd9f9082a9dbec6fcee442edaa
Reviewed-on: https://gerrit.instructure.com/9025
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>
previously this would only work for course-level tools
fixes#6935
test plan:
- try adding a tool to an account by url configuration
- make sure it doesn't die
Change-Id: Id04a0619bd733d351098731cf2db67f8a26936dd
Reviewed-on: https://gerrit.instructure.com/8136
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
test plan:
- copy xml from http://lti-examples.heroku.com/config/editor_button
- go to course settings and start creating a new tool
- choose xml paste, and paste xml
- save the tool
- confirm the tool says "Editor button configured"
- load a WYSIWYG in the course, confirm the new editor button appears
- do the same thing but by URL instead of XML paste
- confirm that normal tool configurations still work correctly
Change-Id: I6bb53bde1986e9dda40488018e167bb626907453
Reviewed-on: https://gerrit.instructure.com/7527
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Test Plan:
* Create a tool with api
* Edit tool with api
* Get tool with api
* List tools with api
* Delete tool with api
* Etc., etc.
closes#6589
Change-Id: I3f1adc97937588534f8005574bd0278b6f03cbde
Reviewed-on: https://gerrit.instructure.com/7612
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Adding support for custom fields and canvas-specific
blti extensions to the common cartridge import/export
format.
test plan:
- create a new external tool
- make sure custom fields set are persisted correctly
- make sure changes to custom fields also work correctly
- make sure custom fields are correctly sent across to the tool
- example tool: http://www.imsglobal.org/developers/BLTI/tool.php
Change-Id: Iba42cc8876b0373bad71dc876e80f49e886f154b
Reviewed-on: https://gerrit.instructure.com/6468
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
In current BLTI there are two options for adding links:
- know the URL beforehand
- know a "naked" URL that can be associated with a resource
but not until after embed
Neither of these are great for the end-user. This commit
adds a third option, as discussed with some other users of
BLTI, where instead the user can click a link in the UI
to load an iframe where they can then find the specific
resource they want to embed. They never need to know
any URLs to make this happen.
to configure an external tool:
tool.settings = {
:resource_selection => {
:url => "http://<canvas_domain>/selection_test",
:text => <label>,
:selection_width => <iframe_width>,
:selection_height => <iframe_height>
}
}
test plan:
- configure an external tool on the course
- click to add an item to a course module
- select "external tools"
- pick the tool from the list
- select a link from the dialog
- make sure the link was inserted correctly
- try clicking the first "bad" link in the tool and confirm error is caught
- try clicking the second "bad" link in the tool and confirm error is caught
- try clicking the this "bad" link in the tool and confirm no errors occur
- make sure an account-level tool also appears
Change-Id: I47fd8461f1050c332e5cae32d9a3141a8de5b38d
Reviewed-on: https://gerrit.instructure.com/6326
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Whitmer <brian@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>
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 versioned the URI and removed the tool_id param. As part of the
processing it pulls the tool from the assignment and verifies that it's
the same tool as was used to launch, by looking at the sourcedid.
Assignments now have an external_tool type and link to a
ContextExternalTool.
testplan: there isn't a way in the UI to configure an assignment as an
external tool yet, so it'll need to be manually configured in the
console.
Change-Id: I0cf5ec85d450409d6ea1ec71ce1d5d4c19622d4c
Reviewed-on: https://gerrit.instructure.com/6652
Reviewed-by: Brian Whitmer <brian@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
Also had to change the export/importing of blti links
from canvas
refs #4153
Change-Id: Iae2d6e9c677d310d7e824fa78885c8aca2c1af83
Reviewed-on: https://gerrit.instructure.com/5703
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Basically, don't call a bazillion procs everytime you check_policy;
just the "given" statement. Everything else is evaluated just once,
and cached on the class. This does lose functionality (the ability
to access the instance inside of set_policy, and set methods), but
none of it was currently in use.
Change-Id: I736879d98beb4115a2e8c492931c755076291d08
Reviewed-on: https://gerrit.instructure.com/4665
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
started the framework for importing the canvas flavored
common cartridge packages. There is also some minor
refactoring of the export step to allow for easy testing
of both exporting and importing
course settings, assignment groups, and external tools
are imported and tested with this commit
refs #3396
Change-Id: I4e8a2ebfc9df7e31f8859b189fea23f9584d7ef4
Reviewed-on: https://gerrit.instructure.com/3042
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
- external tools can be added on the course/account
settings page
- external tools can be linked to from within modules
- clicking a tool in a module will load a new page
with the tool embedded in an iframe
- see context_external_tools for standard procedures
on retrieving settings for a specific link
fixes#4013
Change-Id: I8aa1934f8deac9af26d74036162b34fd1c4242e1
Reviewed-on: https://gerrit.instructure.com/2601
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>