Skip to content

Commit

Permalink
Fixes: #4967 - Wording of knowledge base permissions confusing.
Browse files Browse the repository at this point in the history
  • Loading branch information
mgruner committed Mar 20, 2024
1 parent 0004f9d commit 3f1023f
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 34 deletions.
72 changes: 72 additions & 0 deletions db/migrate/20240320092523_permission_setting_wording.rb
@@ -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
19 changes: 7 additions & 12 deletions db/seeds/permissions.rb
Expand Up @@ -434,7 +434,7 @@
)
Permission.create_if_not_exists(
name: 'ticket.customer',
note: __('Access to Customer Tickets based on current_user and organization'),
note: __('Access to customer tickets'),
preferences: {},
allow_signup: true,
)
Expand Down Expand Up @@ -478,27 +478,22 @@

Permission.create_if_not_exists(
name: 'knowledge_base',
note: __('Manage %s'),
note: __('Knowledge Base'),
preferences: {
translations: [__('Knowledge Base')],
disabled: true,
disabled: true,
}
)

Permission.create_if_not_exists(
name: 'knowledge_base.editor',
note: __('Manage %s'),
preferences: {
translations: [__('Knowledge Base Editor')]
}
note: __('Knowledge Base Editor'),
preferences: {}
)

Permission.create_if_not_exists(
name: 'knowledge_base.reader',
note: __('Manage %s'),
preferences: {
translations: [__('Knowledge Base Reader')]
},
note: __('Knowledge Base Reader'),
preferences: {},
allow_signup: true,
)

Expand Down
12 changes: 6 additions & 6 deletions db/seeds/settings.rb
Expand Up @@ -338,7 +338,7 @@
)

Setting.create_if_not_exists(
title: __('Storage Mechanism'),
title: __('Storage Method'),
name: 'storage_provider',
area: 'System::Storage',
description: __('"Database" stores all attachments in the database (not recommended for storing large amounts of data). "Filesystem" stores the data in the filesystem. "Simple Storage (S3)" stores the data in a remote S3 compatible object filesystem. You can switch between the modules even on a system that is already in production without any loss of data.'),
Expand Down Expand Up @@ -845,10 +845,10 @@
)

Setting.create_if_not_exists(
title: __('Set notes for ticket create types.'),
title: __('Additional notes for ticket create types.'),
name: 'ui_ticket_create_notes',
area: 'UI::TicketCreate',
description: __('Set notes for ticket create types by selecting type.'),
description: __('Show additional notes for ticket creation depending on the selected type.'),
options: {},
state: {
# 'email-out' => __('Attention: When creating a ticket an email is sent.'),
Expand Down Expand Up @@ -2775,7 +2775,7 @@
frontend: false
)
Setting.create_if_not_exists(
title: __('Recursive Ticket Triggers Loop Max.'),
title: __('Maximum Recursive Ticket Triggers Depth'),
name: 'ticket_trigger_recursive_max_loop',
area: 'Ticket::Core',
description: __('Maximum number of recursively executed triggers.'),
Expand Down Expand Up @@ -5713,10 +5713,10 @@
)

Setting.create_if_not_exists(
title: __('Enforce the set up of the two-factor authentication'),
title: __('Enforce the setup of the two-factor authentication'),
name: 'two_factor_authentication_enforce_role_ids',
area: 'Security::TwoFactorAuthentication',
description: __('Requires the set up of the two-factor authentication for certain user roles.'),
description: __('Requires the setup of the two-factor authentication for certain user roles.'),
options: {
form: [
{
Expand Down
32 changes: 16 additions & 16 deletions i18n/zammad.pot
Expand Up @@ -627,7 +627,7 @@ msgid "Access to Agent Tickets based on Group Access"
msgstr ""

#: db/seeds/permissions.rb
msgid "Access to Customer Tickets based on current_user and organization"
msgid "Access to customer tickets"
msgstr ""

#: app/assets/javascripts/app/views/whatsapp/account_cloud_api.jst.eco
Expand Down Expand Up @@ -984,6 +984,10 @@ msgstr ""
msgid "Additional information and links"
msgstr ""

#: db/seeds/settings.rb
msgid "Additional notes for ticket create types."
msgstr ""

#: db/seeds/object_manager_attributes.rb
msgid "Address"
msgstr ""
Expand Down Expand Up @@ -5079,7 +5083,7 @@ msgid "Endpoint Settings"
msgstr ""

#: db/seeds/settings.rb
msgid "Enforce the set up of the two-factor authentication"
msgid "Enforce the setup of the two-factor authentication"
msgstr ""

#: db/seeds/settings.rb
Expand Down Expand Up @@ -7692,6 +7696,10 @@ msgstr ""
msgid "Maximum Email Size"
msgstr ""

#: db/seeds/settings.rb
msgid "Maximum Recursive Ticket Triggers Depth"
msgstr ""

#: db/seeds/settings.rb
msgid "Maximum failed logins"
msgstr ""
Expand Down Expand Up @@ -9893,10 +9901,6 @@ msgstr ""
msgid "Recursive Ticket Triggers"
msgstr ""

#: db/seeds/settings.rb
msgid "Recursive Ticket Triggers Loop Max."
msgstr ""

#: db/seeds/settings.rb
msgid "References - Search for follow-up also in In-Reply-To or References headers."
msgstr ""
Expand Down Expand Up @@ -10130,7 +10134,7 @@ msgid "Requirements"
msgstr ""

#: db/seeds/settings.rb
msgid "Requires the set up of the two-factor authentication for certain user roles."
msgid "Requires the setup of the two-factor authentication for certain user roles."
msgstr ""

#: app/assets/javascripts/app/controllers/_plugin/user_signup_check.coffee
Expand Down Expand Up @@ -11005,14 +11009,6 @@ msgstr ""
msgid "Set default for new tickets"
msgstr ""

#: db/seeds/settings.rb
msgid "Set notes for ticket create types by selecting type."
msgstr ""

#: db/seeds/settings.rb
msgid "Set notes for ticket create types."
msgstr ""

#: app/assets/javascripts/app/views/integration/cti.jst.eco
#: app/assets/javascripts/app/views/integration/placetel.jst.eco
#: app/assets/javascripts/app/views/integration/sipgate.jst.eco
Expand Down Expand Up @@ -11133,6 +11129,10 @@ msgstr ""
msgid "Show Search Details"
msgstr ""

#: db/seeds/settings.rb
msgid "Show additional notes for ticket creation depending on the selected type."
msgstr ""

#: app/assets/javascripts/app/views/generic/ticket_list.jst.eco
#: app/assets/javascripts/app/views/widget/ticket_stats_list.jst.eco
msgid "Show all…"
Expand Down Expand Up @@ -11621,7 +11621,7 @@ msgid "Storage"
msgstr ""

#: db/seeds/settings.rb
msgid "Storage Mechanism"
msgid "Storage Method"
msgstr ""

#: app/assets/javascripts/app/views/package.jst.eco
Expand Down

0 comments on commit 3f1023f

Please sign in to comment.