From 29e3868f695dbd9714c818c7bd031bd7a16666ea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicolas=20Borbo=C3=ABn?= <ponsfrilus@gmail.com>
Date: Thu, 21 Jan 2021 20:37:44 +0100
Subject: [PATCH] [feature] config

---
 canapGEST/API/.env.example                      | 17 +++++++++++------
 .../API/app/Http/Controllers/AuthController.php | 11 +++++++----
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/canapGEST/API/.env.example b/canapGEST/API/.env.example
index 8e44001..a9dbb6a 100644
--- a/canapGEST/API/.env.example
+++ b/canapGEST/API/.env.example
@@ -1,16 +1,21 @@
 APP_ENV=local
 APP_DEBUG=true
-APP_KEY=
+APP_KEY=CHANGEMEfuef5ahX7ohSh3ieDaiPh3eiy
 APP_TIMEZONE=Europe/Zurich
 
+# mysql -u canap_db -p canap_db -h localhost --port 9906 --protocol=tcp
 DB_CONNECTION=mysql
-DB_HOST=127.0.0.1
+DB_HOST=db
 DB_PORT=3306
-DB_DATABASE=homestead
-DB_USERNAME=homestead
-DB_PASSWORD=secret
+DB_DATABASE=canap_db
+DB_USERNAME=canap_db
+DB_PASSWORD=canap_db
 
 CACHE_DRIVER=file
 QUEUE_DRIVER=sync
 
-JWT_SECRET=
\ No newline at end of file
+JWT_SECRET=CHANGEMEruPigh9cui2eighahd2luu0di
+
+TEQUILA_REQUIRE_PARAMS='group=canap-gest-users'
+TEQUILA_RETURN_URL='https://canap-gest.epfl.ch/#/?key='
+BYPASS_RESPONSIBLE_SCIPER=''
diff --git a/canapGEST/API/app/Http/Controllers/AuthController.php b/canapGEST/API/app/Http/Controllers/AuthController.php
index 258d7fa..51d5c84 100644
--- a/canapGEST/API/app/Http/Controllers/AuthController.php
+++ b/canapGEST/API/app/Http/Controllers/AuthController.php
@@ -37,8 +37,8 @@ class AuthController extends Controller
     ];
 
     // DEV ndubois droits responsable
-    if ($tequila_attributes["uniqueid"] == "167916") {
-      // $payload["role"] = 'responsable';
+    if ($tequila_attributes["uniqueid"] == "169419") {
+      $payload["role"] = 'responsable';
     }
 
 
@@ -60,7 +60,8 @@ class AuthController extends Controller
     $oClient->setRequested(
       array(
         'request' => "name,firstname,uniqueid,group",
-        'require'    => "group=canap-gest-users"
+        //'require'    => "group=canap-gest-users"
+        'require' => env('DB_USERNAME', 'group=canap-gest-users')
       )
     );
 
@@ -82,7 +83,9 @@ class AuthController extends Controller
   public function tequilareturn()
   {
     // return redirect()->to("https://canap-gest-dev.local:8080/#/?key=" . $_GET["key"]);
-    return redirect()->to("https://canap-gest.epfl.ch/#/?key=" . $_GET["key"]); // PROD
+    // return redirect()->to("https://canap-gest.epfl.ch/#/?key=" . $_GET["key"]); // PROD
+    // return redirect()->to("http://localhost:8080/#/?key=" . $_GET["key"]); // DEV
+    return redirect()->to(env('DB_USERNAME', 'group=canap-gest-users') . $_GET["key"]); // DEV
   }
 
   public function logout()
-- 
GitLab