Add user_description_attribute option

Adds user_description_attribute mapping support to the LDAP backend

Change-Id: Ibf14f741f95febac5f5e857a73690477e2739f55
Closes-Bug: #1736912
This commit is contained in:
ZhongShengping
2018-01-02 10:55:53 +08:00
parent 0326936e4e
commit a55b9e4efe
5 changed files with 184 additions and 164 deletions

View File

@@ -49,6 +49,10 @@
# LDAP attribute mapped to user name. (string value)
# Defaults to 'undef'
#
# [*user_description_attribute*]
# LDAP attribute mapped to user description. (string value)
# Defaults to 'undef'
#
# [*user_mail_attribute*]
# LDAP attribute mapped to user email. (string value)
#
@@ -395,6 +399,7 @@ class keystone::ldap(
$user_objectclass = undef,
$user_id_attribute = undef,
$user_name_attribute = undef,
$user_description_attribute = undef,
$user_mail_attribute = undef,
$user_enabled_attribute = undef,
$user_enabled_mask = undef,
@@ -505,6 +510,7 @@ class keystone::ldap(
'ldap/user_objectclass': value => $user_objectclass;
'ldap/user_id_attribute': value => $user_id_attribute;
'ldap/user_name_attribute': value => $user_name_attribute;
'ldap/user_description_attribute': value => $user_description_attribute;
'ldap/user_mail_attribute': value => $user_mail_attribute;
'ldap/user_enabled_attribute': value => $user_enabled_attribute;
'ldap/user_enabled_mask': value => $user_enabled_mask;

View File

@@ -52,6 +52,10 @@
# LDAP attribute mapped to user name. (string value)
# Defaults to 'undef'
#
# [*user_description_attribute*]
# LDAP attribute mapped to user description. (string value)
# Defaults to 'undef'
#
# [*user_mail_attribute*]
# LDAP attribute mapped to user email. (string value)
#
@@ -399,6 +403,7 @@ define keystone::ldap_backend(
$user_objectclass = undef,
$user_id_attribute = undef,
$user_name_attribute = undef,
$user_description_attribute = undef,
$user_mail_attribute = undef,
$user_enabled_attribute = undef,
$user_enabled_mask = undef,
@@ -428,7 +433,7 @@ define keystone::ldap_backend(
$project_allow_delete = undef,
$project_enabled_emulation = undef,
$project_enabled_emulation_dn = undef,
$project_additional_attribute_mapping= undef,
$project_additional_attribute_mapping = undef,
$role_tree_dn = undef,
$role_filter = undef,
$role_objectclass = undef,
@@ -522,6 +527,7 @@ and \"${domain_dir_enabled}\" for identity/domain_config_dir"
"${domain}::ldap/user_objectclass": value => $user_objectclass;
"${domain}::ldap/user_id_attribute": value => $user_id_attribute;
"${domain}::ldap/user_name_attribute": value => $user_name_attribute;
"${domain}::ldap/user_description_attribute": value => $user_description_attribute;
"${domain}::ldap/user_mail_attribute": value => $user_mail_attribute;
"${domain}::ldap/user_enabled_attribute": value => $user_enabled_attribute;
"${domain}::ldap/user_enabled_mask": value => $user_enabled_mask;

View File

@@ -0,0 +1,4 @@
---
features:
- Adds user_description_attribute mapping support to the
LDAP backend.

View File

@@ -15,6 +15,7 @@ describe 'keystone::ldap' do
:user_objectclass => 'inetUser',
:user_id_attribute => 'uid',
:user_name_attribute => 'cn',
:user_description_attribute => 'description',
:user_mail_attribute => 'mail',
:user_enabled_attribute => 'UserAccountControl',
:user_enabled_mask => '2',
@@ -95,6 +96,7 @@ describe 'keystone::ldap' do
is_expected.to contain_keystone_config('ldap/user_objectclass').with_value('inetUser')
is_expected.to contain_keystone_config('ldap/user_id_attribute').with_value('uid')
is_expected.to contain_keystone_config('ldap/user_name_attribute').with_value('cn')
is_expected.to contain_keystone_config('ldap/user_description_attribute').with_value('description')
is_expected.to contain_keystone_config('ldap/user_mail_attribute').with_value('mail')
is_expected.to contain_keystone_config('ldap/user_enabled_attribute').with_value('UserAccountControl')
is_expected.to contain_keystone_config('ldap/user_enabled_mask').with_value('2')

View File

@@ -29,6 +29,7 @@ describe 'keystone::ldap_backend' do
:user_objectclass => 'inetUser',
:user_id_attribute => 'uid',
:user_name_attribute => 'cn',
:user_description_attribute => 'description',
:user_mail_attribute => 'mail',
:user_enabled_attribute => 'UserAccountControl',
:user_enabled_mask => '2',
@@ -116,6 +117,7 @@ describe 'keystone::ldap_backend' do
is_expected.to contain_keystone_domain_config('Default::ldap/user_objectclass').with_value('inetUser')
is_expected.to contain_keystone_domain_config('Default::ldap/user_id_attribute').with_value('uid')
is_expected.to contain_keystone_domain_config('Default::ldap/user_name_attribute').with_value('cn')
is_expected.to contain_keystone_domain_config('Default::ldap/user_description_attribute').with_value('description')
is_expected.to contain_keystone_domain_config('Default::ldap/user_mail_attribute').with_value('mail')
is_expected.to contain_keystone_domain_config('Default::ldap/user_enabled_attribute').with_value('UserAccountControl')
is_expected.to contain_keystone_domain_config('Default::ldap/user_enabled_mask').with_value('2')