Skip to content

Commit

Permalink
Merge pull request #10 from 39ff/v2.0
Browse files Browse the repository at this point in the history
WebUI Panel implemented
  • Loading branch information
39ff authored May 5, 2022
2 parents b65598d + fe29a6a commit 6d88e4c
Show file tree
Hide file tree
Showing 72 changed files with 2,130 additions and 389 deletions.
2 changes: 2 additions & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
coverage_clover: build/logs/clover.xml
json_path: build/logs/coveralls-upload.json
24 changes: 8 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# squidmin
next generation squid user-management WebUI alternative proxymin,Squid Users Manager
squid user-management WebUI alternative proxymin,Squid Users Manager

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


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


## Installation
PHP8+
PHP8+,composer


## Todo
- [x] WebAPI
- [ ] WebGUI
- [x] Basic User Management
- [x] IP Address Management
- [ ] Customize ACL Rules (ansible?)
- [ ] Documentation
- [ ] WebAPI Documentation
- [x] Feature Tests
- [ ] E2E Tests
- [ ] create docker-compose
- [ ] Multiple Server Management
- [ ] Metrics
## Create an Administrator
```
php artisan db:seed --class=CreateAdministratorSeeder
```

34 changes: 34 additions & 0 deletions app/Http/Controllers/Api/SquidAllowedIpController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Http\Requests\SquidAllowedIp\CreateRequest;
use App\Http\Requests\SquidAllowedIp\DestroyRequest;
use App\Http\Requests\SquidAllowedIp\SearchRequest;
use App\Http\Resources\SquidAllowedIpCollection;
use App\Http\Resources\SquidAllowedIpResource;
use App\UseCases\AllowedIp\CreateAction;
use App\UseCases\AllowedIp\DestroyAction;
use App\UseCases\AllowedIp\SearchAction;

class SquidAllowedIpController extends Controller
{
public function search(SearchRequest $request,SearchAction $action) : SquidAllowedIpCollection{
$query = $request->searchSquidAllowedIp();

return new SquidAllowedIpCollection($action($query));
}

public function create(CreateRequest $request,CreateAction $action) : SquidAllowedIpResource{
$squidAllowedIp = $request->createSquidAllowedIp();

return new SquidAllowedIpResource($action($squidAllowedIp));
}

public function destroy(DestroyRequest $request,DestroyAction $action): SquidAllowedIpResource{
$squidAllowedIp = $request->destroySquidAllowedIp();

return new SquidAllowedIpResource($action($squidAllowedIp));
}
}
5 changes: 2 additions & 3 deletions app/Http/Controllers/Api/SquidUserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
class SquidUserController extends Controller
{
public function search(SearchRequest $request, SearchAction $action) : SquidUserCollection{
$user= $request->searchSquidUser();
$query = $request->validated();
$query = $request->searchSquidUser();

return new SquidUserCollection($action($user,$query));
return new SquidUserCollection($action($query));
}

public function create(CreateRequest $request, CreateAction $action) : SquidUserResource{
Expand Down
5 changes: 2 additions & 3 deletions app/Http/Controllers/Api/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
class UserController extends Controller
{
public function search(SearchRequest $request, SearchAction $action) : UserCollection{
$user = $request->searchUser();
$query = $request->validated();
$query = $request->searchUser();

return new UserCollection($action($user,$query));
return new UserCollection($action($query));
}

public function create(CreateRequest $request, CreateAction $action) : UserResource{
Expand Down
40 changes: 40 additions & 0 deletions app/Http/Controllers/Auth/ConfirmPasswordController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ConfirmsPasswords;

class ConfirmPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Confirm Password Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password confirmations and
| uses a simple trait to include the behavior. You're free to explore
| this trait and override any functions that require customization.
|
*/

use ConfirmsPasswords;

/**
* Where to redirect users when the intended url fails.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
}
22 changes: 22 additions & 0 deletions app/Http/Controllers/Auth/ForgotPasswordController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;

class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/

use SendsPasswordResetEmails;
}
40 changes: 40 additions & 0 deletions app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\AuthenticatesUsers;

class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/

use AuthenticatesUsers;

/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
}
73 changes: 73 additions & 0 deletions app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use App\Models\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;

class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/

use RegistersUsers;

/**
* Where to redirect users after registration.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}

/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
]);
}

/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\Models\User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
]);
}
}
30 changes: 30 additions & 0 deletions app/Http/Controllers/Auth/ResetPasswordController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ResetsPasswords;

class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/

use ResetsPasswords;

/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
}
42 changes: 42 additions & 0 deletions app/Http/Controllers/Auth/VerificationController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\VerifiesEmails;

class VerificationController extends Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/

use VerifiesEmails;

/**
* Where to redirect users after verification.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('signed')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}
}
34 changes: 34 additions & 0 deletions app/Http/Controllers/Gui/SquidAllowedIpController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace App\Http\Controllers\Gui;

use App\Http\Controllers\Controller;
use App\Http\Requests\SquidAllowedIp\CreateRequest;
use App\Http\Requests\SquidAllowedIp\DestroyRequest;
use App\Http\Requests\SquidAllowedIp\SearchRequest;
use App\UseCases\AllowedIp\CreateAction;
use App\UseCases\AllowedIp\DestroyAction;
use App\UseCases\AllowedIp\SearchAction;

class SquidAllowedIpController extends Controller
{
public function search(SearchRequest $request,SearchAction $action){
return view('squidallowedips.search',[
'ips'=>$action($request->searchSquidAllowedIp())
]);
}

public function creator(){
return view('squidallowedips.creator');
}

public function create(CreateRequest $request,CreateAction $action){
$action($request->createSquidAllowedIp());
return redirect()->route('ip.search',$request->user()->id);
}

public function destroy(DestroyRequest $request,DestroyAction $action){
$action($request->destroySquidAllowedIp());
return redirect()->route('ip.search',$request->user()->id);
}
}
Loading

0 comments on commit 6d88e4c

Please sign in to comment.