From 0d6fed4707d8305e7731b3ed5a1583f5351ce61a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 6 Oct 2023 22:05:17 +0200 Subject: [PATCH] fix --- conf/config.local.php | 53 +++---------------------------------------- manifest.toml | 3 +++ 2 files changed, 6 insertions(+), 50 deletions(-) diff --git a/conf/config.local.php b/conf/config.local.php index 18f58e0..a71362d 100644 --- a/conf/config.local.php +++ b/conf/config.local.php @@ -58,56 +58,9 @@ const SECRET_KEY = '__SECRET_KEY__'; //const LOCAL_LOGIN = null; -const LDAP_HOST = 'localhost'; -const LDAP_DN = 'cn=%s,ou=users,dc=yunohost,dc=org'; - -session_start(); - -if (empty($_SESSION['ldap_user']) && !empty($_POST['ldap_login']) && !empty($_POST['ldap_password'])) { - $l = ldap_connect(LDAP_HOST) || die('Connexion impossible'); - ldap_set_option($l, LDAP_OPT_PROTOCOL_VERSION, 3); - ldap_set_option($l, LDAP_OPT_REFERRALS, 0); - ldap_set_option($l, LDAP_OPT_NETWORK_TIMEOUT, 10); - - $login = trim($_POST['ldap_login']); - - if (ldap_bind($l, sprintf(LDAP_DN, $login), $_POST['ldap_password'])) { - $_SESSION['ldap_user'] = $login; - } - - ldap_close($l); -} - -if (empty($_SESSION['ldap_user'])) { - echo ' - -
- - - '; - exit; -} - -define('Garradin\LOCAL_LOGIN', [ +const LOCAL_LOGIN = [ 'user' => [ - '_name' => $_SESSION['ldap_user'], + '_name' => '__ADMIN__', ], 'permissions' => [ 'users' => 9, @@ -116,7 +69,7 @@ define('Garradin\LOCAL_LOGIN', [ 'documents' => 9, 'config' => 9, ], -]); +]; /** * Autoriser (ou non) l'import de sauvegarde qui a été modifiée ? diff --git a/manifest.toml b/manifest.toml index 9aa5dec..719d550 100644 --- a/manifest.toml +++ b/manifest.toml @@ -38,6 +38,9 @@ ram.runtime = "50M" type = "group" default = "visitors" + [install.admin] + type = "user" + [resources] [resources.sources.main] url = "https://fossil.kd2.org/paheko/uv/paheko-1.3.0.tar.gz"