Freescout Restricted Customers
Find a file
2024-07-06 18:47:23 +02:00
database/migrations Link Customer instances to a Mailbox instance 2024-07-05 12:33:07 +02:00
resources/views Link Customer creation to a Mailbox 2024-07-05 14:18:54 +02:00
routes Restrict the Customers shown in the search page 2024-07-05 17:46:34 +02:00
src Restrict the Customers shown during auto-completion of the "To:" field 2024-07-05 18:03:05 +02:00
composer.json Create a basic ServiceProvider 2024-07-03 16:00:53 +02:00
COPYING Import a copy of the GNU Affero General Public License (AGPL) 2024-07-03 12:43:15 +02:00
README.md [ReadMe] Include the database update in the installations instructions 2024-07-06 18:47:23 +02:00

MMF - 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.

Disclaimer

This is still a work in progress. Using any version prior to the (not yet released) 1.0.0 will lead to irrecuperable data loss. You have been warned.

Installation instructions

Install the package with composer

composer require "mmf/freescount-restricted-customers" "0.1.0"

Edit the application routes

This package does not seem to correctly override the routes of the main application. Overriding them has to be done manually, in the two following files.

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', '\MMF\FreescoutRestrictedCustomers\Http\Controllers\CustomersController@update')->name('customers.update');
Route::post('/customers/{id}/edit', '\MMF\FreescoutRestrictedCustomers\Http\Controllers\CustomersController@updateSave');
Route::get('/customers/{id}/', '\MMF\FreescoutRestrictedCustomers\Http\Controllers\CustomersController@conversations')->name('customers.conversations');
Route::get('/customers/ajax-search', ['uses' => '\MMF\FreescoutRestrictedCustomers\Http\Controllers\CustomersController@ajaxSearch', 'laroute' => true])->name('customers.ajax_search');
Route::post('/customers/ajax', ['uses' => '\MMF\FreescoutRestrictedCustomers\Http\Controllers\CustomersController@ajax', 'laroute' => true])->name('customers.ajax');

This other section should be edited too:

// 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');

and replaced with:

// 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', '\MMF\FreescoutRestrictedCustomers\Http\Controllers\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');

Modules/Crm/Http/routes.php

The following list of routes:

Route::group(['middleware' => ['web', 'auth', 'roles'], 'roles' => ['user', 'admin'], 'prefix' => \Helper::getSubdirectory(), 'namespace' => 'Modules\Crm\Http\Controllers'], function()
{
    Route::get('/customers/new', 'CrmController@createCustomer')->name('crm.create_customer');
    Route::post('/customers/new', 'CrmController@createCustomerSave');
    Route::get('/crm/ajax-html/{action}/{param?}', ['uses' => 'CrmController@ajaxHtml'])->name('crm.ajax_html');
    Route::get('/customers/fields/ajax-search', ['uses' => 'CrmController@ajaxSearch', 'laroute' => true])->name('crm.ajax_search');
    Route::post('/crm/ajax', ['uses' => 'CrmController@ajax', 'laroute' => true])->name('crm.ajax');
});

Route::group(['middleware' => ['web', 'auth', 'roles'], 'roles' => ['admin'], 'prefix' => \Helper::getSubdirectory(), 'namespace' => 'Modules\Crm\Http\Controllers'], function()
{
    Route::post('/customers/export', ['uses' => 'CrmController@export'])->name('crm.export');
    Route::post('/crm/ajax-admin', ['uses' => 'CrmController@ajaxAdmin', 'laroute' => true])->name('crm.ajax_admin');
});

should be replaced with:

Route::group(['middleware' => ['web', 'auth', 'roles'], 'roles' => ['user', 'admin'], 'prefix' => \Helper::getSubdirectory(), 'namespace' => 'MMF\FreescoutRestrictedCustomers\Http\Controllers'], function()
{
    Route::get('/customers/new', '\MMF\FreescoutRestrictedCustomers\Http\Controllers\CrmController@createCustomer')->name('freescout-restricted-customers.create_customer');
    // The Crm module initialization will crash if no route named "crm.create_customer" is set.
    Route::get('/customers/new', '\MMF\FreescoutRestrictedCustomers\Http\Controllers\CrmController@createCustomer')->name('crm.create_customer');
    Route::post('/customers/new', '\MMF\FreescoutRestrictedCustomers\Http\Controllers\CrmController@createCustomerSave');
    Route::get('/crm/ajax-html/{action}/{param?}', ['uses' => '\MMF\FreescoutRestrictedCustomers\Http\Controllers\CrmController@ajaxHtml'])->name('crm.ajax_html');
    Route::get('/customers/fields/ajax-search', ['uses' => '\MMF\FreescoutRestrictedCustomers\Http\Controllers\CrmController@ajaxSearch', 'laroute' => true])->name('crm.ajax_search');
    Route::post('/crm/ajax', ['uses' => '\MMF\FreescoutRestrictedCustomers\Http\Controllers\CrmController@ajax', 'laroute' => true])->name('crm.ajax');
});

Route::group(['middleware' => ['web', 'auth', 'roles'], 'roles' => ['admin'], 'prefix' => \Helper::getSubdirectory(), 'namespace' => '\MMF\FreescoutRestrictedCustomers\Http\Controllers'], function()
{
    Route::post('/customers/export', ['uses' => '\MMF\FreescoutRestrictedCustomers\Http\Controllers\CrmController@export'])->name('crm.export');
    Route::post('/crm/ajax-admin', ['uses' => '\MMF\FreescoutRestrictedCustomers\Http\Controllers\CrmController@ajaxAdmin', 'laroute' => true])->name('crm.ajax_admin');
});

Update the database schema

php artisan migrate