3liz / lizmap-web-client

Transfer a QGIS project on a server, Lizmap is providing the web interface to browse it
https://www.lizmap.com
Mozilla Public License 2.0
257 stars 143 forks source link

ldap authentication #2750

Closed prahout59 closed 2 years ago

prahout59 commented 2 years ago

I want to activate ldap authentication in the lizmap container but, after a whole working day, I've always the same error

_lizmap1 | 2022-01-31 16:59:15 [615] ldap profile name is missing /www/lizmap/vendor/jelix/ldapdao-module/ldapdao/plugins/auth/ldapdao/ldapdao.auth.php 39

As soon as I active ldapdao driver, the lizmap container does not start with the message concerning ldap profile name

My localconfig.ini.php is ok

_[coordpluginauth] ;; uncomment it if you want to use ldap for authentication ;; see documentation to complete the ldap configuration driver=ldapdao

_[coordplugins] lizmap=lizmapConfig.ini.php auth=authldap.coord.ini.php__

Le fichier profiles.ini.php contient bien la section avec la configuration ldap image

et le fichier authldap.coord.ini.php contient la ligne indiquant le profile à utiliser ; profile to use for ldap ldapprofile = "lizmapldap"

J'utilise les dernières images lizmap 3.5

J'ai eu beau chercher, je n'ai rien trouvé. Je pourrais modifier le fichier /www/lizmap/vendor/jelix/ldapdao-module/ldapdao/plugins/auth/ldapdao/ldapdao.auth.php mais, ce n'est pas une bonne idéee, je pense.

Pouvez-vous m'aider rapidement. Je suis un peu en retard sur ce sujet.

dmarteau commented 2 years ago

Issue transfered to https://github.com/3liz/lizmap-web-client/issues/2750

rldhont commented 2 years ago

@prahout59 I have transfered your issue to lizmap-web-client where it is more relevant.

prahout59 commented 2 years ago

Pour information, j'ai modifié le fichier ldapdao.auth.php comme suit :

parent::__construct($params);

    if (!isset($this->_params['ldapprofile']) || $this->_params['ldapprofile'] == '') {
        $this->_params['ldapprofile'] = 'lizmapldap';
        // throw new jException('ldapdao~errors.ldap.profile.missing');
    }
    $this->_params['dao'] = 'jauthdb~jelixuser';
    $this->_params['profile'] = 'jauth';
    $this->_params['jelixAdminLogin'] = 'admin';

    $profile = jProfiles::get('ldap', $this->_params['ldapprofile']);
    //jMessage::add('constructeur de  de la classe');

Je n'ai plus les erreurs de jlog mais, cela ne fonctionne pas correctement.

Quand j'active le module ldapdao dan localconfig.ini.php

Quand je désactive le module ldapdao

J'espère que cela vous aidera 💯

ldapdao.auth - Copie.txt

prahout59 commented 2 years ago

Après avoir perdu beaucoup de temps en ajoutant des traces dans le fichier ldapdao.auth.php, il s'avère que l'erreur vient du module jcommunity. La propriété cDaoRecord_jauthdb_Jx_jelixuser_Jx_sqlite3::$status est inconnue.

_2022-02-08 09:25:38 192.168.22.26 notice 2022-02-08 09:25:38 [8] Undefined property: cDaoRecord_jauthdb_Jx_jelixuser_Jxsqlite3::$status /www/lizmap/vendor/jelix/jcommunity-module/modules/jcommunity/classes/authcommunity.listener.php

En la forçant comme suit, cela fonctionne parfaitement.

_class authcommunityListener extends jEventListener{

/* */ function onAuthCanLogin ($event) { // debut ajout pra $event->getParam('user')->status=true; // fin ajout pra $event->Add(array('canlogin'=> ($event->getParam('user')->status >= Account::STATUSVALID))); } }

J'investiguerai plus tard car d'autres propriétés sont inconnues

_2022-02-08 09:32:46 192.168.22.26 notice 2022-02-08 09:32:46 [8] Undefined property: cDaoRecord_jauthdb_Jx_jelixuser_Jx_sqlite3::$firstname /www/temp/lizmap/www/compiled/templates/modules/lizmap/user_menu_html_t_15.php 22

2022-02-08 09:32:46 192.168.22.26 notice 2022-02-08 09:32:46 [8] Undefined property: cDaoRecord_jauthdb_Jx_jelixuser_Jx_sqlite3::$lastname /www/temp/lizmap/www/compiled/templates/modules/lizmap/user_menu_html_t15.php 23

A suivre

rldhont commented 2 years ago

@prahout59 pouvez-vous reverser vos corrections dans:

prahout59 commented 2 years ago

Je ne pense pas que ce soit une erreur du module jcommunity mais plutôt un défaut de paramétrage de ce module dans l'image docker lizmap actuelle. La configuration est bien indiquée dans la description jcommunity mais n'est pas présente dans les fichiers de configuration lizmap.

jCommunity installation

La modification de la classe authcommunityListener extends jEventListener permet seulement de contourner ce défaut en attendant la mise à jour de l'image. J'ai ajouté un volume docker vers le fichier /www/lizmap/vendor/jelix/jcommunity-module/modules/jcommunity/classes/authcommunity.listener.php afin de le rendre persistant mais le mieux serait d'avoir une image lizmap avec la configuration complète du module jcommunity.

@rldhont : qu'en pensez-vous ?

3liz-bot commented 2 years ago

Hiya! This issue has gone quiet. 👻 We get a few questions in the bug tracker, so we currently slowly closing issues. If we missed this issue or if you want to keep it open, please reply here. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Thanks for being a part of the Lizmap community! 🦎