Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes: #4967 - Wording of knowledge base permissions confusing.
- Loading branch information
Showing
4 changed files
with
101 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ | ||
|
||
class PermissionSettingWording < ActiveRecord::Migration[7.0] | ||
def change | ||
# return if it's a new setup | ||
return if !Setting.exists?(name: 'system_init_done') | ||
|
||
update_permissions | ||
update_settings | ||
end | ||
|
||
PERMISSIONS_TO_UPDATE = [ | ||
{ | ||
name: 'knowledge_base', | ||
note: 'Knowledge Base', | ||
}, | ||
{ | ||
name: 'knowledge_base.editor', | ||
note: 'Knowledge Base Editor', | ||
}, | ||
{ | ||
name: 'knowledge_base.reader', | ||
note: 'Knowledge Base Reader', | ||
}, | ||
{ | ||
name: 'ticket.customer', | ||
note: 'Access to customer tickets' | ||
} | ||
].freeze | ||
|
||
def update_permissions | ||
PERMISSIONS_TO_UPDATE.each do |perm_def| | ||
Permission.find_by(name: perm_def[:name])&.tap do |perm| | ||
perm.note = perm_def[:note] | ||
perm.preferences.delete('translations') | ||
perm.save! | ||
end | ||
end | ||
end | ||
|
||
SETTINGS_TO_UPDATE = [ | ||
{ | ||
title: 'Maximum Recursive Ticket Triggers Depth', | ||
name: 'ticket_trigger_recursive_max_loop', | ||
}, | ||
{ | ||
title: 'Enforce the setup of the two-factor authentication', | ||
name: 'two_factor_authentication_enforce_role_ids', | ||
description: 'Requires the setup of the two-factor authentication for certain user roles.', | ||
}, | ||
{ | ||
title: 'Additional notes for ticket create types.', | ||
name: 'ui_ticket_create_notes', | ||
description: 'Show additional notes for ticket creation depending on the selected type.', | ||
}, | ||
{ | ||
title: 'Storage Method', | ||
name: 'storage_provider', | ||
} | ||
].freeze | ||
|
||
def update_settings | ||
SETTINGS_TO_UPDATE.each do |setting_def| | ||
Setting.find_by(name: setting_def[:name])&.tap do |setting| | ||
setting.title = setting_def[:title] | ||
setting.description = setting_def[:description] if setting_def[:description] | ||
setting.save! | ||
end | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters