[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 - @dbal.conn
- @config - @config
- @user - @user
- @template
tags: tags:
- { name: auth.provider } - { name: auth.provider }

View file

@ -658,8 +658,9 @@ class acp_board
$auth_tpl = $provider->get_acp_template($this->new_config); $auth_tpl = $provider->get_acp_template($this->new_config);
if ($auth_tpl) if ($auth_tpl)
{ {
$template->assign_vars($auth_tpl['TEMPLATE_VARS']);
$template->assign_block_vars('auth_tpl', array( $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. * provider.
* @param array $new_config Contains the new configuration values that * @param array $new_config Contains the new configuration values that
* have been set in acp_board. * have been set in acp_board.
* @return string|null Returns null if not implemented or a string * @return array|null Returns null if not implemented or an array with
* containing the name of the acp tempalte file for * the template file name and an array of the vars
* the authentication provider. * 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); 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_db_driver $db
* @param phpbb_config $config * @param phpbb_config $config
* @param phpbb_user $user * @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->db = $db;
$this->config = $config; $this->config = $config;
$this->user = $user; $this->user = $user;
$this->template = $template;
} }
/** /**
@ -302,7 +300,11 @@ class phpbb_auth_provider_ldap extends phpbb_auth_provider_base
*/ */
public function get_acp_template($new_config) public function get_acp_template($new_config)
{ {
$this->template->assign_vars(array( $this->template->assign_vars();
return array(
'TEMPLATE_FILE' => 'auth_provider_ldap.html',
'TEMPLATE_VARS' => array(
'AUTH_LDAP_DN' => $new_config['ldap_base_dn'], 'AUTH_LDAP_DN' => $new_config['ldap_base_dn'],
'AUTH_LDAP_EMAIL' => $new_config['ldap_email'], 'AUTH_LDAP_EMAIL' => $new_config['ldap_email'],
'AUTH_LDAP_PASSORD' => $new_config['ldap_password'], 'AUTH_LDAP_PASSORD' => $new_config['ldap_password'],
@ -311,9 +313,8 @@ class phpbb_auth_provider_ldap extends phpbb_auth_provider_base
'AUTH_LDAP_UID' => $new_config['ldap_uid'], 'AUTH_LDAP_UID' => $new_config['ldap_uid'],
'AUTH_LDAP_USER' => $new_config['ldap_user'], 'AUTH_LDAP_USER' => $new_config['ldap_user'],
'AUTH_LDAP_USER_FILTER' => $new_config['ldap_user_filter'], 'AUTH_LDAP_USER_FILTER' => $new_config['ldap_user_filter'],
)); ),
);
return 'auth_provider_ldap.html';
} }
/** /**