Skip to content

Commit 6d88e4c

Browse files
authored
Merge pull request #10 from 39ff/v2.0
WebUI Panel implemented
2 parents b65598d + fe29a6a commit 6d88e4c

File tree

72 files changed

+2130
-389
lines changed

Some content is hidden

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

72 files changed

+2130
-389
lines changed

.coveralls.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
coverage_clover: build/logs/clover.xml
2+
json_path: build/logs/coveralls-upload.json

README.md

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# squidmin
2-
next generation squid user-management WebUI alternative proxymin,Squid Users Manager
2+
squid user-management WebUI alternative proxymin,Squid Users Manager
33

4-
![index](https://user-images.githubusercontent.com/7544687/79716113-a3db6000-8310-11ea-8f53-3f512e02aa46.PNG)
4+
Very simple and secure administration panel optimized for proxy distributors
55

66

77
## Pre requirements
@@ -14,19 +14,11 @@ https://wiki.squid-cache.org/ConfigExamples/Authenticate/Mysql
1414

1515

1616
## Installation
17-
PHP8+
17+
PHP8+,composer
1818

1919

20-
## Todo
21-
- [x] WebAPI
22-
- [ ] WebGUI
23-
- [x] Basic User Management
24-
- [x] IP Address Management
25-
- [ ] Customize ACL Rules (ansible?)
26-
- [ ] Documentation
27-
- [ ] WebAPI Documentation
28-
- [x] Feature Tests
29-
- [ ] E2E Tests
30-
- [ ] create docker-compose
31-
- [ ] Multiple Server Management
32-
- [ ] Metrics
20+
## Create an Administrator
21+
```
22+
php artisan db:seed --class=CreateAdministratorSeeder
23+
```
24+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Api;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Http\Requests\SquidAllowedIp\CreateRequest;
7+
use App\Http\Requests\SquidAllowedIp\DestroyRequest;
8+
use App\Http\Requests\SquidAllowedIp\SearchRequest;
9+
use App\Http\Resources\SquidAllowedIpCollection;
10+
use App\Http\Resources\SquidAllowedIpResource;
11+
use App\UseCases\AllowedIp\CreateAction;
12+
use App\UseCases\AllowedIp\DestroyAction;
13+
use App\UseCases\AllowedIp\SearchAction;
14+
15+
class SquidAllowedIpController extends Controller
16+
{
17+
public function search(SearchRequest $request,SearchAction $action) : SquidAllowedIpCollection{
18+
$query = $request->searchSquidAllowedIp();
19+
20+
return new SquidAllowedIpCollection($action($query));
21+
}
22+
23+
public function create(CreateRequest $request,CreateAction $action) : SquidAllowedIpResource{
24+
$squidAllowedIp = $request->createSquidAllowedIp();
25+
26+
return new SquidAllowedIpResource($action($squidAllowedIp));
27+
}
28+
29+
public function destroy(DestroyRequest $request,DestroyAction $action): SquidAllowedIpResource{
30+
$squidAllowedIp = $request->destroySquidAllowedIp();
31+
32+
return new SquidAllowedIpResource($action($squidAllowedIp));
33+
}
34+
}

app/Http/Controllers/Api/SquidUserController.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717
class SquidUserController extends Controller
1818
{
1919
public function search(SearchRequest $request, SearchAction $action) : SquidUserCollection{
20-
$user= $request->searchSquidUser();
21-
$query = $request->validated();
20+
$query = $request->searchSquidUser();
2221

23-
return new SquidUserCollection($action($user,$query));
22+
return new SquidUserCollection($action($query));
2423
}
2524

2625
public function create(CreateRequest $request, CreateAction $action) : SquidUserResource{

app/Http/Controllers/Api/UserController.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717
class UserController extends Controller
1818
{
1919
public function search(SearchRequest $request, SearchAction $action) : UserCollection{
20-
$user = $request->searchUser();
21-
$query = $request->validated();
20+
$query = $request->searchUser();
2221

23-
return new UserCollection($action($user,$query));
22+
return new UserCollection($action($query));
2423
}
2524

2625
public function create(CreateRequest $request, CreateAction $action) : UserResource{
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Providers\RouteServiceProvider;
7+
use Illuminate\Foundation\Auth\ConfirmsPasswords;
8+
9+
class ConfirmPasswordController extends Controller
10+
{
11+
/*
12+
|--------------------------------------------------------------------------
13+
| Confirm Password Controller
14+
|--------------------------------------------------------------------------
15+
|
16+
| This controller is responsible for handling password confirmations and
17+
| uses a simple trait to include the behavior. You're free to explore
18+
| this trait and override any functions that require customization.
19+
|
20+
*/
21+
22+
use ConfirmsPasswords;
23+
24+
/**
25+
* Where to redirect users when the intended url fails.
26+
*
27+
* @var string
28+
*/
29+
protected $redirectTo = RouteServiceProvider::HOME;
30+
31+
/**
32+
* Create a new controller instance.
33+
*
34+
* @return void
35+
*/
36+
public function __construct()
37+
{
38+
$this->middleware('auth');
39+
}
40+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
7+
8+
class ForgotPasswordController extends Controller
9+
{
10+
/*
11+
|--------------------------------------------------------------------------
12+
| Password Reset Controller
13+
|--------------------------------------------------------------------------
14+
|
15+
| This controller is responsible for handling password reset emails and
16+
| includes a trait which assists in sending these notifications from
17+
| your application to your users. Feel free to explore this trait.
18+
|
19+
*/
20+
21+
use SendsPasswordResetEmails;
22+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Providers\RouteServiceProvider;
7+
use Illuminate\Foundation\Auth\AuthenticatesUsers;
8+
9+
class LoginController extends Controller
10+
{
11+
/*
12+
|--------------------------------------------------------------------------
13+
| Login Controller
14+
|--------------------------------------------------------------------------
15+
|
16+
| This controller handles authenticating users for the application and
17+
| redirecting them to your home screen. The controller uses a trait
18+
| to conveniently provide its functionality to your applications.
19+
|
20+
*/
21+
22+
use AuthenticatesUsers;
23+
24+
/**
25+
* Where to redirect users after login.
26+
*
27+
* @var string
28+
*/
29+
protected $redirectTo = RouteServiceProvider::HOME;
30+
31+
/**
32+
* Create a new controller instance.
33+
*
34+
* @return void
35+
*/
36+
public function __construct()
37+
{
38+
$this->middleware('guest')->except('logout');
39+
}
40+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Providers\RouteServiceProvider;
7+
use App\Models\User;
8+
use Illuminate\Foundation\Auth\RegistersUsers;
9+
use Illuminate\Support\Facades\Hash;
10+
use Illuminate\Support\Facades\Validator;
11+
12+
class RegisterController extends Controller
13+
{
14+
/*
15+
|--------------------------------------------------------------------------
16+
| Register Controller
17+
|--------------------------------------------------------------------------
18+
|
19+
| This controller handles the registration of new users as well as their
20+
| validation and creation. By default this controller uses a trait to
21+
| provide this functionality without requiring any additional code.
22+
|
23+
*/
24+
25+
use RegistersUsers;
26+
27+
/**
28+
* Where to redirect users after registration.
29+
*
30+
* @var string
31+
*/
32+
protected $redirectTo = RouteServiceProvider::HOME;
33+
34+
/**
35+
* Create a new controller instance.
36+
*
37+
* @return void
38+
*/
39+
public function __construct()
40+
{
41+
$this->middleware('guest');
42+
}
43+
44+
/**
45+
* Get a validator for an incoming registration request.
46+
*
47+
* @param array $data
48+
* @return \Illuminate\Contracts\Validation\Validator
49+
*/
50+
protected function validator(array $data)
51+
{
52+
return Validator::make($data, [
53+
'name' => ['required', 'string', 'max:255'],
54+
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
55+
'password' => ['required', 'string', 'min:8', 'confirmed'],
56+
]);
57+
}
58+
59+
/**
60+
* Create a new user instance after a valid registration.
61+
*
62+
* @param array $data
63+
* @return \App\Models\User
64+
*/
65+
protected function create(array $data)
66+
{
67+
return User::create([
68+
'name' => $data['name'],
69+
'email' => $data['email'],
70+
'password' => Hash::make($data['password']),
71+
]);
72+
}
73+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Providers\RouteServiceProvider;
7+
use Illuminate\Foundation\Auth\ResetsPasswords;
8+
9+
class ResetPasswordController extends Controller
10+
{
11+
/*
12+
|--------------------------------------------------------------------------
13+
| Password Reset Controller
14+
|--------------------------------------------------------------------------
15+
|
16+
| This controller is responsible for handling password reset requests
17+
| and uses a simple trait to include this behavior. You're free to
18+
| explore this trait and override any methods you wish to tweak.
19+
|
20+
*/
21+
22+
use ResetsPasswords;
23+
24+
/**
25+
* Where to redirect users after resetting their password.
26+
*
27+
* @var string
28+
*/
29+
protected $redirectTo = RouteServiceProvider::HOME;
30+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Providers\RouteServiceProvider;
7+
use Illuminate\Foundation\Auth\VerifiesEmails;
8+
9+
class VerificationController extends Controller
10+
{
11+
/*
12+
|--------------------------------------------------------------------------
13+
| Email Verification Controller
14+
|--------------------------------------------------------------------------
15+
|
16+
| This controller is responsible for handling email verification for any
17+
| user that recently registered with the application. Emails may also
18+
| be re-sent if the user didn't receive the original email message.
19+
|
20+
*/
21+
22+
use VerifiesEmails;
23+
24+
/**
25+
* Where to redirect users after verification.
26+
*
27+
* @var string
28+
*/
29+
protected $redirectTo = RouteServiceProvider::HOME;
30+
31+
/**
32+
* Create a new controller instance.
33+
*
34+
* @return void
35+
*/
36+
public function __construct()
37+
{
38+
$this->middleware('auth');
39+
$this->middleware('signed')->only('verify');
40+
$this->middleware('throttle:6,1')->only('verify', 'resend');
41+
}
42+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Gui;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Http\Requests\SquidAllowedIp\CreateRequest;
7+
use App\Http\Requests\SquidAllowedIp\DestroyRequest;
8+
use App\Http\Requests\SquidAllowedIp\SearchRequest;
9+
use App\UseCases\AllowedIp\CreateAction;
10+
use App\UseCases\AllowedIp\DestroyAction;
11+
use App\UseCases\AllowedIp\SearchAction;
12+
13+
class SquidAllowedIpController extends Controller
14+
{
15+
public function search(SearchRequest $request,SearchAction $action){
16+
return view('squidallowedips.search',[
17+
'ips'=>$action($request->searchSquidAllowedIp())
18+
]);
19+
}
20+
21+
public function creator(){
22+
return view('squidallowedips.creator');
23+
}
24+
25+
public function create(CreateRequest $request,CreateAction $action){
26+
$action($request->createSquidAllowedIp());
27+
return redirect()->route('ip.search',$request->user()->id);
28+
}
29+
30+
public function destroy(DestroyRequest $request,DestroyAction $action){
31+
$action($request->destroySquidAllowedIp());
32+
return redirect()->route('ip.search',$request->user()->id);
33+
}
34+
}

0 commit comments

Comments
 (0)