prevent disable active company
This commit is contained in:
parent
0db2bffd03
commit
197f9f9e3a
|
|
@ -89,6 +89,13 @@ class UpdateCompany extends Job
|
|||
*/
|
||||
public function authorize()
|
||||
{
|
||||
// Can't disable active company
|
||||
if (($this->request->get('enabled', 1) == 0) && ($this->company->id == session('company_id'))) {
|
||||
$message = trans('companies.error.disable_active');
|
||||
|
||||
throw new \Exception($message);
|
||||
}
|
||||
|
||||
// Check if user can access company
|
||||
if (!$this->isUserCompany($this->company->id)) {
|
||||
$message = trans('companies.error.not_user_company');
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ return [
|
|||
'error' => [
|
||||
'not_user_company' => 'Error: You are not allowed to change this company!',
|
||||
'delete_active' => 'Error: Can not delete the active company. Please, switch to another first!',
|
||||
'disable_active' => 'Error: Can not disable the active company. Please, switch to another first!',
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue