Skip to content

Commit 16340f4

Browse files
committed
Merge branch 'release/1.1.0'
2 parents 2e7b050 + ac4d3de commit 16340f4

11 files changed

Lines changed: 460 additions & 5 deletions

File tree

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "composer"
9+
directory: "/"
10+
schedule:
11+
interval: "daily"

.github/workflows/php.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: PHP Composer
2+
3+
on:
4+
push:
5+
branches: [ develop ]
6+
pull_request:
7+
branches: [ develop ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
fail-fast: true
16+
matrix:
17+
php: [ 8.0, 7.4, 7.3, 7.2, 7.1 ]
18+
stability: [ prefer-lowest, prefer-stable ]
19+
20+
name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
25+
- name: Setup PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: ${{ matrix.php }}
29+
coverage: none
30+
31+
- name: Validate composer.json and composer.lock
32+
run: composer validate
33+
34+
- name: Cache Composer packages
35+
id: composer-cache
36+
uses: actions/cache@v2
37+
with:
38+
path: vendor
39+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
40+
restore-keys: |
41+
${{ runner.os }}-php-
42+
43+
- name: Install dependencies
44+
if: steps.composer-cache.outputs.cache-hit != 'true'
45+
run: composer install --prefer-dist --no-progress --no-suggest
46+
47+
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
48+
# Docs: https://getcomposer.org/doc/articles/scripts.md
49+
50+
# - name: Run test suite
51+
# run: composer run-script test

LICENSE

Lines changed: 347 additions & 0 deletions
Large diffs are not rendered by default.

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.

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
}
1111
],
1212
"require": {
13-
"php": ">=7.1"
13+
"php": "^7.1||^8.0",
14+
"composer/installers": "^1.0"
1415
}
1516
}

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
];

0 commit comments

Comments
 (0)