* Fix creating a new Conversation with a new Customer. * Fix the error shown when trying to create a Customer with no linked Mailbox.
7 KiB
Millions Missing France - Freescout Restricted Customers
Description
In a regular Freescout instance, all users have access to the e-mails of all customers. That can easily lead to confidentiality breaches when multiple organizations share a same Freescout instance.
This package tries to provide a solution to this problem, by linking each customer to a specific mailbox. The information related to a customer, especially their e-mail address, is only shown to users with access to the related mailbox.
Data loss warning
When this module is installed, it will link customers to mailboxes. Customers added once this module is active will be linked to mailboxes too. On uninstallation, simply unlinking them could cause several problems:
- It could break unicity constraints, as two customers linked to disctinct mailboxes are allowed to use the same e-mail address as long as the module is active;
- It would break the confidentiality promise, by letting all users having access to all customers.
To avoid these problems, on the module uninstallation all the customers linked to mailboxes are dropped from the database. This is an irreversible operation, the customers deleted that way are gone for good.
So it is highly recommended to backup your customers database:
- Before installing this module;
- Before uninstalling this module.
Installation instructions
Install the module
Install from the archive
Download the release tarball and extract its content into Modules/MMFRestrictedCustomers
.
wget https://port.numenaute.org/MMF/freescout-restricted-customers/archive/1.1.2.tar.gz -O freescout-restricted-customers-1.1.2.tar.gz
tar xf freescout-restricted-customers-1.1.2.tar.gz -C Modules
mv Modules/freescout-restricted-customers Modules/MMFRestrictedCustomers
Install from git
git clone https://port.numenaute.org/MMF/freescout-restricted-customers.git Modules/MMFRestrictedCustomers
Edit the application routes
Routes set in Freescout itself can not be automatically overridden. Overriding them has to be done manually, in the following file:
routes/web.php
This section of the file:
// Customers
Route::get('/customers/{id}/edit', 'CustomersController@update')->name('customers.update');
Route::post('/customers/{id}/edit', 'CustomersController@updateSave');
Route::get('/customers/{id}/', 'CustomersController@conversations')->name('customers.conversations');
Route::get('/customers/ajax-search', ['uses' => 'CustomersController@ajaxSearch', 'laroute' => true])->name('customers.ajax_search');
Route::post('/customers/ajax', ['uses' => 'CustomersController@ajax', 'laroute' => true])->name('customers.ajax');
should be replaced with:
// Customers
Route::get('/customers/{id}/edit', '\Modules\MMFRestrictedCustomers\Http\Controllers\CustomersController@update')->name('customers.update');
Route::post('/customers/{id}/edit', 'CustomersController@updateSave');
Route::get('/customers/{id}/', '\Modules\MMFRestrictedCustomers\Http\Controllers\CustomersController@conversations')->name('customers.conversations');
Route::get('/customers/ajax-search', ['uses' => '\Modules\MMFRestrictedCustomers\Http\Controllers\CustomersController@ajaxSearch', 'laroute' => true])->name('customers.ajax_search');
Route::post('/customers/ajax', ['uses' => '\Modules\MMFRestrictedCustomers\Http\Controllers\CustomersController@ajax', 'laroute' => true])->name('customers.ajax');
This other section:
// Conversations
Route::get('/conversation/{id}', ['uses' => 'ConversationsController@view', 'laroute' => true])->name('conversations.view');
Route::post('/conversation/ajax', ['uses' => 'ConversationsController@ajax', 'laroute' => true])->name('conversations.ajax');
Route::post('/conversation/upload', ['uses' => 'ConversationsController@upload', 'laroute' => true])->name('conversations.upload');
Route::get('/mailbox/{mailbox_id}/new-ticket', 'ConversationsController@create')->name('conversations.create');
Route::get('/mailbox/{mailbox_id}/clone-ticket/{from_thread_id}', 'ConversationsController@cloneConversation')->name('conversations.clone_conversation');
//Route::get('/conversation/draft/{id}', 'ConversationsController@draft')->name('conversations.draft');
Route::get('/conversation/ajax-html/{action}', ['uses' => 'ConversationsController@ajaxHtml', 'laroute' => true])->name('conversations.ajax_html');
Route::get('/search', 'ConversationsController@search')->name('conversations.search');
Route::get('/conversation/undo-reply/{thread_id}', 'ConversationsController@undoReply')->name('conversations.undo');
Route::get('/mailbox/{mailbox_id}/chats', 'ConversationsController@chats')->name('conversations.chats');
should be replaced with:
// Conversations
Route::get('/conversation/{id}', ['uses' => 'ConversationsController@view', 'laroute' => true])->name('conversations.view');
Route::post('/conversation/ajax', ['uses' => '\Modules\MMFRestrictedCustomers\Http\Controllers\ConversationsController@ajax', 'laroute' => true])->name('conversations.ajax');
Route::post('/conversation/upload', ['uses' => 'ConversationsController@upload', 'laroute' => true])->name('conversations.upload');
Route::get('/mailbox/{mailbox_id}/new-ticket', 'ConversationsController@create')->name('conversations.create');
Route::get('/mailbox/{mailbox_id}/clone-ticket/{from_thread_id}', 'ConversationsController@cloneConversation')->name('conversations.clone_conversation');
//Route::get('/conversation/draft/{id}', 'ConversationsController@draft')->name('conversations.draft');
Route::get('/conversation/ajax-html/{action}', ['uses' => 'ConversationsController@ajaxHtml', 'laroute' => true])->name('conversations.ajax_html');
Route::get('/search', 'ConversationsController@search')->name('conversations.search');
Route::get('/conversation/undo-reply/{thread_id}', 'ConversationsController@undoReply')->name('conversations.undo');
Route::get('/mailbox/{mailbox_id}/chats', 'ConversationsController@chats')->name('conversations.chats');
Edit the artisan commands
Console commands set in other modules or in Freescout itself can not be automatically overridden. Overriding them has to be done manually, in the following file.
app/Console/Kernel.php
At the lines 107-108, this:
$fetch_command_identifier = \Helper::getWorkerIdentifier('freescout:fetch-emails');
$fetch_command_name = 'freescout:fetch-emails'
should be replaced with:
$fetch_command_identifier = \Helper::getWorkerIdentifier('mmfrestrictedcustomers:fetch-emails');
$fetch_command_name = 'mmfrestrictedcustomers:fetch-emails'
Update the database schema
php artisan migrate
Use the updated views
Beware that this will overwrite any customization you might have done to the following templates:
resources/views/conversations/search.blade.php
php artisan vendor:publish --provider='Modules\MMFRestrictedCustomers\Providers\MMFRestrictedCustomersServiceProvider' --tag='views' --force