From e972d0be89981698e09f4ee0090b414fdbcb5247 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Tue, 27 Oct 2020 15:05:10 +0100 Subject: [PATCH] Follow up - db3f553140ef506f8d31815ec08651187a3a6e4f - Fixes #3215 - Renamed Office365 to Microsoft365. --- .rubocop/todo.rspec.yml | 10 ++-- .rubocop/todo.yml | 14 ++--- .../app/controllers/_channel/email.coffee | 6 +- .../{office365.coffee => microsoft365.coffee} | 60 +++++++++---------- .../app/models/email_address.coffee | 2 +- .../channel/email_account_overview.jst.eco | 4 +- .../app_config.jst.eco | 4 +- .../app/views/microsoft365/index.jst.eco | 12 ++++ .../{office365 => microsoft365}/list.jst.eco | 2 +- .../app/views/office365/index.jst.eco | 12 ---- ...rb => channels_microsoft365_controller.rb} | 20 +++---- ...ap_authentication_migration_cleanup_job.rb | 2 +- app/models/channel/driver/imap.rb | 2 +- ...channels_microsoft365_controller_policy.rb | 3 + .../channels_office365_controller_policy.rb | 3 - config/routes/microsoft365.rb | 12 ++++ config/routes/office365.rb | 12 ---- .../{office365.rb => microsoft365.rb} | 20 +++---- ...office365_spec.rb => microsoft365_spec.rb} | 12 ++-- ...office365_spec.rb => microsoft365_spec.rb} | 24 ++++---- 20 files changed, 118 insertions(+), 118 deletions(-) rename app/assets/javascripts/app/controllers/_channel/{office365.coffee => microsoft365.coffee} (85%) rename app/assets/javascripts/app/views/{office365 => microsoft365}/app_config.jst.eco (87%) create mode 100644 app/assets/javascripts/app/views/microsoft365/index.jst.eco rename app/assets/javascripts/app/views/{office365 => microsoft365}/list.jst.eco (98%) delete mode 100644 app/assets/javascripts/app/views/office365/index.jst.eco rename app/controllers/{channels_office365_controller.rb => channels_microsoft365_controller.rb} (77%) create mode 100644 app/policies/controllers/channels_microsoft365_controller_policy.rb delete mode 100644 app/policies/controllers/channels_office365_controller_policy.rb create mode 100644 config/routes/microsoft365.rb delete mode 100644 config/routes/office365.rb rename lib/external_credential/{office365.rb => microsoft365.rb} (91%) rename spec/lib/external_credential/{office365_spec.rb => microsoft365_spec.rb} (94%) rename spec/requests/integration/{office365_spec.rb => microsoft365_spec.rb} (69%) diff --git a/.rubocop/todo.rspec.yml b/.rubocop/todo.rspec.yml index 43b2234b7..9333c5f17 100644 --- a/.rubocop/todo.rspec.yml +++ b/.rubocop/todo.rspec.yml @@ -43,7 +43,7 @@ RSpec/ContextWording: - 'spec/lib/auth_spec.rb' - 'spec/lib/core_ext/string_spec.rb' - 'spec/lib/external_credential/google_spec.rb' - - 'spec/lib/external_credential/office365_spec.rb' + - 'spec/lib/external_credential/microsoft365_spec.rb' - 'spec/lib/html_sanitizer_spec.rb' - 'spec/lib/import/exchange/folder_spec.rb' - 'spec/lib/import/helper_spec.rb' @@ -145,7 +145,7 @@ RSpec/ContextWording: - 'spec/requests/external_credentials_spec.rb' - 'spec/requests/integration/check_mk_spec.rb' - 'spec/requests/integration/gmail_spec.rb' - - 'spec/requests/integration/office365_spec.rb' + - 'spec/requests/integration/microsoft365_spec.rb' - 'spec/requests/integration/object_manager_attributes_spec.rb' - 'spec/requests/integration/smime_spec.rb' - 'spec/requests/knowledge_base/attachments_spec.rb' @@ -180,7 +180,7 @@ RSpec/ExampleLength: - 'spec/lib/auto_wizard_spec.rb' - 'spec/lib/core_ext/string_spec.rb' - 'spec/lib/external_credential/google_spec.rb' - - 'spec/lib/external_credential/office365_spec.rb' + - 'spec/lib/external_credential/microsoft365_spec.rb' - 'spec/lib/external_sync_spec.rb' - 'spec/lib/import/import_job_backend_examples.rb' - 'spec/lib/import/ldap_spec.rb' @@ -360,7 +360,7 @@ RSpec/LetSetup: - 'spec/jobs/communicate_twitter_job_spec.rb' - 'spec/jobs/ticket_online_notification_seen_job_spec.rb' - 'spec/lib/external_credential/google_spec.rb' - - 'spec/lib/external_credential/office365_spec.rb' + - 'spec/lib/external_credential/microsoft365_spec.rb' - 'spec/lib/secure_mailing/smime_spec.rb' - 'spec/lib/sessions/backend/ticket_overview_list_spec.rb' - 'spec/models/channel/driver/twitter_spec.rb' @@ -619,7 +619,7 @@ RSpec/NestedGroups: - 'spec/lib/core_ext/string_spec.rb' - 'spec/lib/email_address_validation_spec.rb' - 'spec/lib/external_credential/google_spec.rb' - - 'spec/lib/external_credential/office365_spec.rb' + - 'spec/lib/external_credential/microsoft365_spec.rb' - 'spec/lib/html_sanitizer_spec.rb' - 'spec/lib/import/exchange/folder_spec.rb' - 'spec/lib/notification_factory/mailer_spec.rb' diff --git a/.rubocop/todo.yml b/.rubocop/todo.yml index 351639f77..b4afbc8ea 100644 --- a/.rubocop/todo.yml +++ b/.rubocop/todo.yml @@ -26,7 +26,7 @@ Metrics/AbcSize: - 'app/controllers/attachments_controller.rb' - 'app/controllers/channels_email_controller.rb' - 'app/controllers/channels_google_controller.rb' - - 'app/controllers/channels_office365_controller.rb' + - 'app/controllers/channels_microsoft365_controller.rb' - 'app/controllers/channels_sms_controller.rb' - 'app/controllers/channels_telegram_controller.rb' - 'app/controllers/channels_twitter_controller.rb' @@ -275,7 +275,7 @@ Metrics/AbcSize: - 'lib/excel_sheet/ticket.rb' - 'lib/external_credential/facebook.rb' - 'lib/external_credential/google.rb' - - 'lib/external_credential/office365.rb' + - 'lib/external_credential/microsoft365.rb' - 'lib/external_credential/twitter.rb' - 'lib/facebook.rb' - 'lib/fill_db.rb' @@ -458,7 +458,7 @@ Metrics/CyclomaticComplexity: - 'app/controllers/application_controller/renders_models.rb' - 'app/controllers/channels_email_controller.rb' - 'app/controllers/channels_google_controller.rb' - - 'app/controllers/channels_office365_controller.rb' + - 'app/controllers/channels_microsoft365_controller.rb' - 'app/controllers/channels_twitter_controller.rb' - 'app/controllers/concerns/checks_user_attributes_by_current_user_permission.rb' - 'app/controllers/concerns/creates_ticket_articles.rb' @@ -616,7 +616,7 @@ Metrics/CyclomaticComplexity: - 'lib/excel_sheet.rb' - 'lib/external_credential/facebook.rb' - 'lib/external_credential/google.rb' - - 'lib/external_credential/office365.rb' + - 'lib/external_credential/microsoft365.rb' - 'lib/external_credential/twitter.rb' - 'lib/facebook.rb' - 'lib/fill_db.rb' @@ -697,7 +697,7 @@ Metrics/PerceivedComplexity: - 'app/controllers/application_controller/logs_http_access.rb' - 'app/controllers/channels_email_controller.rb' - 'app/controllers/channels_google_controller.rb' - - 'app/controllers/channels_office365_controller.rb' + - 'app/controllers/channels_microsoft365_controller.rb' - 'app/controllers/concerns/creates_ticket_articles.rb' - 'app/controllers/first_steps_controller.rb' - 'app/controllers/form_controller.rb' @@ -842,7 +842,7 @@ Metrics/PerceivedComplexity: - 'lib/excel_sheet.rb' - 'lib/external_credential/facebook.rb' - 'lib/external_credential/google.rb' - - 'lib/external_credential/office365.rb' + - 'lib/external_credential/microsoft365.rb' - 'lib/external_credential/twitter.rb' - 'lib/facebook.rb' - 'lib/fill_db.rb' @@ -940,7 +940,7 @@ Style/OptionalBooleanParameter: - 'lib/core_ext/string.rb' - 'lib/external_credential/facebook.rb' - 'lib/external_credential/google.rb' - - 'lib/external_credential/office365.rb' + - 'lib/external_credential/microsoft365.rb' - 'lib/external_credential/twitter.rb' - 'lib/html_sanitizer.rb' - 'lib/models.rb' diff --git a/app/assets/javascripts/app/controllers/_channel/email.coffee b/app/assets/javascripts/app/controllers/_channel/email.coffee index 2c55b286c..b6718e81c 100644 --- a/app/assets/javascripts/app/controllers/_channel/email.coffee +++ b/app/assets/javascripts/app/controllers/_channel/email.coffee @@ -188,7 +188,7 @@ class App.ChannelEmailAccountOverview extends App.Controller 'click .js-emailAddressDelete': 'emailAddressDelete', 'click .js-editNotificationOutbound': 'editNotificationOutbound' 'click .js-migrateGoogleMail': 'migrateGoogleMail' - 'click .js-migrateOffice365Mail': 'migrateOffice365Mail' + 'click .js-migrateMicrosoft365Mail': 'migrateMicrosoft365Mail' constructor: -> super @@ -386,10 +386,10 @@ class App.ChannelEmailAccountOverview extends App.Controller id = $(e.target).closest('.action').data('id') @navigate "#channels/google/#{id}" - migrateOffice365Mail: (e) => + migrateMicrosoft365Mail: (e) => e.preventDefault() id = $(e.target).closest('.action').data('id') - @navigate "#channels/office365/#{id}" + @navigate "#channels/microsoft365/#{id}" class App.ChannelEmailEdit extends App.ControllerModal buttonClose: true diff --git a/app/assets/javascripts/app/controllers/_channel/office365.coffee b/app/assets/javascripts/app/controllers/_channel/microsoft365.coffee similarity index 85% rename from app/assets/javascripts/app/controllers/_channel/office365.coffee rename to app/assets/javascripts/app/controllers/_channel/microsoft365.coffee index 6525c63fe..4bb97bd69 100644 --- a/app/assets/javascripts/app/controllers/_channel/office365.coffee +++ b/app/assets/javascripts/app/controllers/_channel/microsoft365.coffee @@ -1,10 +1,10 @@ -class App.ChannelOffice365 extends App.ControllerTabs - requiredPermission: 'admin.channel_office365' - header: 'Office 365' +class App.ChannelMicrosoft365 extends App.ControllerTabs + requiredPermission: 'admin.channel_microsoft365' + header: 'Microsoft 365' constructor: -> super - @title 'Office 365', true + @title 'Microsoft 365', true @tabs = [ { @@ -33,7 +33,7 @@ class App.ChannelOffice365 extends App.ControllerTabs @render() class ChannelAccountOverview extends App.ControllerSubContent - requiredPermission: 'admin.channel_office365' + requiredPermission: 'admin.channel_microsoft365' events: 'click .js-new': 'new' 'click .js-delete': 'delete' @@ -56,13 +56,13 @@ class ChannelAccountOverview extends App.ControllerSubContent load: (reset_channel_id = false) => if reset_channel_id @channel_id = undefined - @navigate '#channels/office365' + @navigate '#channels/microsoft365' @startLoading() @ajax( - id: 'office365_index' + id: 'microsoft365_index' type: 'GET' - url: "#{@apiPath}/channels_office365" + url: "#{@apiPath}/channels_microsoft365" processData: true success: (data, status, xhr) => @stopLoading() @@ -73,10 +73,10 @@ class ChannelAccountOverview extends App.ControllerSubContent render: (data) => - # if no office365 app is registered, show intro - external_credential = App.ExternalCredential.findByAttribute('name', 'office365') + # if no microsoft365 app is registered, show intro + external_credential = App.ExternalCredential.findByAttribute('name', 'microsoft365') if !external_credential - @html App.view('office365/index')() + @html App.view('microsoft365/index')() if @channel_id @configApp() return @@ -104,7 +104,7 @@ class ChannelAccountOverview extends App.ControllerSubContent for email_address_id in data.not_used_email_address_ids not_used_email_addresses.push App.EmailAddress.find(email_address_id) - @html App.view('office365/list')( + @html App.view('microsoft365/list')( channels: channels external_credential: external_credential not_used_email_addresses: not_used_email_addresses @@ -129,7 +129,7 @@ class ChannelAccountOverview extends App.ControllerSubContent ) new: (e) -> - window.location.href = "#{@apiPath}/external_credentials/office365/link_account" + window.location.href = "#{@apiPath}/external_credentials/microsoft365/link_account" delete: (e) => e.preventDefault() @@ -138,9 +138,9 @@ class ChannelAccountOverview extends App.ControllerSubContent message: 'Sure?' callback: => @ajax( - id: 'office365_delete' + id: 'microsoft365_delete' type: 'DELETE' - url: "#{@apiPath}/channels_office365" + url: "#{@apiPath}/channels_microsoft365" data: JSON.stringify(id: id) processData: true success: => @@ -153,9 +153,9 @@ class ChannelAccountOverview extends App.ControllerSubContent e.preventDefault() id = $(e.target).closest('.action').data('id') @ajax( - id: 'office365_disable' + id: 'microsoft365_disable' type: 'POST' - url: "#{@apiPath}/channels_office365_disable" + url: "#{@apiPath}/channels_microsoft365_disable" data: JSON.stringify(id: id) processData: true success: => @@ -166,9 +166,9 @@ class ChannelAccountOverview extends App.ControllerSubContent e.preventDefault() id = $(e.target).closest('.action').data('id') @ajax( - id: 'office365_enable' + id: 'microsoft365_enable' type: 'POST' - url: "#{@apiPath}/channels_office365_enable" + url: "#{@apiPath}/channels_microsoft365_enable" data: JSON.stringify(id: id) processData: true success: => @@ -191,9 +191,9 @@ class ChannelAccountOverview extends App.ControllerSubContent e.preventDefault() id = $(e.target).closest('.action').data('id') @ajax( - id: 'office365_rollback_migration' + id: 'microsoft365_rollback_migration' type: 'POST' - url: "#{@apiPath}/channels_office365_rollback_migration" + url: "#{@apiPath}/channels_microsoft365_rollback_migration" data: JSON.stringify(id: id) processData: true success: => @@ -296,7 +296,7 @@ class ChannelInboundEdit extends App.ControllerModal @ajax( id: 'channel_email_inbound' type: 'POST' - url: "#{@apiPath}/channels_office365_inbound/#{@item.id}" + url: "#{@apiPath}/channels_microsoft365_inbound/#{@item.id}" data: JSON.stringify(params) processData: true success: (data, status, xhr) => @@ -351,7 +351,7 @@ class ChannelGroupEdit extends App.ControllerModal @ajax( id: 'channel_email_group' type: 'POST' - url: "#{@apiPath}/channels_office365_group/#{@item.id}" + url: "#{@apiPath}/channels_microsoft365_group/#{@item.id}" data: JSON.stringify(params) processData: true success: (data, status, xhr) => @@ -364,15 +364,15 @@ class ChannelGroupEdit extends App.ControllerModal ) class AppConfig extends App.ControllerModal - head: 'Connect Office 365 App' + head: 'Connect Microsoft 365 App' shown: true button: 'Connect' buttonCancel: true small: true content: -> - @external_credential = App.ExternalCredential.findByAttribute('name', 'office365') - content = $(App.view('office365/app_config')( + @external_credential = App.ExternalCredential.findByAttribute('name', 'microsoft365') + content = $(App.view('microsoft365/app_config')( external_credential: @external_credential callbackUrl: @callbackUrl )) @@ -391,16 +391,16 @@ class AppConfig extends App.ControllerModal # verify app credentials @ajax( - id: 'office365_app_verify' + id: 'microsoft365_app_verify' type: 'POST' - url: "#{@apiPath}/external_credentials/office365/app_verify" + url: "#{@apiPath}/external_credentials/microsoft365/app_verify" data: JSON.stringify(@formParams()) processData: true success: (data, status, xhr) => if data.attributes if !@external_credential @external_credential = new App.ExternalCredential - @external_credential.load(name: 'office365', credentials: data.attributes) + @external_credential.load(name: 'microsoft365', credentials: data.attributes) @external_credential.save( done: => @isChanged = true @@ -413,4 +413,4 @@ class AppConfig extends App.ControllerModal @el.find('.alert').removeClass('hidden').text(data.error || 'Unable to verify App.') ) -App.Config.set('office365', { prio: 5000, name: 'Office 365', parent: '#channels', target: '#channels/office365', controller: App.ChannelOffice365, permission: ['admin.channel_office365'] }, 'NavBarAdmin') +App.Config.set('microsoft365', { prio: 5000, name: 'Microsoft 365', parent: '#channels', target: '#channels/microsoft365', controller: App.ChannelMicrosoft365, permission: ['admin.channel_microsoft365'] }, 'NavBarAdmin') diff --git a/app/assets/javascripts/app/models/email_address.coffee b/app/assets/javascripts/app/models/email_address.coffee index 7409b98bd..a3ac6347f 100644 --- a/app/assets/javascripts/app/models/email_address.coffee +++ b/app/assets/javascripts/app/models/email_address.coffee @@ -18,7 +18,7 @@ class App.EmailAddress extends App.Model if localChannel return channel if channel.area is localChannel.area else - return channel if channel.area is 'Google::Account' || channel.area is 'Office365::Account' || channel.area is 'Email::Account' + return channel if channel.area is 'Google::Account' || channel.area is 'Microsoft365::Account' || channel.area is 'Email::Account' ) @configure_attributes = [ diff --git a/app/assets/javascripts/app/views/channel/email_account_overview.jst.eco b/app/assets/javascripts/app/views/channel/email_account_overview.jst.eco index c1fe4dc33..1265e6ae1 100644 --- a/app/assets/javascripts/app/views/channel/email_account_overview.jst.eco +++ b/app/assets/javascripts/app/views/channel/email_account_overview.jst.eco @@ -63,9 +63,9 @@ <% date_migration = new Date("#{date_migration_string}T00:00:00") %> <% date_now = new Date() %> <% if date_now > date_migration: %> - <%- @T('%s will only allow access via OAuth. Password-based access is no longer supported since %s.', 'Office 365', date_migration_string_local) %>
+ <%- @T('%s will only allow access via OAuth. Password-based access is no longer supported since %s.', 'Microsoft 365', date_migration_string_local) %>
<% else: %> - <%- @T('%s will only allow access via OAuth. Password-based access will no longer be supported on %s.', 'Office 365', date_migration_string_local) %>
+ <%- @T('%s will only allow access via OAuth. Password-based access will no longer be supported on %s.', 'Microsoft 365', date_migration_string_local) %>
<% end %> <% end %> diff --git a/app/assets/javascripts/app/views/office365/app_config.jst.eco b/app/assets/javascripts/app/views/microsoft365/app_config.jst.eco similarity index 87% rename from app/assets/javascripts/app/views/office365/app_config.jst.eco rename to app/assets/javascripts/app/views/microsoft365/app_config.jst.eco index 1c1f565ee..38a54bc88 100644 --- a/app/assets/javascripts/app/views/office365/app_config.jst.eco +++ b/app/assets/javascripts/app/views/microsoft365/app_config.jst.eco @@ -1,9 +1,9 @@

- <%- @T('The tutorial on how to manage a %s is hosted on our online documentation %l.', 'Office 365 App', 'https://admin-docs.zammad.org/en/latest/channels/office365.html') %> + <%- @T('The tutorial on how to manage a %s is hosted on our online documentation %l.', 'Microsoft 365 App', 'https://admin-docs.zammad.org/en/latest/channels/microsoft365.html') %>

-

<%- @T('Enter your %s App Keys', 'Office 365') %>

+

<%- @T('Enter your %s App Keys', 'Microsoft 365') %>

diff --git a/app/assets/javascripts/app/views/microsoft365/index.jst.eco b/app/assets/javascripts/app/views/microsoft365/index.jst.eco new file mode 100644 index 000000000..b84e9918b --- /dev/null +++ b/app/assets/javascripts/app/views/microsoft365/index.jst.eco @@ -0,0 +1,12 @@ + + +
+
+

<%- @T('You can connect %s with Zammad. You need to connect your Zammad with %s first.', 'Microsoft 365 Accounts', 'Microsoft 365') %>

+
<%- @T('Connect Microsoft 365 App') %>
+
+
diff --git a/app/assets/javascripts/app/views/office365/list.jst.eco b/app/assets/javascripts/app/views/microsoft365/list.jst.eco similarity index 98% rename from app/assets/javascripts/app/views/office365/list.jst.eco rename to app/assets/javascripts/app/views/microsoft365/list.jst.eco index cf59cc286..3d3680719 100644 --- a/app/assets/javascripts/app/views/office365/list.jst.eco +++ b/app/assets/javascripts/app/views/microsoft365/list.jst.eco @@ -1,6 +1,6 @@