canvas-lms/spec/selenium
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
..
a11y_and_i18n skip fickle test in i18n_js_spec.rb 2024-02-02 00:45:45 +00:00
add_people add TopNavigationTools 2024-05-30 18:14:38 +00:00
admin Add copy/duplicate functionality for Global Announcements 2024-05-30 06:59:59 +00:00
announcements Add SimpleSelect from InstUI replacing native one. 2024-05-27 08:29:10 +00:00
assignments Use granular permissions in selective release 2024-06-04 17:08:18 +00:00
assignments_v2 modify A2 assignment page for ICE initiative 2023-12-14 15:37:42 +00:00
authorization update rubocop, and apply new cops 2023-07-03 22:11:42 +00:00
browser_operations spec: add a test for moment/locale bundles 2024-02-29 19:00:04 +00:00
calendar fix timebombs 2024-04-12 13:39:58 +00:00
client_apps RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
collaborations handle masqueradors in /collaborations 2023-02-13 17:15:27 +00:00
conditional_release Remove the mastery paths checkbox 2024-05-20 22:16:10 +00:00
conferences spec: fix checkbox click selector 2024-03-06 23:49:54 +00:00
content_migrations Bump InstUI to 8.49 for new nav bar stuff 2023-11-29 03:56:33 +00:00
context_modules Use granular permissions in selective release 2024-06-04 17:08:18 +00:00
conversations add totalRecipients to observer object 2024-03-21 16:22:21 +00:00
course_paces Upgrade Canvas to InstUI version 8 (second try) 2023-10-06 03:07:44 +00:00
course_wiki_pages Use granular permissions in selective release 2024-06-04 17:08:18 +00:00
courses Sortable User Course List 2024-05-29 17:42:41 +00:00
dashboard add TopNavigationTools 2024-05-30 18:14:38 +00:00
differentiated_assignments allow viewing deactivated students in speedgrader 2023-08-16 22:35:08 +00:00
discussions Use granular permissions in selective release 2024-06-04 17:08:18 +00:00
enrollment update acceptance use policy to be an actual link 2022-03-25 15:03:58 +00:00
files update spec for react 18 2024-05-03 20:19:35 +00:00
grades add TopNavigationTools 2024-05-30 18:14:38 +00:00
graphiql bump graphiql to v1.7.2 2024-04-16 18:16:00 +00:00
groups spec updates for react18 2024-05-21 11:35:19 +00:00
helpers Replace buttons with dropdown on user profile 2024-05-30 18:17:02 +00:00
master_courses add TopNavigationTools 2024-05-30 18:14:38 +00:00
miscellaneous fix: followup label change with selenium test 2024-06-04 12:13:43 +00:00
navigation fix hover persistence on sidenav 2024-05-29 18:33:57 +00:00
offline_contents RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
outcomes Fix aggregate calculation menu in LMGB 2024-03-28 21:14:09 +00:00
people fix showing resend invite based on permissions 2024-03-06 17:03:17 +00:00
performance/grades unify SpeedGrader text 2024-05-29 18:41:43 +00:00
plugins remove unused LinkedIn gem 2023-08-28 15:59:01 +00:00
profile Add sticky footer to account and course. 2024-05-24 13:00:59 +00:00
quizzes Use granular permissions in selective release 2024-06-04 17:08:18 +00:00
rcs Store preferred HTML editor in localstorage 2024-04-12 17:14:00 +00:00
sections Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
shared_components spec: update context modules to reduce time 2022-03-08 15:06:02 +00:00
sis Add sticky footer to account and course. 2024-05-24 13:00:59 +00:00
syllabus Fix selenium specs for syllabus edit button 2023-09-06 22:11:26 +00:00
test_setup add TopNavigationTools 2024-05-30 18:14:38 +00:00
wiki Get enhanced user content translated correctly 2024-05-02 18:52:50 +00:00
common.rb remove unnecessary pre-loading of graphql schema 2024-04-15 20:48:28 +00:00
force_failure_spec.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00