forbid access to system requirements
This commit is contained in:
@@ -54,7 +54,8 @@ class Admin
|
||||
private Manager $adminNotificationManager,
|
||||
private SystemRequirements $systemRequirements,
|
||||
private ScheduledJob $scheduledJob,
|
||||
private DataManager $dataManager
|
||||
private DataManager $dataManager,
|
||||
private Config\SystemConfig $systemConfig,
|
||||
) {
|
||||
if (!$this->user->isAdmin()) {
|
||||
throw new Forbidden();
|
||||
@@ -179,9 +180,14 @@ class Admin
|
||||
* database: array<string, array<string, mixed>>,
|
||||
* permission: array<string, array<string, mixed>>,
|
||||
* }
|
||||
* @throws Forbidden
|
||||
*/
|
||||
public function getActionSystemRequirementList(): object
|
||||
{
|
||||
if (!$this->user->isSuperAdmin() && $this->systemConfig->isRestrictedMode()) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
return (object) $this->systemRequirements->getAllRequiredList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,4 +50,14 @@ class SystemConfig
|
||||
{
|
||||
return (string) $this->config->get('version');
|
||||
}
|
||||
|
||||
/**
|
||||
* Is restricted mode.
|
||||
*
|
||||
* @since 9.1.8
|
||||
*/
|
||||
public function isRestrictedMode(): bool
|
||||
{
|
||||
return (bool) $this->config->get('restrictedMode');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,16 +2,23 @@
|
||||
<span class="breadcrumb-separator"><span></span></span>
|
||||
{{translate 'System Requirements' scope='Admin'}}</h3></div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<table class="table table-striped table-no-overflow table-fixed">
|
||||
<thead>
|
||||
{{#if noAccess}}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
{{translate 'error403' category='messages'}}
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="panel panel-default">
|
||||
<table class="table table-striped table-no-overflow table-fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><h5>{{translate 'PHP Settings' scope='Admin'}}</h5></th>
|
||||
<th style="width: 24%"></th>
|
||||
<th style="width: 24%"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each phpRequirementList}}
|
||||
<tr class="list-row">
|
||||
<td class="cell">
|
||||
@@ -21,27 +28,27 @@
|
||||
<td class="cell">
|
||||
{{#if acceptable}} <span class="text-success">{{translate 'Success' scope='Admin'}}</span>
|
||||
{{else}}
|
||||
<span class="text-danger">{{translate 'Fail' scope='Admin'}}
|
||||
{{#ifEqual type 'lib'}} ({{translate 'extension is missing' scope='Admin'}}) {{/ifEqual}}
|
||||
{{#ifEqual type 'param'}} ({{required}} {{translate 'is recommended' scope='Admin'}}) {{/ifEqual}}
|
||||
<span class="text-danger">{{translate 'Fail' scope='Admin'}}
|
||||
{{#ifEqual type 'lib'}} ({{translate 'extension is missing' scope='Admin'}}) {{/ifEqual}}
|
||||
{{#ifEqual type 'param'}} ({{required}} {{translate 'is recommended' scope='Admin'}}) {{/ifEqual}}
|
||||
</span> {{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<table class="table table-striped table-no-overflow table-fixed">
|
||||
<thead>
|
||||
<div class="panel panel-default">
|
||||
<table class="table table-striped table-no-overflow table-fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><h5>{{translate 'Database Settings' scope='Admin'}}</h5></th>
|
||||
<th style="width: 24%"></th>
|
||||
<th style="width: 24%"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each databaseRequirementList}}
|
||||
<tr class="">
|
||||
<td class="cell">
|
||||
@@ -50,29 +57,29 @@
|
||||
<td class="cell" style="width: 24%">{{actual}}</td>
|
||||
<td class="cell" style="width: 24%">
|
||||
{{#if acceptable}}
|
||||
<span class="text-success">{{translate 'Success' scope='Admin'}}</span>
|
||||
<span class="text-success">{{translate 'Success' scope='Admin'}}</span>
|
||||
{{else}}
|
||||
<span class="text-danger">{{translate 'Fail' scope='Admin'}}
|
||||
{{#ifEqual type 'param'}} ({{required}} {{translate 'is recommended' scope='Admin'}}) {{/ifEqual}}
|
||||
<span class="text-danger">{{translate 'Fail' scope='Admin'}}
|
||||
{{#ifEqual type 'param'}} ({{required}} {{translate 'is recommended' scope='Admin'}}) {{/ifEqual}}
|
||||
</span>
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<table class="table table-striped table-no-overflow table-fixed">
|
||||
<thead>
|
||||
<div class="panel panel-default">
|
||||
<table class="table table-striped table-no-overflow table-fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><h5>{{translate 'Permissions' scope='Admin'}}</h5></th>
|
||||
<th style="width: 24%"></th>
|
||||
<th style="width: 24%"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each permissionRequirementList}}
|
||||
<tr>
|
||||
<td class="cell">
|
||||
@@ -81,24 +88,25 @@
|
||||
<td class="cell" style="width: 24%">{{translate type scope='Admin' category='systemRequirements'}}</td>
|
||||
<td class="cell" style="width: 24%">
|
||||
{{#if acceptable}}
|
||||
<span class="text-success">{{translate 'Success' scope='Admin'}}</span>
|
||||
<span class="text-success">{{translate 'Success' scope='Admin'}}</span>
|
||||
{{else}}
|
||||
<span class="text-danger">{{translate 'Fail' scope='Admin'}}</span>
|
||||
<span class="text-danger">{{translate 'Fail' scope='Admin'}}</span>
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="pull-right">
|
||||
<a
|
||||
target="_blank"
|
||||
href="https://docs.espocrm.com/administration/server-configuration/"
|
||||
><strong>{{translate 'Configuration Instructions' scope='Admin'}}</strong></a>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="pull-right">
|
||||
<a
|
||||
target="_blank"
|
||||
href="https://docs.espocrm.com/administration/server-configuration/"
|
||||
><strong>{{translate 'Configuration Instructions' scope='Admin'}}</strong></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
************************************************************************/
|
||||
|
||||
import View from 'view';
|
||||
import Ajax from 'ajax';
|
||||
|
||||
export default class extends View {
|
||||
|
||||
@@ -35,25 +36,40 @@ export default class extends View {
|
||||
/** @type {Record} */
|
||||
requirements
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
noAccess = false
|
||||
|
||||
data() {
|
||||
return {
|
||||
phpRequirementList: this.requirements.php,
|
||||
databaseRequirementList: this.requirements.database,
|
||||
permissionRequirementList: this.requirements.permission,
|
||||
noAccess: this.noAccess,
|
||||
};
|
||||
}
|
||||
|
||||
setup() {
|
||||
this.requirements = {};
|
||||
|
||||
this.wait(this.loadData());
|
||||
}
|
||||
|
||||
async loadData() {
|
||||
Espo.Ui.notifyWait();
|
||||
|
||||
const promise = Espo.Ajax.getRequest('Admin/action/systemRequirementList').then(requirements => {
|
||||
this.requirements = requirements;
|
||||
try {
|
||||
this.requirements = await Espo.Ajax.getRequest('Admin/action/systemRequirementList');
|
||||
} catch(e) {
|
||||
this.noAccess = true;
|
||||
|
||||
Espo.Ui.notify();
|
||||
});
|
||||
if ('errorIsHandled' in e) {
|
||||
e.errorIsHandled = true;
|
||||
}
|
||||
}
|
||||
|
||||
this.wait(promise);
|
||||
Espo.Ui.notify();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user