Skip to content

Commit 1bc045f

Browse files
committed
first commit
1 parent 0ecfef6 commit 1bc045f

File tree

124 files changed

+15484
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+15484
-3
lines changed

.editorconfig

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2
16+
17+
[docker-compose.yml]
18+
indent_size = 4

.env.example

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
APP_NAME=Laravel
2+
APP_ENV=local
3+
APP_KEY=
4+
APP_DEBUG=true
5+
APP_URL=http://localhost
6+
7+
LOG_CHANNEL=stack
8+
LOG_DEPRECATIONS_CHANNEL=null
9+
LOG_LEVEL=debug
10+
11+
DB_CONNECTION=mysql
12+
DB_HOST=127.0.0.1
13+
DB_PORT=3306
14+
DB_DATABASE=laravel
15+
DB_USERNAME=root
16+
DB_PASSWORD=
17+
18+
BROADCAST_DRIVER=log
19+
CACHE_DRIVER=file
20+
FILESYSTEM_DISK=local
21+
QUEUE_CONNECTION=sync
22+
SESSION_DRIVER=file
23+
SESSION_LIFETIME=120
24+
25+
MEMCACHED_HOST=127.0.0.1
26+
27+
REDIS_HOST=127.0.0.1
28+
REDIS_PASSWORD=null
29+
REDIS_PORT=6379
30+
31+
MAIL_MAILER=smtp
32+
MAIL_HOST=mailhog
33+
MAIL_PORT=1025
34+
MAIL_USERNAME=null
35+
MAIL_PASSWORD=null
36+
MAIL_ENCRYPTION=null
37+
MAIL_FROM_ADDRESS="[email protected]"
38+
MAIL_FROM_NAME="${APP_NAME}"
39+
40+
AWS_ACCESS_KEY_ID=
41+
AWS_SECRET_ACCESS_KEY=
42+
AWS_DEFAULT_REGION=us-east-1
43+
AWS_BUCKET=
44+
AWS_USE_PATH_STYLE_ENDPOINT=false
45+
46+
PUSHER_APP_ID=
47+
PUSHER_APP_KEY=
48+
PUSHER_APP_SECRET=
49+
PUSHER_APP_CLUSTER=mt1
50+
51+
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
52+
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

.gitattributes

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
* text=auto
2+
3+
*.blade.php diff=html
4+
*.css diff=css
5+
*.html diff=html
6+
*.md diff=markdown
7+
*.php diff=php
8+
9+
/.github export-ignore
10+
CHANGELOG.md export-ignore

.gitignore

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/node_modules
2+
/public/hot
3+
/public/storage
4+
/storage/*.key
5+
/vendor
6+
.env
7+
.env.testing
8+
.env.backup
9+
.phpunit.result.cache
10+
docker-compose.override.yml
11+
Homestead.json
12+
Homestead.yaml
13+
npm-debug.log
14+
yarn-error.log
15+
/.idea
16+
/.vscode
17+
/.php-cs-fixer.cache

.php-cs-fixer.dist.php

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php declare(strict_types=1);
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->in([
5+
__DIR__ . '/app',
6+
__DIR__ . '/config',
7+
__DIR__ . '/database/factories',
8+
__DIR__ . '/database/seeders',
9+
__DIR__ . '/routes',
10+
__DIR__ . '/tests',
11+
]);
12+
13+
$config = new PhpCsFixer\Config();
14+
15+
return $config
16+
->setRiskyAllowed(true)
17+
->setRules([
18+
'@PhpCsFixer:risky' => true,
19+
'blank_line_after_opening_tag' => false,
20+
'linebreak_after_opening_tag' => false,
21+
'phpdoc_types_order' => [
22+
'null_adjustment' => 'always_last',
23+
'sort_algorithm' => 'none',
24+
],
25+
'no_superfluous_phpdoc_tags' => false,
26+
'global_namespace_import' => [
27+
'import_classes' => true,
28+
'import_constants' => true,
29+
'import_functions' => true,
30+
],
31+
'php_unit_test_case_static_method_calls' => [
32+
'call_type' => 'this'
33+
],
34+
'phpdoc_align' => [
35+
'align' => 'left',
36+
],
37+
'not_operator_with_successor_space' => true,
38+
'blank_line_after_namespace' => true,
39+
'date_time_immutable' => true,
40+
'declare_parentheses' => true,
41+
'final_public_method_for_abstract_class' => true,
42+
'mb_str_functions' => true,
43+
'simplified_if_return' => false,
44+
'simplified_null_return' => false,
45+
])
46+
->setFinder($finder);

.styleci.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
php:
2+
preset: laravel
3+
version: 8
4+
disabled:
5+
- no_unused_imports
6+
finder:
7+
not-name:
8+
- index.php
9+
js:
10+
finder:
11+
not-name:
12+
- webpack.mix.js
13+
css: true

README.md

+14-3
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,25 @@ next generation squid user-management WebUI alternative proxymin,Squid Users Man
88
- Make sure squid is compiled with --enable-basic-auth-helpers=DB option.
99
- Use MySQL driver settings in the squid.conf file
1010
https://wiki.squid-cache.org/ConfigExamples/Authenticate/Mysql
11+
12+
- Additional Module
13+
- https://github.com/39ff/squid-db-auth-ip
14+
1115

1216
## Installation
1317
PHP8+
1418

1519

1620
## Todo
21+
- [x] WebAPI
22+
- [ ] WebGUI
1723
- [x] Basic User Management
18-
- [ ] IP Address Management
19-
- [ ] Customize ACL Rules
24+
- [x] IP Address Management
25+
- [ ] Customize ACL Rules (ansible?)
2026
- [ ] Documentation
21-
- [ ] Tests
27+
- [ ] WebAPI Documentation
28+
- [x] Feature Tests
29+
- [ ] E2E Tests
30+
- [ ] create docker-compose
31+
- [ ] Multiple Server Management
32+
- [ ] Metrics

app/Console/Kernel.php

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace App\Console;
4+
5+
use Illuminate\Console\Scheduling\Schedule;
6+
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
7+
8+
class Kernel extends ConsoleKernel
9+
{
10+
/**
11+
* Define the application's command schedule.
12+
*
13+
* @param \Illuminate\Console\Scheduling\Schedule $schedule
14+
* @return void
15+
*/
16+
protected function schedule(Schedule $schedule)
17+
{
18+
// $schedule->command('inspire')->hourly();
19+
}
20+
21+
/**
22+
* Register the commands for the application.
23+
*
24+
* @return void
25+
*/
26+
protected function commands()
27+
{
28+
$this->load(__DIR__.'/Commands');
29+
30+
require base_path('routes/console.php');
31+
}
32+
}

app/Exceptions/Handler.php

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace App\Exceptions;
4+
5+
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
6+
use Throwable;
7+
8+
class Handler extends ExceptionHandler
9+
{
10+
/**
11+
* A list of the exception types that are not reported.
12+
*
13+
* @var array<int, class-string<Throwable>>
14+
*/
15+
protected $dontReport = [
16+
//
17+
];
18+
19+
/**
20+
* A list of the inputs that are never flashed for validation exceptions.
21+
*
22+
* @var array<int, string>
23+
*/
24+
protected $dontFlash = [
25+
'current_password',
26+
'password',
27+
'password_confirmation',
28+
];
29+
30+
/**
31+
* Register the exception handling callbacks for the application.
32+
*
33+
* @return void
34+
*/
35+
public function register()
36+
{
37+
$this->reportable(function (Throwable $e) {
38+
//
39+
});
40+
}
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Api;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Http\Requests\SquidUser\CreateRequest;
7+
use App\Http\Requests\SquidUser\DestroyRequest;
8+
use App\Http\Requests\SquidUser\ModifyRequest;
9+
use App\Http\Requests\SquidUser\SearchRequest;
10+
use App\Http\Resources\SquidUserCollection;
11+
use App\Http\Resources\SquidUserResource;
12+
use App\UseCases\SquidUser\CreateAction;
13+
use App\UseCases\SquidUser\DestroyAction;
14+
use App\UseCases\SquidUser\ModifyAction;
15+
use App\UseCases\SquidUser\SearchAction;
16+
17+
class SquidUserController extends Controller
18+
{
19+
public function search(SearchRequest $request, SearchAction $action) : SquidUserCollection{
20+
$user= $request->searchSquidUser();
21+
$query = $request->validated();
22+
23+
return new SquidUserCollection($action($user,$query));
24+
}
25+
26+
public function create(CreateRequest $request, CreateAction $action) : SquidUserResource{
27+
$user = $request->createSquidUser();
28+
29+
return new SquidUserResource($action($user));
30+
}
31+
32+
public function modify(ModifyRequest $request, ModifyAction $action) : SquidUserResource{
33+
$user = $request->modifySquidUser();
34+
35+
return new SquidUserResource($action($user));
36+
}
37+
38+
public function destroy(DestroyRequest $request, DestroyAction $action) : SquidUserResource{
39+
$user = $request->destroySquidUser();
40+
41+
return new SquidUserResource($action($user));
42+
}
43+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Api;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Http\Requests\User\SearchRequest;
7+
use App\Http\Requests\User\CreateRequest;
8+
use App\Http\Requests\User\DestroyRequest;
9+
use App\Http\Requests\User\ModifyRequest;
10+
use App\Http\Resources\UserCollection;
11+
use App\Http\Resources\UserResource;
12+
use App\UseCases\User\SearchAction;
13+
use App\UseCases\User\CreateAction;
14+
use App\UseCases\User\DestroyAction;
15+
use App\UseCases\User\ModifyAction;
16+
17+
class UserController extends Controller
18+
{
19+
public function search(SearchRequest $request, SearchAction $action) : UserCollection{
20+
$user = $request->searchUser();
21+
$query = $request->validated();
22+
23+
return new UserCollection($action($user,$query));
24+
}
25+
26+
public function create(CreateRequest $request, CreateAction $action) : UserResource{
27+
$user = $request->createUser();
28+
29+
return new UserResource($action($user));
30+
}
31+
32+
public function modify(ModifyRequest $request, ModifyAction $action) : UserResource{
33+
$user = $request->modifyUser();
34+
35+
return new UserResource($action($user));
36+
}
37+
38+
public function destroy(DestroyRequest $request, DestroyAction $action) : UserResource{
39+
$user = $request->destroyUser();
40+
41+
return new UserResource($action($user));
42+
}
43+
}

app/Http/Controllers/Controller.php

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
6+
use Illuminate\Foundation\Bus\DispatchesJobs;
7+
use Illuminate\Foundation\Validation\ValidatesRequests;
8+
use Illuminate\Routing\Controller as BaseController;
9+
10+
class Controller extends BaseController
11+
{
12+
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
13+
}

0 commit comments

Comments
 (0)