{"push_id":580847046,"size":1,"distinct_size":1,"ref":"refs/heads/master","head":"690aeb7c171009e545edcf23eca421d6c398298f","before":"d1b508676bf2713cdb09bed7145899728b102ac7","commits":[{"sha":"690aeb7c171009e545edcf23eca421d6c398298f","author":{"email":"7cc0890d6f1f70810a023e7173eca5724d6c8e49@instructure.com","name":"Spencer Olson"},"message":"set up permissions for grading periods\n\ncloses CNVS-18438\n\ntest plan:\n  1. create a root-account, a sub-account (belonging to the root-account),\n    and a course belonging to the root-account (not belonging to the\n    sub-account). Create an admin for your root-account and an admin for\n    your sub-account, and a teacher and student for your course.\n  2. create grading periods for the root-account, sub-account,\n    and course. For the example below i'm using the ids 1, 5, and 10\n    for the account, sub-account, and course, respectively.\n    In rails console:\n    $ root_gp_group = Account.find(1).grading_period_groups.create!\n    $ sub_gp_group = Account.find(5).grading_period_groups.create!\n    $ course_gp_group = Course.find(10).grading_period_groups.create!\n    $ root_gp = root_gp_group.grading_periods.create!(\n        start_date: Time.now, end_date: 2.days.from_now, weight: 0.50)\n    $ sub_gp = sub_gp_group.grading_periods.create!(\n        start_date: Time.now, end_date: 2.days.from_now, weight: 0.50)\n    $ course_gp = root_gp_group.grading_periods.create!(\n        start_date: Time.now, end_date: 2.days.from_now, weight: 0.50)\n  3. check the permissions for your root-admin, sub-admin, teacher,\n    and student (while still in rails console). example below assumes\n    root-admin, sub-admin, teacher, and student ids are 100, 200, 300,\n    and 400 respectively.\n    $ root_admin = User.find(100)\n    $ sub_admin = User.find(200)\n    $ teacher = User.find(300)\n    $ student = User.find(400)\n    $ root_gp.rights_status(root_admin, :read, :manage)\n        -- should return {read: true, manage: true}\n    $ root_gp.rights_status(sub_admin, :read, :manage)\n        -- should return {read: true, manage: false}\n    $ root_gp.rights_status(teacher, :read, :manage)\n        -- should return {read: true, manage: false}\n    $ root_gp.rights_status(student, :read, :manage)\n        -- should return {read: true, manage: false}\n    $ sub_gp.rights_status(root_admin, :read, :manage)\n        -- should return {read: true, manage: true}\n    $ sub_gp.rights_status(sub_admin, :read, :manage)\n        -- should return {read: true, manage: true}\n    $ sub_gp.rights_status(teacher, :read, :manage)\n        -- should return {read: false, manage: false}\n    $ sub_gp.rights_status(student, :read, :manage)\n        -- should return {read: false, manage: false}\n    $ course_gp.rights_status(root_admin, :read, :manage)\n        -- should return {read: true, manage: true}\n    $ course_gp.rights_status(sub_admin, :read, :manage)\n        -- should return {read: false, manage: false}\n    $ course_gp.rights_status(teacher, :read, :manage)\n        -- should return {read: true, manage: true}\n    $ course_gp.rights_status(student, :read, :manage)\n        -- should return {read: true, manage: false}\n\nChange-Id: Ib5262ebcaa0554096ac9ddaacab017d45717bea6\nReviewed-on: https://gerrit.instructure.com/48524\nTested-by: Jenkins\nReviewed-by: Cameron Sutter <csutter@instructure.com>\nQA-Review: Amber Taniuchi <amber@instructure.com>\nProduct-Review: Spencer Olson <solson@instructure.com>","distinct":true,"url":"https://api.github.com/repos/instructure/canvas-lms/commits/690aeb7c171009e545edcf23eca421d6c398298f"}]}