Skip to content

Commit ac4d3de

Browse files
committed
Merge branch 'feature/notification' into develop
2 parents 7587866 + ebc2054 commit ac4d3de

7 files changed

Lines changed: 47 additions & 4 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ php artisan vendor:publish --provider="Vdlp\BasicAuthentication\ServiceProviders
2929
This will create a `config/basicauthentication.php` file in your app where you can modify the configuration if you don't
3030
want to use .env variables.
3131

32+
## Enable / disable plugin
33+
34+
By default basic authentication is disabled.
35+
36+
To enable basic authentication, you have to set the env variable to `BASIC_AUTHENTICATION_ENABLED` to `true` in your `.env` file or edit the published config file.
37+
3238
## Questions? Need help?
3339

3440
If you have any question about how to use this plugin, please don't hesitate to contact us at octobercms@vdlp.nl. We're happy to help you. You can also visit the support forum and drop your questions/issues there.

controllers/Credentials.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Backend\Behaviors\ListController;
99
use Backend\Classes\NavigationManager;
1010
use Backend\Classes\Controller;
11+
use Illuminate\Contracts\Config\Repository;
1112
use System\Classes\SettingsManager;
1213

1314
/**
@@ -36,14 +37,19 @@ class Credentials extends Controller
3637
/** {@inheritdoc} */
3738
public $requiredPermissions = ['vdlp.basicauthentication.access_settings'];
3839

40+
/** @var bool */
41+
public $enabled;
42+
3943
/**
4044
* {@inheritdoc}
4145
*/
42-
public function __construct()
46+
public function __construct(Repository $config)
4347
{
4448
parent::__construct();
4549

4650
NavigationManager::instance()->setContext('October.System', 'system', 'settings');
4751
SettingsManager::setContext('Vdlp.BasicAuthentication', 'credentials');
52+
53+
$this->enabled = $config->get('basicauthentication.enabled');
4854
}
4955
}

controllers/ExcludedUrls.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Backend\Behaviors\ListController;
99
use Backend\Classes\NavigationManager;
1010
use Backend\Classes\Controller;
11+
use Illuminate\Contracts\Config\Repository;
1112
use System\Classes\SettingsManager;
1213

1314
/**
@@ -36,14 +37,19 @@ class ExcludedUrls extends Controller
3637
/** {@inheritdoc} */
3738
public $requiredPermissions = ['vdlp.basicauthentication.access_settings'];
3839

40+
/** @var bool */
41+
public $enabled;
42+
3943
/**
4044
* {@inheritdoc}
4145
*/
42-
public function __construct()
46+
public function __construct(Repository $config)
4347
{
4448
parent::__construct();
4549

4650
NavigationManager::instance()->setContext('October.System', 'system', 'settings');
4751
SettingsManager::setContext('Vdlp.BasicAuthentication', 'excludedurls');
52+
53+
$this->enabled = $config->get('basicauthentication.enabled');
4854
}
4955
}

controllers/credentials/index.htm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1+
<?php if(!$this->enabled): ?>
2+
<div class="container-fluid">
3+
<div class="callout fade in callout-warning no-subheader">
4+
<div class="header">
5+
<i class="icon-warning"></i>
6+
<h3><?= e(trans('vdlp.basicauthentication::lang.notifications.disabled')) ?></h3>
7+
</div>
8+
</div>
9+
</div>
10+
<?php endif; ?>
11+
112
<?= $this->listRender() ?>

controllers/excludedurls/index.htm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1+
<?php if(!$this->enabled): ?>
2+
<div class="container-fluid">
3+
<div class="callout fade in callout-warning no-subheader">
4+
<div class="header">
5+
<i class="icon-warning"></i>
6+
<h3><?= e(trans('vdlp.basicauthentication::lang.notifications.disabled')) ?></h3>
7+
</div>
8+
</div>
9+
</div>
10+
<?php endif; ?>
11+
112
<?= $this->listRender() ?>

lang/en/lang.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,7 @@
5858
'create_button' => 'New excluded URL',
5959
],
6060
],
61+
'notifications' => [
62+
'disabled' => 'Basic Authentication is disabled, you can enable it in the configuration file. Read the README for more information.',
63+
],
6164
];

updates/version.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
1.0.0:
22
- First version of Vdlp.BasicAuthenticationentication
33
- 20190123_000001_create_tables.php
4-
1.0.1:
5-
- Update plugin dependencies
4+
1.1.0:
5+
- Add notification to settings view when basic authentication is disabled

0 commit comments

Comments
 (0)