]> git.mxchange.org Git - friendica-addons.git/blobdiff - ldapauth/ldapauth.php
[various] Remove App dependency from hook functions
[friendica-addons.git] / ldapauth / ldapauth.php
index 1043c4d876c8d45a62ddaa1ceb1d2a5a17b32e40..38e2d6a1ec16c4423e4c75a3575ab3b90d608696 100644 (file)
  * Note when using with Windows Active Directory: you may need to set TLS_CACERT in your site
  * ldap.conf file to the signing cert for your LDAP server.
  *
- * The configuration options for this module may be set in the config/addon.config.php file
- * e.g.:
- *
- * [ldapauth]
- * ; ldap hostname server - required
- * ldap_server = host.example.com
- * ; dn to search users - required
- * ldap_searchdn = ou=users,dc=example,dc=com
- * ; attribute to find username - required
- * ldap_userattr = uid
- *
- * ; admin dn - optional - only if ldap server dont have anonymous access
- * ldap_binddn = cn=admin,dc=example,dc=com
- * ; admin password - optional - only if ldap server dont have anonymous access
- * ldap_bindpw = password
- *
- * ; for create Friendica account if user exist in ldap
- * ;     required an email and a simple (beautiful) nickname on user ldap object
- * ;   active account creation - optional - default none
- * ldap_autocreateaccount = true
- * ;   attribute to get email - optional - default : 'mail'
- * ldap_autocreateaccount_emailattribute = mail
- * ;   attribute to get nickname - optional - default : 'givenName'
- * ldap_autocreateaccount_nameattribute = cn
- *
- * ...etc.
+ * The configuration options for this module are described in the config/ldapauth.config.php file
  */
 
+use Friendica\App;
 use Friendica\Core\Hook;
 use Friendica\Core\Logger;
 use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\User;
-use Friendica\Util\ConfigFileLoader;
+use Friendica\Core\Config\Util\ConfigFileManager;
 
 function ldapauth_install()
 {
@@ -67,12 +43,12 @@ function ldapauth_install()
        Hook::register('authenticate', 'addon/ldapauth/ldapauth.php', 'ldapauth_hook_authenticate');
 }
 
-function ldapauth_load_config(\Friendica\App $a, ConfigFileLoader $loader)
+function ldapauth_load_config(ConfigFileManager $loader)
 {
-       $a->getConfigCache()->load($loader->loadAddonConfig('ldapauth'));
+       DI::app()->getConfigCache()->load($loader->loadAddonConfig('ldapauth'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
 }
 
-function ldapauth_hook_authenticate($a, &$b)
+function ldapauth_hook_authenticate(array &$b)
 {
        $user = ldapauth_authenticate($b['username'], $b['password']);
        if (!empty($user['uid'])) {