1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-13 20:28:44 +01:00

[ticket/11626] Remove LDAP dependency on template

Returns template vars rather than requiring the template.

PHPBB3-11626
This commit is contained in:
Joseph Warner 2013-07-12 15:53:36 -04:00
parent f24a8e5b81
commit 631ce22f2c
4 changed files with 25 additions and 19 deletions

View File

@ -33,6 +33,5 @@ services:
- @dbal.conn
- @config
- @user
- @template
tags:
- { name: auth.provider }

View File

@ -658,8 +658,9 @@ class acp_board
$auth_tpl = $provider->get_acp_template($this->new_config);
if ($auth_tpl)
{
$template->assign_vars($auth_tpl['TEMPLATE_VARS']);
$template->assign_block_vars('auth_tpl', array(
'TEMPLATE_FILE' => $auth_tpl,
'TEMPLATE_FILE' => $auth_tpl['TEMPLATE_FILE'],
));
}
}

View File

@ -72,9 +72,14 @@ interface phpbb_auth_provider_interface
* 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.
* @return array|null Returns null if not implemented or an array with
* the template file name and an array of the vars
* that the template needs that must conform to the
* following example:
* array(
* 'TEMPLATE_FILE' => string,
* 'TEMPLATE_VARS' => array(...),
* )
*/
public function get_acp_template($new_config);

View File

@ -30,14 +30,12 @@ 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, phpbb_template $template)
public function __construct(phpbb_db_driver $db, phpbb_config $config, phpbb_user $user)
{
$this->db = $db;
$this->config = $config;
$this->user = $user;
$this->template = $template;
}
/**
@ -302,18 +300,21 @@ class phpbb_auth_provider_ldap extends phpbb_auth_provider_base
*/
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'],
));
$this->template->assign_vars();
return 'auth_provider_ldap.html';
return array(
'TEMPLATE_FILE' => 'auth_provider_ldap.html',
'TEMPLATE_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'],
),
);
}
/**