Skip to content

Commit

Permalink
Parameter to choose ppolicy name attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
coudot committed Jul 12, 2024
1 parent b8e0d64 commit c9f6a0f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions conf/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
$ldap_user_base = "ou=users,".$ldap_base;
$ldap_user_filter = "(objectClass=inetOrgPerson)";
$ldap_ppolicy_filter = "(objectClass=pwdPolicy)";
$ldap_ppolicy_name_attribute = "cn";
$ldap_size_limit = 100;
#$ldap_default_ppolicy = "cn=default,ou=ppolicy,dc=example,dc=com";
$ldap_lastauth_attribute = "authTimestamp";
Expand Down
6 changes: 6 additions & 0 deletions docs/ldap-parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ Configure the filter to match password policy configuration objects:
$ldap_ppolicy_filter = "(objectClass=pwdPolicy)";
Define which attribute value will be displayed as password policy name:

.. code-block:: php
$ldap_ppolicy_name_attribute = "cn";
Set ``$ldap_default_ppolicy`` value if a default policy is configured in your LDAP directory.

.. code-block:: php
Expand Down
2 changes: 1 addition & 1 deletion htdocs/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

# Assign configuration variables
$smarty->assign("page_title", false);
$smarty->assign('ldap_params',array('ldap_url' => $ldap_url, 'ldap_starttls' => $ldap_starttls, 'ldap_binddn' => $ldap_binddn, 'ldap_bindpw' => $ldap_bindpw, 'ldap_user_base' => $ldap_user_base, 'ldap_user_filter' => $ldap_user_filter, 'ldap_ppolicy_filter' => $ldap_ppolicy_filter, 'ldap_default_ppolicy' => $ldap_default_ppolicy));
$smarty->assign('ldap_params',array('ldap_url' => $ldap_url, 'ldap_starttls' => $ldap_starttls, 'ldap_binddn' => $ldap_binddn, 'ldap_bindpw' => $ldap_bindpw, 'ldap_user_base' => $ldap_user_base, 'ldap_user_filter' => $ldap_user_filter, 'ldap_ppolicy_filter' => $ldap_ppolicy_filter, 'ldap_ppolicy_name_attribute' => $ldap_ppolicy_name_attribute, 'ldap_default_ppolicy' => $ldap_default_ppolicy));
$smarty->assign('logo',$logo);
$smarty->assign('background_image',$background_image);
$smarty->assign('custom_css',$custom_css);
Expand Down
3 changes: 1 addition & 2 deletions templates/value_displayer.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@
{/if}

{if $type eq 'ppolicy_dn'}
{assign var="name" value="{{get_attribute dn="{$value}" attribute="cn" ldap_url="{$ldap_params.ldap_url}" ldap_starttls="{$ldap_params.ldap_starttls}" ldap_binddn="{$ldap_params.ldap_binddn}" ldap_bindpw="{$ldap_params.ldap_bindpw}" ldap_filter="{$ldap_params.ldap_ppolicy_filter}" ldap_network_timeout="{$ldap_params.ldap_network_timeout}"}|truncate:{$truncate_value_after}}"}
{assign var="name" value="{{get_attribute dn="{$value}" attribute="{$ldap_params.ldap_ppolicy_name_attribute}" ldap_url="{$ldap_params.ldap_url}" ldap_starttls="{$ldap_params.ldap_starttls}" ldap_binddn="{$ldap_params.ldap_binddn}" ldap_bindpw="{$ldap_params.ldap_bindpw}" ldap_filter="{$ldap_params.ldap_ppolicy_filter}" ldap_network_timeout="{$ldap_params.ldap_network_timeout}"}|truncate:{$truncate_value_after}}"}
{if $name}{$name}<br />{/if}
{/if}


{if $type eq 'address'}
{foreach split_value($value,'$') as $fragment}
{$fragment|truncate:{$truncate_value_after}}<br />
Expand Down

0 comments on commit c9f6a0f

Please sign in to comment.