canvas-lms/db/migrate/20191210021541_populate_mod...

27 lines
925 B
Ruby
Raw Normal View History

# frozen_string_literal: true
eportfolios: add 'mark as spam' button for admins flag=eportfolio_moderation closes TALLY-379 Adds the "moderate user content" admin permission, and also adds buttons that allow admins to mark content as spam or safe. For purposes below, the word "admin" means any administrator with the "moderate user content" permission granted in an account that the eportfolio's user belongs to. For eportfolios flagged as possible spam, adds 'Mark as safe' and 'Confirm as spam' buttons for admins. For eportfolios marked as safe, adds a 'Mark as spam' button for admins. For eportfolios marked as spam, adds a 'Mark as safe' button for admins. Test Plan: 1. Enable the "ePortfolio Moderation" release flag 2. ePortfolio with spam_status "flagged_as_possible_spam" - the author can view the eportfolio, but cannot update any content on the eportfolio. - admins with the "moderate user content" permission can view the eportfolio and "Confirm as spam" or "Mark as safe". - admins without the "moderate user content" permission cannot view the eportfolio. - all other users cannot view the eportfolio. 3. ePortfolio with spam_status "marked_as_spam" - the author can view the eportfolio, but cannot update any content on the eportfolio. - admins with the "moderate user content" permission can view the eportfolio and "Mark as safe". - admins without the "moderate user content" permission cannot view the eportfolio. - all other users cannot view the eportfolio. 4. ePortfolio with spam_status "marked_as_safe" or nil - the author can view the eportfolio and update content on it. - admins with the "moderate user content" permission can view the eportfolio and "Mark as spam". - admins without the "moderate user content" permission can view the eportfolio but cannot "Mark as spam". - all other users can view the eportfolio. 5. Disable the "ePortfolio Moderation" release flag. Verify that all eportfolio behavior is reverted back to the behavior prior to this commit. Change-Id: I3803114890348b1f9167932f5337868a37ac3adf Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/220153 QA-Review: Robin Kuss <rkuss@instructure.com> Product-Review: Jonathan Fenton <jfenton@instructure.com> Tested-by: Jenkins Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Adrian Packel <apackel@instructure.com> Reviewed-by: Keith Garner <kgarner@instructure.com>
2019-12-10 08:27:51 +08:00
#
# Copyright (C) 2019 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
class PopulateModerateUserContentPermission < ActiveRecord::Migration[5.2]
tag :predeploy
def up
DataFixup::AddRoleOverridesForNewPermission.run(:manage_account_settings, :moderate_user_content)
end
end