aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoseph Warner <hardolaf@hardolaf.com>2013-07-05 13:31:05 -0400
committerJoseph Warner <hardolaf@hardolaf.com>2013-07-11 15:49:45 -0400
commitb0e6b1dd98a6458d9a6d1c40369dfd8402411077 (patch)
treed378e2425a4c89cfcf3f82ef7ddd863f94030f5c
parent9c0495664d8d89c5ee8e6187e40afbe353acf033 (diff)
downloadforums-b0e6b1dd98a6458d9a6d1c40369dfd8402411077.tar
forums-b0e6b1dd98a6458d9a6d1c40369dfd8402411077.tar.gz
forums-b0e6b1dd98a6458d9a6d1c40369dfd8402411077.tar.bz2
forums-b0e6b1dd98a6458d9a6d1c40369dfd8402411077.tar.xz
forums-b0e6b1dd98a6458d9a6d1c40369dfd8402411077.zip
[ticket/11626] Create get_acp_template method for auth providers
PHPBB3-11626
-rw-r--r--phpBB/config/auth_providers.yml1
-rw-r--r--phpBB/includes/auth/provider/base.php8
-rw-r--r--phpBB/includes/auth/provider/interface.php13
-rw-r--r--phpBB/includes/auth/provider/ldap.php20
4 files changed, 41 insertions, 1 deletions
diff --git a/phpBB/config/auth_providers.yml b/phpBB/config/auth_providers.yml
index bcc448e4d7..3136e60584 100644
--- a/phpBB/config/auth_providers.yml
+++ b/phpBB/config/auth_providers.yml
@@ -33,5 +33,6 @@ services:
- @dbal.conn
- @config
- @user
+ - @template
tags:
- { name: auth.provider }
diff --git a/phpBB/includes/auth/provider/base.php b/phpBB/includes/auth/provider/base.php
index f28f352e2c..d1de9647df 100644
--- a/phpBB/includes/auth/provider/base.php
+++ b/phpBB/includes/auth/provider/base.php
@@ -49,6 +49,14 @@ abstract class phpbb_auth_provider_base implements phpbb_auth_provider_interface
/**
* {@inheritdoc}
*/
+ public function get_acp_template($new_config)
+ {
+ return;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
public function logout($data, $new_session)
{
return;
diff --git a/phpBB/includes/auth/provider/interface.php b/phpBB/includes/auth/provider/interface.php
index 2d1935f8f0..fe2415ee25 100644
--- a/phpBB/includes/auth/provider/interface.php
+++ b/phpBB/includes/auth/provider/interface.php
@@ -72,6 +72,19 @@ interface phpbb_auth_provider_interface
public function acp($new);
/**
+ * This function updates the template with variables related to the acp
+ * options with whatever configuraton values are passed to it as an array.
+ * It then returns the name of the acp file related to this authentication
+ * provider.
+ * @param array $new_config Contains the new configuration values that
+ * have been set in acp_board.
+ * @return string|null Returns null if not implemented or a string
+ * containing the name of the acp tempalte file for
+ * the authentication provider.
+ */
+ public function get_acp_template($new_config);
+
+ /**
* Performs additional actions during logout.
*
* @param array $data An array corresponding to
diff --git a/phpBB/includes/auth/provider/ldap.php b/phpBB/includes/auth/provider/ldap.php
index e10986abf0..9fc064a847 100644
--- a/phpBB/includes/auth/provider/ldap.php
+++ b/phpBB/includes/auth/provider/ldap.php
@@ -30,8 +30,9 @@ class phpbb_auth_provider_ldap extends phpbb_auth_provider_base
* @param phpbb_db_driver $db
* @param phpbb_config $config
* @param phpbb_user $user
+ * @param phpbb_template $template
*/
- public function __construct(phpbb_db_driver $db, phpbb_config $config, phpbb_user $user)
+ public function __construct(phpbb_db_driver $db, phpbb_config $config, phpbb_user $user, phpbb_template $template)
{
$this->db = $db;
$this->config = $config;
@@ -332,6 +333,23 @@ class phpbb_auth_provider_ldap extends phpbb_auth_provider_base
}
/**
+ * {@inheritdoc}
+ */
+ public function get_acp_template($new_config)
+ {
+ $this->template->assign_vars(array(
+ 'AUTH_LDAP_DN' => $new_config['ldap_base_dn'],
+ 'AUTH_LDAP_EMAIL' => $new_config['ldap_email'],
+ 'AUTH_LDAP_PASSORD' => $new_config['ldap_password'],
+ 'AUTH_LDAP_PORT' => $new_config['ldap_port'],
+ 'AUTH_LDAP_SERVER' => $new_config['ldap_server'],
+ 'AUTH_LDAP_UID' => $new_config['ldap_uid'],
+ 'AUTH_LDAP_USER' => $new_config['ldap_user'],
+ 'AUTH_LDAP_USER_FILTER' => $new_config['ldap_user_filter'],
+ ));
+ }
+
+ /**
* Generates a filter string for ldap_search to find a user
*
* @param $username string Username identifying the searched user