diff --git a/.env b/.env index d74c74e..3e36884 100644 --- a/.env +++ b/.env @@ -58,6 +58,8 @@ LDAP_GROUPMEMBER=memberuid # Attribut stockant les membres d'un groupe LDAP_GROUPMEMBERISDN=0 # LDAP_GROUPMEMBER stocke un uid ou un dn ? 0/1 LDAP_FILTERGROUP=(cn=*) # requete ldap pour rechercher les groupes LDAP_FILTERUSER=(uid=*) # requete ldap pour rechercher les users +LDAP_AUTOSUBMIT=1 # if APP_AUTH = LDAP autocréer les users non existant +LDAP_AUTOUPDATE=1 # if APP_AUTH = LDAP automodifier les users existant # If APP_AUTH = CAS CAS_HOST= @@ -70,6 +72,8 @@ CAS_FIRSTNAME=firstname CAS_AVATAR= CAS_NIVEAU01= CAS_GROUP= +CAS_AUTOSUBMIT=1 # if APP_AUTH = CAS autocréer les users non existant +CAS_AUTOUPDATE=1 # if APP_AUTH = CAS automodifier les users existant # If APP_AUTH = OPENID OAUTH_CLIENTID= @@ -85,6 +89,8 @@ OAUTH_FIRSTNAME=firstname OAUTH_AVATAR= OAUTH_NIVEAU01= OAUTH_GROUP= +OAUTH_AUTOSUBMIT=1 # if APP_AUTH = OPENID autocréer les users non existant +OAUTH_AUTOUPDATE=1 # if APP_AUTH = OPENID automodifier les users existant # IF APP_SYNCHRO=NINE2NINE NINE_URL= diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a7d0fc7 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "esbonio.sphinx.confDir": "" +} \ No newline at end of file diff --git a/assets/js/datatables.init.js b/assets/js/datatables.init.js index 18becb3..4031e45 100644 --- a/assets/js/datatables.init.js +++ b/assets/js/datatables.init.js @@ -2,6 +2,7 @@ $(document).ready(function() { $.extend( $.fn.dataTable.defaults, { responsive: true, "iDisplayLength": 1000, + "scrollX": true, "oLanguage": { "sThousands": " ", "sProcessing": "Traitement en cours...", diff --git a/assets/styles/app.css b/assets/styles/app.css index 41c0281..55c178e 100644 --- a/assets/styles/app.css +++ b/assets/styles/app.css @@ -20,6 +20,11 @@ body { background-color: var(--colorbgbodydark); } +.table, +.table-hover > tbody > tr:hover > *, +.table-striped > tbody > tr:nth-of-type(odd) > * { + color: var(--colorftbodylight); +} /* FONT */ body { @@ -28,6 +33,7 @@ body { h1, h2, h3, .navbar-brand, .card-header, .modal-header h4, .widgetheader .title { font-family: var(--fonttitle); + color: var(--colorfttitlelight); } h1 { font-size: var(--fontsizeh1); } diff --git a/config/routes.yaml b/config/routes.yaml index db35853..3c504b1 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -46,16 +46,27 @@ app_logout: app_redirect: path: /user/redirect/{route}/{id} - controller: App\Controller\SecurityController:Security::redirecturl + controller: App\Controller\SecurityController::redirecturl defaults: { access: user } +app_noperm: + path: /noperm + controller: App\Controller\SecurityController::noperm + #== Websocket==================================================================================================== #-- Access user +app_publish_sample: + path: /user/publish/sample/{id} + controller: App\Controller\PublishController::sample + defaults: { access: user } + app_publish: path: /user/publish/{channel}/{id} controller: App\Controller\PublishController::publish defaults: { access: user } + + #== Config ====================================================================================================== #-- Access admin app_admin_config: @@ -88,6 +99,19 @@ app_admin_config_logo: controller: App\Controller\ConfigController::logo defaults: { access: admin } +#== Theme ================================================================================================================ + +#-- Access admin +app_admin_theme: + path: /admin/theme + controller: App\Controller\ThemeController::list + defaults: { access: admin } + +app_admin_theme_select: + path: /admin/theme/select/{name} + controller: App\Controller\ThemeController::select + defaults: { name: "", access: admin } + #== API ================================================================================================================== #-- Access visiteur app_rest: diff --git a/config/services.yaml b/config/services.yaml index e2487a4..4f82c94 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -51,6 +51,8 @@ parameters: ldapGroupmemberisdn: '%env(resolve:LDAP_GROUPMEMBERISDN)%' ldapFiltergroup: '%env(resolve:LDAP_FILTERGROUP)%' ldapFilteruser: '%env(resolve:LDAP_FILTERUSER)%' + ldapAutosubmit: '%env(resolve:LDAP_AUTOSUBMIT)%' + ldapAutoupdate: '%env(resolve:LDAP_AUTOUPDATE)%' casHost: '%env(resolve:CAS_HOST)%' casPort: '%env(resolve:CAS_PORT)%' @@ -62,6 +64,8 @@ parameters: casAvatar: '%env(resolve:CAS_AVATAR)%' casNiveau01: '%env(resolve:CAS_NIVEAU01)%' casGroup: '%env(resolve:CAS_GROUP)%' + casAutosubmit: '%env(resolve:CAS_AUTOSUBMIT)%' + casAutoupdate: '%env(resolve:CAS_AUTOUPDATE)%' oauthClientid: '%env(resolve:OAUTH_CLIENTID)%' oauthClientsecret: '%env(resolve:OAUTH_CLIENTSECRET)%' @@ -76,6 +80,8 @@ parameters: oauthAvatar: '%env(resolve:OAUTH_AVATAR)%' oauthNiveau01: '%env(resolve:OAUTH_NIVEAU01)%' oauthGroup: '%env(resolve:OAUTH_GROUP)%' + oauthAutosubmit: '%env(resolve:OAUTH_AUTOSUBMIT)%' + oauthAutoupdate: '%env(resolve:OAUTH_AUTOUPDATE)%' nineUrl: '%env(resolve:NINE_URL)%' nineSecret: '%env(resolve:NINE_SECRET)%' diff --git a/public/themes/look.png b/public/themes/look.png new file mode 100644 index 0000000..1a9fc5f Binary files /dev/null and b/public/themes/look.png differ diff --git a/public/themes/look.xcf b/public/themes/look.xcf new file mode 100644 index 0000000..6be1ab7 Binary files /dev/null and b/public/themes/look.xcf differ diff --git a/public/themes/nineblue/info.yml b/public/themes/nineblue/info.yml new file mode 100644 index 0000000..91c4bd2 --- /dev/null +++ b/public/themes/nineblue/info.yml @@ -0,0 +1,3 @@ +name: Nineblue +author: Arnaud Fornerot +version: 1.0 \ No newline at end of file diff --git a/public/themes/nineblue/local.js b/public/themes/nineblue/local.js new file mode 100644 index 0000000..e69de29 diff --git a/public/themes/nineblue/look.png b/public/themes/nineblue/look.png new file mode 100644 index 0000000..4ad7124 Binary files /dev/null and b/public/themes/nineblue/look.png differ diff --git a/public/themes/nineblue/style.css b/public/themes/nineblue/style.css new file mode 100644 index 0000000..0d7e115 --- /dev/null +++ b/public/themes/nineblue/style.css @@ -0,0 +1,47 @@ +:root{ + --colorbgbodydark: #038aff; + --colorfttitlelight: #038aff; + --colorbgbodydark-darker: #082169; + --colorfttitlelight-darker: #082169; + --colorbgbodydark-rgb: 58,83,155; + + /* Vous pouvez forcer l'ensemble de ces variables ou laisser la valeur par défaut + --colorbgbodylight: #; + --colorbgbodydark: #; + --colorfttitlelight: #; + --colorfttitledark: #; + --colorftbodylight: #; + --colorftbodydark: #; + --fontbody: ""; + --fonttitle: ""; + --fontsizeh1: px; + --fontsizeh2: px; + --fontsizeh3: px; + --fontsizeh4: px; + + --colorbgbodylight-darker: #; + --colorfttitlelight-darker: #; + --colorbgbodydark-darker: #; + --colorbgbodydark-rgb: R,V,G + */ +} + +/* Puis sur classer l'ensemble de la feuille de style */ + + + + + + + + + + + + + + + + + + diff --git a/public/themes/ninedark/info.yml b/public/themes/ninedark/info.yml new file mode 100644 index 0000000..6d46bd8 --- /dev/null +++ b/public/themes/ninedark/info.yml @@ -0,0 +1,3 @@ +name: Ninedark +author: Arnaud Fornerot +version: 1.0 \ No newline at end of file diff --git a/public/themes/ninedark/local.js b/public/themes/ninedark/local.js new file mode 100644 index 0000000..e69de29 diff --git a/public/themes/ninedark/look.png b/public/themes/ninedark/look.png new file mode 100644 index 0000000..533897f Binary files /dev/null and b/public/themes/ninedark/look.png differ diff --git a/public/themes/ninedark/style.css b/public/themes/ninedark/style.css new file mode 100644 index 0000000..d096f59 --- /dev/null +++ b/public/themes/ninedark/style.css @@ -0,0 +1,48 @@ +:root{ + --colorbgbodydark: #2e3131; + --colorfttitlelight: #2e3131; + --colorfttitlelight-darker: #95a5a6; + --colorbgbodydark-darker: #000000; + --colorfttitlelight-darker: #000000; + --colorbgbodydark-rgb: 46,49,49; + + /* Vous pouvez forcer l'ensemble de ces variables ou laisser la valeur par défaut + --colorbgbodylight: #; + --colorbgbodydark: #; + --colorfttitlelight: #; + --colorfttitledark: #; + --colorftbodylight: #; + --colorftbodydark: #; + --fontbody: ""; + --fonttitle: ""; + --fontsizeh1: px; + --fontsizeh2: px; + --fontsizeh3: px; + --fontsizeh4: px; + + --colorbgbodylight-darker: #; + --colorfttitlelight-darker: #; + --colorbgbodydark-darker: #; + --colorbgbodydark-rgb: R,V,G + */ +} + +/* Puis sur classer l'ensemble de la feuille de style */ + + + + + + + + + + + + + + + + + + diff --git a/public/themes/ninefulldark/info.yml b/public/themes/ninefulldark/info.yml new file mode 100644 index 0000000..3b9f00b --- /dev/null +++ b/public/themes/ninefulldark/info.yml @@ -0,0 +1,3 @@ +name: Ninefulldark +author: Arnaud Fornerot +version: 1.0 \ No newline at end of file diff --git a/public/themes/ninefulldark/local.js b/public/themes/ninefulldark/local.js new file mode 100644 index 0000000..e69de29 diff --git a/public/themes/ninefulldark/look.png b/public/themes/ninefulldark/look.png new file mode 100644 index 0000000..1184000 Binary files /dev/null and b/public/themes/ninefulldark/look.png differ diff --git a/public/themes/ninefulldark/style.css b/public/themes/ninefulldark/style.css new file mode 100644 index 0000000..7a55c23 --- /dev/null +++ b/public/themes/ninefulldark/style.css @@ -0,0 +1,73 @@ +:root{ + --colorbgbodydark: #2e3131; + --colorbgbodylight: #2e3131; + + --colorfttitledark: #ffffff; + --colorfttitlelight: #ffffff; + --colorftbodylight: #ffffff; + --colorfttitlelight: #ffffff; + + --colorfttitledark-darker: #95a5a6; + --colorfttitlelight-darker: #95a5a6; + + + --colorbgbodydark-rgb: 46,49,49; + + /* Vous pouvez forcer l'ensemble de ces variables ou laisser la valeur par défaut + --colorbgbodylight: #; + --colorbgbodydark: #; + --colorfttitlelight: #; + --colorfttitledark: #; + --colorftbodylight: #; + --colorftbodydark: #; + --fontbody: ""; + --fonttitle: ""; + --fontsizeh1: px; + --fontsizeh2: px; + --fontsizeh3: px; + --fontsizeh4: px; + + --colorbgbodylight-darker: #; + --colorfttitlelight-darker: #; + --colorbgbodydark-darker: #; + --colorbgbodydark-rgb: R,V,G + */ +} + +/* Puis sur classer l'ensemble de la feuille de style */ +.modal-content { + background-color: var(--colorbgbodydark); +} +.card-header { + color: var(--colorbgbodydark); +} +.card-body { + color: var(--colorbgbodydark); +} + +.card-body .table, +.card-body .table-hover > tbody > tr:hover > *, +.card-body .table-striped > tbody > tr:nth-of-type(odd) > * { + color: var(--colorbgbodydark); +} + +.card-body .table a { + color: var(--colorbgbodydark); +} + +.card-body .table a:hover { + color: var(--colorfttitlelight-darker); +} + + + + + + + + + + + + + diff --git a/public/themes/ninegray/info.yml b/public/themes/ninegray/info.yml new file mode 100644 index 0000000..c60fd67 --- /dev/null +++ b/public/themes/ninegray/info.yml @@ -0,0 +1,3 @@ +name: Ninegray +author: Arnaud Fornerot +version: 1.0 \ No newline at end of file diff --git a/public/themes/ninegray/local.js b/public/themes/ninegray/local.js new file mode 100644 index 0000000..e69de29 diff --git a/public/themes/ninegray/look.png b/public/themes/ninegray/look.png new file mode 100644 index 0000000..e6a1af6 Binary files /dev/null and b/public/themes/ninegray/look.png differ diff --git a/public/themes/ninegray/style.css b/public/themes/ninegray/style.css new file mode 100644 index 0000000..8a83b38 --- /dev/null +++ b/public/themes/ninegray/style.css @@ -0,0 +1,47 @@ +:root{ + --colorbgbodydark: #6c7a89; + --colorfttitlelight: #6c7a89; + --colorbgbodydark-darker: #3a4857; + --colorfttitlelight-darker: #3a4857; + --colorbgbodydark-rgb: 108,122,137; + + /* Vous pouvez forcer l'ensemble de ces variables ou laisser la valeur par défaut + --colorbgbodylight: #; + --colorbgbodydark: #; + --colorfttitlelight: #; + --colorfttitledark: #; + --colorftbodylight: #; + --colorftbodydark: #; + --fontbody: ""; + --fonttitle: ""; + --fontsizeh1: px; + --fontsizeh2: px; + --fontsizeh3: px; + --fontsizeh4: px; + + --colorbgbodylight-darker: #; + --colorfttitlelight-darker: #; + --colorbgbodydark-darker: #; + --colorbgbodydark-rgb: R,V,G + */ +} + +/* Puis sur classer l'ensemble de la feuille de style */ + + + + + + + + + + + + + + + + + + diff --git a/public/themes/ninegreen/info.yml b/public/themes/ninegreen/info.yml new file mode 100644 index 0000000..68634e9 --- /dev/null +++ b/public/themes/ninegreen/info.yml @@ -0,0 +1,3 @@ +name: Ninegreen +author: Arnaud Fornerot +version: 1.0 \ No newline at end of file diff --git a/public/themes/ninegreen/local.js b/public/themes/ninegreen/local.js new file mode 100644 index 0000000..e69de29 diff --git a/public/themes/ninegreen/look.png b/public/themes/ninegreen/look.png new file mode 100644 index 0000000..e2f114e Binary files /dev/null and b/public/themes/ninegreen/look.png differ diff --git a/public/themes/ninegreen/style.css b/public/themes/ninegreen/style.css new file mode 100644 index 0000000..bab6bda --- /dev/null +++ b/public/themes/ninegreen/style.css @@ -0,0 +1,43 @@ +:root{ + --colorfttitlelight: #1e824c; + --colorbgbodydark: #1e824c; + --colorbgbodydark-darker: #00501a; + --colorfttitlelight-darker: #00501a; + --colorbgbodydark-rgb: 30,130,76; + + /* Vous pouvez forcer l'ensemble de ces variables ou laisser la valeur par défaut + --colorbgbodylight: #; + --colorbgbodydark: #; + --colorfttitlelight: #; + --colorfttitledark: #; + --colorftbodylight: #; + --colorftbodydark: #; + --fontbody: ""; + --fonttitle: ""; + --fontsizeh1: px; + --fontsizeh2: px; + --fontsizeh3: px; + --fontsizeh4: px; + + --colorbgbodylight-darker: #; + --colorfttitlelight-darker: #; + --colorbgbodydark-darker: #; + --colorbgbodydark-rgb: R,V,G + */ +} + +/* Puis sur classer l'ensemble de la feuille de style */ + + + + + + + + + + + + + + diff --git a/public/themes/nineorange/info.yml b/public/themes/nineorange/info.yml new file mode 100644 index 0000000..93d1bbb --- /dev/null +++ b/public/themes/nineorange/info.yml @@ -0,0 +1,3 @@ +name: Nineorange +author: Arnaud Fornerot +version: 1.0 \ No newline at end of file diff --git a/public/themes/nineorange/local.js b/public/themes/nineorange/local.js new file mode 100644 index 0000000..e69de29 diff --git a/public/themes/nineorange/look.png b/public/themes/nineorange/look.png new file mode 100644 index 0000000..4106474 Binary files /dev/null and b/public/themes/nineorange/look.png differ diff --git a/public/themes/nineorange/style.css b/public/themes/nineorange/style.css new file mode 100644 index 0000000..bc62e4f --- /dev/null +++ b/public/themes/nineorange/style.css @@ -0,0 +1,47 @@ +:root{ + --colorbgbodydark: #f15a22; + --colorfttitlelight: #f15a22; + --colorbgbodydark-darker: #bf2800; + --colorfttitlelight-darker: #bf2800; + --colorbgbodydark-rgb: 241,90,34; + + /* Vous pouvez forcer l'ensemble de ces variables ou laisser la valeur par défaut + --colorbgbodylight: #; + --colorbgbodydark: #; + --colorfttitlelight: #; + --colorfttitledark: #; + --colorftbodylight: #; + --colorftbodydark: #; + --fontbody: ""; + --fonttitle: ""; + --fontsizeh1: px; + --fontsizeh2: px; + --fontsizeh3: px; + --fontsizeh4: px; + + --colorbgbodylight-darker: #; + --colorfttitlelight-darker: #; + --colorbgbodydark-darker: #; + --colorbgbodydark-rgb: R,V,G + */ +} + +/* Puis sur classer l'ensemble de la feuille de style */ + + + + + + + + + + + + + + + + + + diff --git a/public/themes/ninered/info.yml b/public/themes/ninered/info.yml new file mode 100644 index 0000000..6d111eb --- /dev/null +++ b/public/themes/ninered/info.yml @@ -0,0 +1,3 @@ +name: Ninered +author: Arnaud Fornerot +version: 1.0 \ No newline at end of file diff --git a/public/themes/ninered/local.js b/public/themes/ninered/local.js new file mode 100644 index 0000000..e69de29 diff --git a/public/themes/ninered/look.png b/public/themes/ninered/look.png new file mode 100644 index 0000000..5d7452e Binary files /dev/null and b/public/themes/ninered/look.png differ diff --git a/public/themes/ninered/style.css b/public/themes/ninered/style.css new file mode 100644 index 0000000..7f67895 --- /dev/null +++ b/public/themes/ninered/style.css @@ -0,0 +1,47 @@ +:root{ + --colorbgbodydark: #96281b; + --colorfttitlelight: #96281b; + --colorbgbodydark-darker: #640000; + --colorfttitlelight-darker: #640000; + --colorbgbodydark-rgb: 150,40,27; + + /* Vous pouvez forcer l'ensemble de ces variables ou laisser la valeur par défaut + --colorbgbodylight: #; + --colorbgbodydark: #; + --colorfttitlelight: #; + --colorfttitledark: #; + --colorftbodylight: #; + --colorftbodydark: #; + --fontbody: ""; + --fonttitle: ""; + --fontsizeh1: px; + --fontsizeh2: px; + --fontsizeh3: px; + --fontsizeh4: px; + + --colorbgbodylight-darker: #; + --colorfttitlelight-darker: #; + --colorbgbodydark-darker: #; + --colorbgbodydark-rgb: R,V,G + */ +} + +/* Puis sur classer l'ensemble de la feuille de style */ + + + + + + + + + + + + + + + + + + diff --git a/public/themes/nineyellow/info.yml b/public/themes/nineyellow/info.yml new file mode 100644 index 0000000..09debb8 --- /dev/null +++ b/public/themes/nineyellow/info.yml @@ -0,0 +1,3 @@ +name: Nineyellow +author: Arnaud Fornerot +version: 1.0 \ No newline at end of file diff --git a/public/themes/nineyellow/local.js b/public/themes/nineyellow/local.js new file mode 100644 index 0000000..e69de29 diff --git a/public/themes/nineyellow/look.png b/public/themes/nineyellow/look.png new file mode 100644 index 0000000..2fac204 Binary files /dev/null and b/public/themes/nineyellow/look.png differ diff --git a/public/themes/nineyellow/style.css b/public/themes/nineyellow/style.css new file mode 100644 index 0000000..e020afa --- /dev/null +++ b/public/themes/nineyellow/style.css @@ -0,0 +1,47 @@ +:root{ + --colorbgbodydark: #f7ca18; + --colorfttitlelight: #c59800; + --colorbgbodydark-darker: #c59800; + --colorfttitlelight-darker: #584403; + --colorbgbodydark-rgb: 247,202,24; + + /* Vous pouvez forcer l'ensemble de ces variables ou laisser la valeur par défaut + --colorbgbodylight: #; + --colorbgbodydark: #; + --colorfttitlelight: #; + --colorfttitledark: #; + --colorftbodylight: #; + --colorftbodydark: #; + --fontbody: ""; + --fonttitle: ""; + --fontsizeh1: px; + --fontsizeh2: px; + --fontsizeh3: px; + --fontsizeh4: px; + + --colorbgbodylight-darker: #; + --colorfttitlelight-darker: #; + --colorbgbodydark-darker: #; + --colorbgbodydark-rgb: R,V,G + */ +} + +/* Puis sur classer l'ensemble de la feuille de style */ + + + + + + + + + + + + + + + + + + diff --git a/src/Controller/PublishController.php b/src/Controller/PublishController.php index 4393df8..66c2345 100644 --- a/src/Controller/PublishController.php +++ b/src/Controller/PublishController.php @@ -9,11 +9,26 @@ use Symfony\Component\Mercure\Update; class PublishController extends AbstractController { + public function sample($id){ + return $this->render('Home/publishsample.html.twig',[ + 'id'=>$id + ]); + } + public function publish($channel, $id, Request $request, HubInterface $hub): Response { $ret=$request->get("msg"); $ret["from"]=[]; - $ret["from"]["id"]="tot"; + $ret["from"]["id"]=$this->getUser()->getId(); + $ret["from"]["username"]=$this->getUser()->getUsername(); + $ret["from"]["displayname"]=$this->getUser()->getDisplayname(); + + + if(stripos($this->getUser()->getAvatar(),"http")===0) + $ret["from"]["avatar"]=$this->getUser()->getAvatar(); + else + $ret["from"]["avatar"]=$this->getParameter('appAlias')."uploads/avatar/".$this->getUser()->getAvatar(); + $update = new Update( $channel."-".$id, json_encode( diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php index da44559..935b1fa 100755 --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -36,6 +36,14 @@ class SecurityController extends AbstractController $this->apiservice = $apiservice; } + public function noperm(Request $request) + { + return $this->render('Home/noperm.html.twig',[ + "useheader"=>true, + "usemenu"=>false, + ]); + } + public function login(Request $request, AuthenticationUtils $authenticationUtils,ManagerRegistry $em) { switch($this->getParameter("appAuth")) { @@ -111,21 +119,24 @@ class SecurityController extends AbstractController if(isset($attributes[$this->getParameter('casAvatar')])) $avatar = $attributes[$this->getParameter('casAvatar')]; - // Génération auto des niveau01s et des groupes en fonction des attributs sso - $this->submitSSONiveau01($attributes,$em); - $this->submitSSOGroup($attributes,$em); - // Rechercher l'utilisateur $user = $em->getRepository('App\Entity\User')->findOneBy(array("username"=>$username)); if (!$user) { + if(!$this->getParameter("casAutosubmit")) return $this->redirect($this->generateUrl('app_noperm')); + + $this->submitSSONiveau01($attributes,$em); + $this->submitSSOGroup($attributes,$em); $niveau01=$em->getRepository('App\Entity\Niveau01')->calculateSSONiveau01($attributes); $user=$this->submituser($username,$firstname,$lastname,$email,$password,$niveau01,$em); + $user=$em->getRepository('App\Entity\Group')->calculateSSOGroup($user,$attributes); } - else + elseif($this->getParameter("casAutoupdate")) { + $this->submitSSONiveau01($attributes,$em); + $this->submitSSOGroup($attributes,$em); $this->updateuser($user,$firstname,$lastname,$email,$avatar,$em); - - // On calcule les groupes de l'utilisateur - $user=$em->getRepository('App\Entity\Group')->calculateSSOGroup($user,$attributes); + $user=$em->getRepository('App\Entity\Group')->calculateSSOGroup($user,$attributes); + } + // Autoconnexion @@ -154,7 +165,6 @@ class SecurityController extends AbstractController $username=$request->get('login')["username"]; $password=$request->get('login')["password"]; - $appMasteridentity=$this->getParameter("appMasteridentity"); // Récupération de la cible de navigation $redirect = $request->getSession()->get("_security.main.target_path"); @@ -186,10 +196,11 @@ class SecurityController extends AbstractController $user = $em->getRepository('App\Entity\User')->findOneBy(array("username"=>$username)); if (!$user) { + if(!$this->getParameter("ldapAutosubmit")) return $this->redirect($this->generateUrl('app_noperm')); $niveau01=$em->getRepository('App\Entity\Niveau01')->calculateLDAPNiveau01($username); $user=$this->submituser($username,$firstname,$lastname,$email,$avatar,$niveau01,$em); } - else { + elseif($this->getParameter("ldapAutoupdate")) { $this->updateuser($user,$firstname,$lastname,$email,$avatar,$em); } @@ -267,21 +278,22 @@ class SecurityController extends AbstractController if(isset($attributes[$this->getParameter('oauthAvatar')])) $avatar = $attributes[$this->getParameter('oauthAvatar')]; - // Génération auto des niveau01s et des groupes en fonction des attributs sso - $this->submitSSONiveau01($attributes,$em); - $this->submitSSOGroup($attributes,$em); - // Rechercher l'utilisateur $user = $em->getRepository('App\Entity\User')->findOneBy(array("username"=>$username)); if (!$user) { + if(!$this->getParameter("oauthAutosubmit")) return $this->redirect($this->generateUrl('app_noperm')); + + $this->submitSSONiveau01($attributes,$em); + $this->submitSSOGroup($attributes,$em); $niveau01=$em->getRepository('App\Entity\Niveau01')->calculateSSONiveau01($attributes); $user=$this->submituser($username,$firstname,$lastname,$email,$avatar,$niveau01,$em); } - else + elseif($this->getParameter("oauthAutoupdate")) { + $this->submitSSONiveau01($attributes,$em); + $this->submitSSOGroup($attributes,$em); $this->updateuser($user,$firstname,$lastname,$email,$avatar,$em); - - // On calcule les groupes de l'utilisateur - $user=$em->getRepository('App\Entity\Group')->calculateSSOGroup($user,$attributes); + $user=$em->getRepository('App\Entity\Group')->calculateSSOGroup($user,$attributes); + } // Autoconnexion return $this->autoconnexion($user,$redirect,$request); diff --git a/src/Controller/ThemeController.php b/src/Controller/ThemeController.php new file mode 100644 index 0000000..47ad252 --- /dev/null +++ b/src/Controller/ThemeController.php @@ -0,0 +1,55 @@ +getParameter('kernel.project_dir')."/public/themes"; + $url=$this->getParameter('appAlias')."themes"; + + $finder->in($dir)->directories()->depth('== 0'); + $themes=[]; + $themes[""]["dir"]=""; + $themes[""]["url"]=$url; + $themes[""]["name"]="Thème par défaut"; + + foreach ($finder as $file) { + $key=$file->getRelativePathname(); + $themes[$key]["dir"]=$key; + $themes[$key]["url"]=$url."/".$key; + + $yml=Yaml::parseFile($dir.'/'.$key.'/info.yml'); + $themes[$key]["name"]=$yml["name"]; + } + + $current=$request->getSession()->get("apptheme"); + $currentheme=$themes[$current]; + unset($themes[$current]); + + return $this->render('Theme/list.html.twig',[ + 'useheader' => true, + 'usesidebar' => true, + 'currentheme' => $currentheme, + 'themes' => $themes + ]); + } + + public function select($name,Request $request,ManagerRegistry $em) + { + $config=$em->getRepository("App\Entity\Config")->findoneBy(["id"=>"apptheme"]); + $config->setValue($name); + + $em->getManager()->flush(); + + return $this->redirectToRoute("app_admin_theme"); + } +} diff --git a/src/Twig/AppExtension.php b/src/Twig/AppExtension.php index adc33f3..2b57ccb 100644 --- a/src/Twig/AppExtension.php +++ b/src/Twig/AppExtension.php @@ -1,9 +1,10 @@ container->getParameter("appAlias")."uploads/avatar/".$avatar; } + public function getUniqueId() { + return str_replace("-","",Uuid::uuid4()); + } + public function setContainer($container) { $this->container = $container; diff --git a/templates/Home/home.html.twig b/templates/Home/home.html.twig index 59f00fe..3cbebe8 100644 --- a/templates/Home/home.html.twig +++ b/templates/Home/home.html.twig @@ -2,81 +2,16 @@ {% block body %} {% if app.user %} - -
+
+
+

Chat #1

+ {{ render(path("app_publish_sample",{id:1})) }} +
+ +
+

Chat #2

+ {{ render(path("app_publish_sample",{id:2})) }} +
+
{% endif %} {% endblock %} - -{% block localscript %} -{% if app.user %} - -{% endif %} -{% endblock %} \ No newline at end of file diff --git a/templates/Home/loginLDAP.html.twig b/templates/Home/loginLDAP.html.twig index 15eda6f..93383e7 100755 --- a/templates/Home/loginLDAP.html.twig +++ b/templates/Home/loginLDAP.html.twig @@ -1,17 +1,9 @@ {% extends "base.html.twig" %} -{% block localstyle %} - -{% endblock %} - {% block body %}
-

{{appName}}

+

{{app.session.get('appname')}}

{{ form_start(form, {'action': path('app_loginldapcheck'), 'method': 'POST'}) }}
diff --git a/templates/Home/loginSQL.html.twig b/templates/Home/loginSQL.html.twig index d623da7..e5f2792 100755 --- a/templates/Home/loginSQL.html.twig +++ b/templates/Home/loginSQL.html.twig @@ -1,17 +1,11 @@ {% extends "base.html.twig" %} -{% block localstyle %} - -{% endblock %} + {% block body %}
-

{{appName}}

+

{{app.session.get('appname')}}

diff --git a/templates/Home/noperm.html.twig b/templates/Home/noperm.html.twig new file mode 100644 index 0000000..23b83d5 --- /dev/null +++ b/templates/Home/noperm.html.twig @@ -0,0 +1,20 @@ +{% extends "base.html.twig" %} + +{% block body %} + Vous avez pu vous connecter à {{ app.session.get('appname') }} mais vous n'avez aucun compte sur l'application.
+ Contacter votre administrateur si vous souhaitez y accéder.

+ Vous allez être déconnectés d'ici quelques secondes. +{% endblock %} + +{% block localscript %} + + + +{% endblock %} \ No newline at end of file diff --git a/templates/Home/publishsample.html.twig b/templates/Home/publishsample.html.twig new file mode 100644 index 0000000..9441910 --- /dev/null +++ b/templates/Home/publishsample.html.twig @@ -0,0 +1,95 @@ +{% if app.user %} +{% set idwidget=uniqueId() %} +
+ + +
+
+
+ + +{% endif %} \ No newline at end of file diff --git a/templates/Include/sidebaradmin.html.twig b/templates/Include/sidebaradmin.html.twig index 2f11f07..bd3ab0e 100644 --- a/templates/Include/sidebaradmin.html.twig +++ b/templates/Include/sidebaradmin.html.twig @@ -9,6 +9,12 @@ route: 'app_admin_config', name: 'Général', }, + + { + icon: 'fas fa-paint-brush', + route: 'app_admin_theme', + name: 'Thème', + }, ] }, { diff --git a/templates/Theme/list.html.twig b/templates/Theme/list.html.twig new file mode 100644 index 0000000..97c0b80 --- /dev/null +++ b/templates/Theme/list.html.twig @@ -0,0 +1,29 @@ +{% extends 'base.html.twig' %} + +{% block body %} +

Thèmes

+ +

Thème en cours

+
+
+ {{currentheme.name}} +
+ +

Thèmes disponibles

+ +
+ {% for theme in themes %} +
+
+ {{theme.name}}
+ Sélectionner +
+ {% endfor %} +
+{% endblock %} + + + + + + diff --git a/templates/User/list.html.twig b/templates/User/list.html.twig index a60d732..cbc6d17 100644 --- a/templates/User/list.html.twig +++ b/templates/User/list.html.twig @@ -14,7 +14,7 @@
- +
{% if access=="admin" or access=="modo"%} @@ -44,7 +44,6 @@ $(document).ready(function() { $('#dataTables').DataTable({ columnDefs: [ { "targets": 'no-sort', "orderable": false },{ "targets": 'no-visible', "visible": false } ], - responsive: true, iDisplayLength: 100, processing: true, serverSide: true, diff --git a/templates/base.html.twig b/templates/base.html.twig index 3cd53c7..edf7e42 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -12,6 +12,10 @@ {{ include('Include/style.css.twig') }} + {% if not app.session.get("apptheme") is empty %} + + {% endif %} + {% block localstyle %}{% endblock %}