canvas-lms/spec
Jackson Howe 6a0869a22a Use granular permissions in selective release
Gate the learning object dates api according to new permissions, and
only render the assign to buttons & UI if the appropriate permissions
are present. This commit works by adding a policy called
:manage_assign_to to each learning object model which checks the
appropriate course permissions/ conditions. Then in various parts
throughout the UI, we can simply call `object.grants_right?(user,
:manage_assign_to)` anywhere where we're checking the ability to edit
an existing learning object's assign to settings.

To change a module's assign to settings, require the "Course content -
edit" permission.

For existing learning objects, changing assign to settings requires the
following permissions:
- assignments -> "Manage Assignments and Quizzes - edit"
- quizzes -> "Manage Assignments and Quizzes - edit"
- graded discussions -> "Discussions - moderate" and "Manage Assignments
  and Quizzes - edit"
- ungraded discussions -> "Discussions - moderate" and either a course
  admin enrollment or an enrollment that's not section restricted
- pages -> "Pages - update"

For new learning objects, we require the following permissions on the
object's create page:
- assignments -> "Manage Assignments and Quizzes - add"
- quizzes -> "Manage Assignments and Quizzes - add"
- graded discussions -> "Discussions - create" and "Manage Assignments
  and Quizzes - add"
- ungraded discussions -> "Discussions - create" and either a course
  admin enrollment or an enrollment that's not section restricted
- pages -> "Pages - update"

The "Discussions - moderate" permission can be granted to students, so
if the user does not have an admin enrollment in the course, we verify
that the student's enrollment is not section-restricted before allowing
them to edit a discussion's assign to settings. Thus, students with
"Discussions - moderate" permissions and a section-restricted
enrollment can not use the assign to tray and can no longer
differentiate a discussion by section.

closes LX-1694
flag = differentiated_modules
[fsc-max-nodes=20]
[fsc-timeout=40]

Test plan:
Visit each of the following locations as a teacher and verify that you
can access the "Assign To" UI. Then disable the associated permission
for the teacher and verify that you can no longer access the "Assign
To" UI. Note that you may need to clear your cache and restart Canvas
after toggling permissions.
 - assignments (show, index, edit, create, module items) - note that
   the index can show quiz and graded discussion items, and these
   items' assign to buttons should be gated by their respective
   permissions
 - quizzes (show, index, edit, create, module items)
 - graded discussions (show, index, edit, create, module items)
 - ungraded discussions (show, index, edit, create, module items) -
   test this as a student as well
 - pages (show, index, edit, create, module items)
 - modules (index) - both the menu option and "View Assign To"
   button should be gated

Change-Id: I19bdb24c16a4bc77b993a55be4d9536904c6441f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/348755
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Robin Kuss <rkuss@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Jackson Howe <jackson.howe@instructure.com>
2024-06-04 17:08:18 +00:00
..
apis Use granular permissions in selective release 2024-06-04 17:08:18 +00:00
coffeescripts Use granular permissions in selective release 2024-06-04 17:08:18 +00:00
contracts Remove Canvas Outcome Pact Tests 2023-11-29 18:00:03 +00:00
controllers Use granular permissions in selective release 2024-06-04 17:08:18 +00:00
factories Data fix up for broken links from LF-203 2024-05-31 20:32:55 +00:00
factory_bot rubocop: FactoryBot 2024-03-01 22:27:49 +00:00
fixtures rails 7.1: use fixture_file helper 2024-02-20 17:51:31 +00:00
formatters update rubocop, and apply new cops 2023-07-03 22:11:42 +00:00
gem_integration/canvas_connect
graphql Add 'Assign To' tray for ungraded discussion on edit page 2024-06-03 21:21:33 +00:00
helpers export New Quizzes in common cartridges even if NQ is not enabled 2024-05-31 14:19:51 +00:00
initializers spec: fix timebomb with partitions 2024-03-22 16:42:36 +00:00
integration unify SpeedGrader text 2024-05-29 18:41:43 +00:00
javascripts Change Hidden Assignments GB Warning 2024-06-03 19:45:02 +00:00
lib Data fix up for broken links from LF-203 2024-05-31 20:32:55 +00:00
manual_seeding unify SpeedGrader text 2024-05-29 18:41:43 +00:00
messages spec: Add test for checkpoints created notification. 2024-05-01 18:14:34 +00:00
migrations squash old migrations 202308 2024-03-08 20:36:11 +00:00
models Use granular permissions in selective release 2024-06-04 17:08:18 +00:00
observers Push content_export_created live event from Canvas 2024-02-16 18:03:54 +00:00
openapi/lti spec: Update schema definitions for recent changes 2024-02-01 23:40:01 +00:00
presenters round pointsBased scores to 2 decimal places 2024-06-03 15:52:24 +00:00
requests bundle update rubocop 2023-10-27 17:05:57 +00:00
schemas/lti rubocop: prep for updating rubocop-rspec 2023-04-12 19:30:10 +00:00
selenium Use granular permissions in selective release 2024-06-04 17:08:18 +00:00
serializers Use granular permissions in selective release 2024-06-04 17:08:18 +00:00
services move SQL from ModuleStudentVisibility view to rails 2024-05-31 18:10:50 +00:00
shared_examples bundle update rubocop 2024-01-24 16:17:43 +00:00
support bundle update rubocop 2024-05-30 16:20:52 +00:00
views unify SpeedGrader text 2024-05-29 18:41:43 +00:00
.eslintrc
.rspec_parallel
ams_spec_helper.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
broadcast_integration.rb
canvas_simplecov.rb
cassandra_spec_helper.rb
conditional_release_spec_helper.rb rubocop: FactoryBot 2024-03-01 22:27:49 +00:00
coverage_tool.rb
factories.rb bundle update rubocop-performance, rubocop-rails 2023-12-18 20:28:02 +00:00
factory_bot_spec_helper.rb
feature_flag_helper.rb
file_upload_helper.rb
force_failure_spec.rb
import_helper.rb remove unused Course#import_source attr_accessor 2024-02-02 18:06:19 +00:00
jspec.sh
lti2_course_spec_helper.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
lti2_spec_helper.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
lti_1_3_spec_helper.rb sync DeveloperKey and Lti::Registration on save 2024-05-28 22:05:02 +00:00
lti_1_3_tool_configuration_spec_helper.rb Lock down submission_type_selection placement 2024-03-07 13:58:16 +00:00
lti_spec_helper.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
outcome_alignments_spec_helper.rb Update GraphQL Alignment loader to return aligned items 2023-05-11 15:57:34 +00:00
plagiarism_platform_spec_helper.rb bump rubocop gems and apply changes 2023-08-07 20:13:35 +00:00
quiz_spec_helper.rb
rcov.opts
rspec_mock_extensions.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
sharding_spec_helper.rb
simple_cov_result_merger.rb
spec.opts
spec_helper.rb bundle update rubocop 2024-05-30 16:20:52 +00:00