Skip to content

Commit

Permalink
Display associated password policy
Browse files Browse the repository at this point in the history
  • Loading branch information
coudot committed Jul 11, 2024
1 parent f022794 commit 99272bb
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions conf/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
$ldap_base = "dc=example,dc=com";
$ldap_user_base = "ou=users,".$ldap_base;
$ldap_user_filter = "(objectClass=inetOrgPerson)";
$ldap_ppolicy_filter = "(objectClass=pwdPolicy)";
$ldap_size_limit = 100;
#$ldap_default_ppolicy = "cn=default,ou=ppolicy,dc=example,dc=com";
$ldap_lastauth_attribute = "authTimestamp";
Expand Down Expand Up @@ -67,6 +68,7 @@
'pwdchangedtime' => array( 'attribute' => 'pwdchangedtime', 'faclass' => 'lock', 'type' => 'date' ),
'pwdfailuretime' => array( 'attribute' => 'pwdfailuretime', 'faclass' => 'lock', 'type' => 'date' ),
'pwdlastsuccess' => array( 'attribute' => 'pwdlastsuccess', 'faclass' => 'lock', 'type' => 'date' ),
'pwdpolicysubentry' => array( 'attribute' => 'pwdpolicysubentry', 'faclass' => 'lock', 'type' => 'ppolicy_dn' ),
'pwdreset' => array( 'attribute' => 'pwdreset', 'faclass' => 'lock', 'type' => 'boolean' ),
'secretary' => array( 'attribute' => 'secretary', 'faclass' => 'user-circle-o', 'type' => 'dn_link' ),
'state' => array( 'attribute' => 'st', 'faclass' => 'globe', 'type' => 'text' ),
Expand Down
5 changes: 5 additions & 0 deletions htdocs/display.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@
$entry[0][$attr] = $values;
}

# Include default password policy
if ( !$entry[0]['pwdpolicysubentry'] and $ldap_default_ppolicy) {
$entry[0]['pwdpolicysubentry'][] = $ldap_default_ppolicy;
}

if ($display_edit_link) {
# Replace {dn} in URL
$edit_link = str_replace("{dn}", urlencode($dn), $display_edit_link);
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));
$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('logo',$logo);
$smarty->assign('background_image',$background_image);
$smarty->assign('custom_css',$custom_css);
Expand Down
1 change: 1 addition & 0 deletions lang/en.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
$messages['label_pwdaccountlockedtime'] = "Locking date";
$messages['label_pwdchangedtime'] = "Last password change";
$messages['label_pwdfailuretime'] = "Last authentication failures";
$messages['label_pwdpolicysubentry'] = "Associated password policy";
$messages['label_pwdreset'] = "Reset password at next connection";
$messages['label_secretary'] = "Secretary";
$messages['label_state'] = "State";
Expand Down
1 change: 1 addition & 0 deletions lang/fr.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
$messages['label_pwdaccountlockedtime'] = "Date de blocage";
$messages['label_pwdchangedtime'] = "Dernier changement de mot de passe";
$messages['label_pwdfailuretime'] = "Derniers échecs d'authentification";
$messages['label_pwdpolicysubentry'] = "Politique des mots de passe associée";
$messages['label_pwdreset'] = "Réinitialisation du mot de passe à la prochaine connexion";
$messages['label_secretary'] = "Secrétaire";
$messages['label_state'] = "État";
Expand Down
6 changes: 6 additions & 0 deletions templates/value_displayer.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
{/if}
{/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}}"}
{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 99272bb

Please sign in to comment.