This repository has been archived by the owner on Oct 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* essais validator * test de bdd * valdation and console back * bdd gestion * discord init * Discord and change route ATC * add bootstrap * register * discord and page training * validation donées form * users database * test de database * session serveur * whiteList creat * whitelist controller and database * testing * gestion des logs * des test * Modification Auth * slug * modification visuelle * mise en place admins systeme * page modo and admin users * api sanct * mods API * Request APi keys page * api keys suite * test * test2 * test3 Signed-off-by: Alexandre Caussades <alexaussades@gmail.com> * test4 * test5 * test7 * test8 * update API Serveur --------- Signed-off-by: Alexandre Caussades <alexaussades@gmail.com> Co-authored-by: Alexandre Caussades <alexaussades@gmail.com>
- Loading branch information
1 parent
815d242
commit 1707785
Showing
63 changed files
with
3,041 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,5 @@ yarn-error.log | |
/.fleet | ||
/.idea | ||
/.vscode | ||
composer.lock | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Models\ApiUsers; | ||
use Illuminate\Support\Str; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Auth; | ||
|
||
class ApiGestionController extends Controller | ||
{ | ||
|
||
public function Create_client_id(){ | ||
$sclient_id = Str::random(15); | ||
return $sclient_id; | ||
} | ||
|
||
public function Create_client_secret(){ | ||
$token = Str::random(26); | ||
return $token; | ||
} | ||
|
||
public function lvl_users(){ | ||
$lvl = auth()->user()->role; | ||
if($lvl == 1 || $lvl == 2 || $lvl == 3){ | ||
$lvl_users = "1"; | ||
} | ||
if($lvl == 4 || $lvl == 5 || $lvl == 6){ | ||
$lvl_users = "2"; | ||
} | ||
if($lvl == 7 || $lvl == 8){ | ||
$lvl_users = "3"; | ||
} | ||
if($lvl == 9 || $lvl == 10){ | ||
$lvl_users = "4"; | ||
} | ||
return $lvl_users; | ||
} | ||
|
||
public function return_information(){ | ||
$information = array( | ||
"client_id" => $this->Create_client_id(), | ||
"token" => $this->Create_client_secret(), | ||
"role" => $this->lvl_users(), | ||
); | ||
return $information; | ||
} | ||
|
||
public function check_Informations($id){ | ||
|
||
$check = ApiUsers::where('users_id', $id)->first(); | ||
if($check != null){ | ||
return $check; | ||
}else{ | ||
$information = array( | ||
"role" => 0, | ||
); | ||
return $information; | ||
} | ||
} | ||
|
||
public function creat_keys_api(){ | ||
$information = $this->return_information(); | ||
$api = new ApiUsers(); | ||
$api->client_id = $information['client_id']; | ||
$api->token = $information['token']; | ||
$api->users_id = auth()->user()->id; | ||
$api->email = auth()->user()->email; | ||
$api->role = $information['role']; | ||
$api->save(); | ||
return $information; | ||
} | ||
|
||
public function get_keys_api(){ | ||
$information = $this->check_Informations(auth()->user()->id); | ||
if($information['visible'] == true){ | ||
|
||
} | ||
return $information; | ||
} | ||
|
||
public function delete_keys_api(){ | ||
$api = ApiUsers::where('users_id', auth()->user()->id)->first(); | ||
$api->delete(); | ||
|
||
} | ||
|
||
Public function update_visible(){ | ||
$api = ApiUsers::where('users_id', auth()->user()->id)->first(); | ||
$api->visible = false; | ||
$api->save(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Models\Admin; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Auth; | ||
|
||
class AutAdminController extends Controller | ||
{ | ||
protected $guard = "admin"; | ||
|
||
// creation function in laravel activation session for admin via email adresse check | ||
|
||
public function check_admin(Request $request) | ||
{ | ||
$admin = Admin::where('email', $request->email)->first(); | ||
if ($admin) { | ||
return Auth::guard('admin')->attempt(['email' => $request->email]); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Contracts\Auth\Guard; | ||
use Illuminate\Http\Request; | ||
|
||
class AutModoController extends Controller | ||
{ | ||
protected $guard = "modo"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Http; | ||
|
||
class DiscordNotfyController extends Controller | ||
{ | ||
|
||
|
||
public function index() | ||
{ | ||
return $this->PostNotify(); | ||
} | ||
|
||
public function PostNotify2() | ||
{ | ||
$reponse = Http::post("https://discord.com/api/webhooks/1095038427973558433/DFUjcyw9kMDlcB2N-XCsKQrr2hJpGzQN_YDik1H4oqplDNPOl1usJlBL7I9z_O3Kko-9", [ | ||
"embeds" => [ | ||
[ | ||
"title" => "Ceci est un test pour le webhook et les notifications discord pour les feactures de l'application", | ||
"description" => "Bonjour tout le monde, je suis un test pour le webhook et les notifications discord pour les feactures de l'application, pour plus d'information veuillez contacter le developpeur de l'application ou le support technique de l'application.", | ||
"color" => 16711680 | ||
] | ||
] | ||
]); | ||
return $reponse->json(); | ||
} | ||
|
||
|
||
public function PostNotify() | ||
{ | ||
$reponse = Http::post("https://discord.com/api/webhooks/1094916096324284477/Ulamwc2-t-asqRJyPabHwKuJ0Eel0_1hqphweOiIaLzoRQFr3vScn1Zv40xp7XAMu4Q3", [ | ||
"embeds" => [ | ||
[ | ||
"title" => "test", | ||
"description" => "test", | ||
"color" => 16711680 | ||
] | ||
] | ||
]); | ||
return $reponse->json(); | ||
} | ||
|
||
public function newAddWhiteList($nameRp, $discordName, $email) | ||
{ | ||
$reponse = Http::post("https://discord.com/api/webhooks/1095038427973558433/DFUjcyw9kMDlcB2N-XCsKQrr2hJpGzQN_YDik1H4oqplDNPOl1usJlBL7I9z_O3Kko-9", [ | ||
"embeds" => [ | ||
[ | ||
"title" => "Ajout de la liste d'attente de la whitelist de " . $nameRp, | ||
"description" => "l'utilisateur " . $nameRp . " a fait une demande d'ajout sur la liste d'attente de la whitelist du serveur. sont UsersName Discord est : " . $discordName . "\n Adresse email : " . $email . "\n URL de la demande : https://127.0.0.1:8000/whitelist/LudivicRamirez/34/", | ||
"color" => 16711680 | ||
] | ||
] | ||
]); | ||
return $reponse->json(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Http\Request; | ||
|
||
class RolesController extends Controller | ||
{ | ||
public function new() | ||
{ | ||
return view("roles.new"); | ||
} | ||
|
||
public function create($name, $information) | ||
{ | ||
$roles = new \App\Models\roles(); | ||
$roles->create_Roles($name, $information); | ||
return $roles; | ||
} | ||
|
||
public function get_all() | ||
{ | ||
$roles = new \App\Models\roles(); | ||
return $roles->get_all(); | ||
} | ||
|
||
public function get($id) | ||
{ | ||
$roles = new \App\Models\roles(); | ||
return $roles->get($id); | ||
} | ||
} |
Oops, something went wrong.