diff --git a/conf/class.auth.ldap.php b/conf/class.auth.ldap.php index d6ab2e2..49ddcc9 100644 --- a/conf/class.auth.ldap.php +++ b/conf/class.auth.ldap.php @@ -1,13 +1,15 @@ userExists($user_id)) + if (App::users()->userExists($user_id)) { - $this->sudo(array(dcCore::app(), 'updUser'), $user_id, $cur); + $this->sudo(array(App::users(), 'updUser'), $user_id, $cur); } # If not, we create him. # In order for him to connect, @@ -69,7 +71,7 @@ class ldapDcAuth extends Auth $cur->user_lang = 'fr'; # Can change this, PR are welcome $cur->user_tz = 'Europe/Paris'; # Can change this, PR are welcome $cur->user_default_blog = 'default'; # Can change this, PR are welcome - $this->sudo(array(dcCore::app(),'addUser'), $cur); + $this->sudo(array(App::users(),'addUser'), $cur); # Possible roles: # admin "administrator" # contentadmin "manage all entries and comments" @@ -100,7 +102,7 @@ class ldapDcAuth extends Auth $set_perms[$perm_id] = true; } } - $this->sudo(array(dcCore::app(), 'setUserBlogPermissions'), $user_id, 'default', $set_perms, true); + $this->sudo(array(App::users(), 'setUserBlogPermissions'), $user_id, 'default', $set_perms, true); } $this->con->commit(); diff --git a/scripts/install b/scripts/install index 19755e4..f04c718 100755 --- a/scripts/install +++ b/scripts/install @@ -95,8 +95,10 @@ ynh_add_config --template="../conf/class.auth.ldap.php" --destination="$install_ cat << EOF >> $php_config -require dirname(__FILE__).'/class.auth.ldap.php'; -define('DC_AUTH_CLASS','ldapDcAuth'); +require_once dirname(__FILE__).'/class.auth.ldap.php'; +define('DC_AUTH_LDAP','ldapDcAuth'); +use Dotclear\Helper\Container\Factories; +Factories::addService("core", AuthInterface::class, DC_AUTH_LDAP); EOF ynh_store_file_checksum --file=$php_config diff --git a/scripts/upgrade b/scripts/upgrade index 74f06d6..dbcf199 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -116,8 +116,10 @@ ynh_add_config --template="../conf/class.auth.ldap.php" --destination="$install_ cat << EOF >> $php_config -require dirname(__FILE__).'/class.auth.ldap.php'; -define('DC_AUTH_CLASS','ldapDcAuth'); +require_once dirname(__FILE__).'/class.auth.ldap.php'; +define('DC_AUTH_LDAP','ldapDcAuth'); +use Dotclear\Helper\Container\Factories; +Factories::addService("core", AuthInterface::class, DC_AUTH_LDAP); EOF # Recalculate and store the checksum of the file for the next upgrade.