1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/rainloop_ynh.git synced 2024-09-03 20:16:18 +02:00

Merge pull request #11 from Djip007/master

qq petites corrections
This commit is contained in:
Djip007 2015-10-25 01:25:12 +02:00
commit 673d58c58b
2 changed files with 6 additions and 36 deletions

View file

@ -19,13 +19,8 @@ app=rainloop
# the old version is not deleted... the new version is in a new path
# Use of latest community edition
<<<<<<< HEAD
sudo unzip -q ../sources/rainloop-community.zip -d $rainloop_path/
=======
sudo unzip ../sources/rainloop-community.zip -d $rainloop_path/
>>>>>>> origin/test
# Update patch to auto load version
sudo cp ../sources/patch/index_auto_version.php $rainloop_path/index.php

View file

@ -1,23 +1,10 @@
<?php
class YnhLoginMappingPlugin extends \RainLoop\Plugins\AbstractPlugin {
public function Init() {
// $this->addHook('filter.login-credentials.step-1', 'FilterLoginСredentials1');
// $this->addHook('filter.login-credentials.step-2', 'FilterLoginСredentials2');
$this->addHook ( 'filter.login-credentials', 'FilterLoginСredentials' );
}
/* // ca ne semble pas marcher...
* public function FilterLoginCredentials1(&$sEmail, &$sPassword) {
* $this->Manager()->Actions()->Logger()->Write('LdapLoginMappingPlugin::FilterLoginСredentials_S1:');
* }
*/
/* // ca non plus...
* public function FilterLoginCredentials2(&$sEmail, &$sPassword) {
* $this->Manager()->Actions()->Logger()->Write('LdapLoginMappingPlugin::FilterLoginСredentials_S2:');
* }
*/
/**
*
* @param string $sEmail
@ -27,13 +14,13 @@ class YnhLoginMappingPlugin extends \RainLoop\Plugins\AbstractPlugin {
* @throws \RainLoop\Exceptions\ClientException
*/
public function FilterLoginСredentials(&$sEmail, &$sLogin, &$sPassword) {
$this->Manager()->Actions()->Logger()->Write('LdapLoginMappingPlugin::FilterLoginСredentials IN => '.$sEmail.'/'.$sLogin, \MailSo\Log\Enumerations\Type::INFO);
$this->Manager()->Actions()->Logger()->Write('YnhLoginMappingPlugin::FilterLoginСredentials IN => '.$sEmail.'/'.$sLogin, \MailSo\Log\Enumerations\Type::INFO);
// connection au ldap ynh... en local
$cnx = ldap_connect (); // single connection
if (! $cnx) {
$this->Manager()->Actions()->Logger()->Write('LdapLoginMappingPlugin: Could not connect to LDAP server', \MailSo\Log\Enumerations\Type::ERROR );
$this->Manager()->Actions()->Logger()->Write('YnhLoginMappingPlugin: Could not connect to LDAP server', \MailSo\Log\Enumerations\Type::ERROR );
return;
}
@ -52,7 +39,7 @@ class YnhLoginMappingPlugin extends \RainLoop\Plugins\AbstractPlugin {
// OK un petit recherche
$sr = ldap_search ( $cnx, $dn, $filter, $justthese );
if (!$sr) {
$this->Manager()->Actions()->Logger()->Write('LdapLoginMappingPlugin: search on LDAP server', \MailSo\Log\Enumerations\Type::ERROR );
$this->Manager()->Actions()->Logger()->Write('YnhLoginMappingPlugin: search on LDAP server', \MailSo\Log\Enumerations\Type::ERROR );
return;
}
$result = ldap_get_entries ( $cnx, $sr );
@ -61,22 +48,10 @@ class YnhLoginMappingPlugin extends \RainLoop\Plugins\AbstractPlugin {
if (($result['count'] > 0) && ($result[0]['uid']['count'] > 0)) {
$sLogin = $result[0]['uid'][0];
} else {
$this->Manager()->Actions()->Logger()->Write('LdapLoginMappingPlugin: user not found', \MailSo\Log\Enumerations\Type::ERROR );
$this->Manager()->Actions()->Logger()->Write('YnhLoginMappingPlugin: user not found', \MailSo\Log\Enumerations\Type::ERROR );
}
$this->Manager()->Actions()->Logger()->Write('LdapLoginMappingPlugin::FilterLoginСredentials OUT => '. $sEmail.'/'.$sLogin, \MailSo\Log\Enumerations\Type::INFO );
$this->Manager()->Actions()->Logger()->Write('YnhLoginMappingPlugin::FilterLoginСredentials OUT => '. $sEmail.'/'.$sLogin, \MailSo\Log\Enumerations\Type::INFO );
}
/*
* // pas encore de configuration...
* public function configMapping()
* {
* return array(
* \RainLoop\Plugins\Property::NewInstance('mapping')->SetLabel('Mapping')
* ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT)
* ->SetDescription('email:login mapping')
* ->SetDefaultValue("user@domain.com:user.bob\nadmin@domain.com:user.john2")
* );
* }
*/
}