From e0a26e163b294564cd4a13bec10a51f330c83081 Mon Sep 17 00:00:00 2001
From: Dennis Ahrens <dennis.ahrens@hs-hannover.de>
Date: Thu, 23 Jun 2022 14:28:07 +0200
Subject: [PATCH] Add setting to control account expires behaviour

---
 lang/en/auth_ldap_syncplus.php | 2 ++
 settings.php                   | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/lang/en/auth_ldap_syncplus.php b/lang/en/auth_ldap_syncplus.php
index 13f5e12..87f2f0f 100644
--- a/lang/en/auth_ldap_syncplus.php
+++ b/lang/en/auth_ldap_syncplus.php
@@ -39,3 +39,5 @@ $string['syncroles'] = 'LDAP roles sync job (Sync Plus)';
 $string['synctask'] = 'LDAP users sync job (Sync Plus)';
 $string['userentriestosuspend'] = 'User entries to be suspended: {$a}';
 $string['waitinginremovalqueue'] = 'Waiting in removal queue for {$a->days} day grace period: {$a->name} ID {$a->id}';
+$string['ad_accountexpires_key'] = 'AD account expires';
+$string['ad_accountexpires_desc'] = 'If set to yes and the auth provider is Active Directory the attribute accountExpires is evaluated and taken into account.';
diff --git a/settings.php b/settings.php
index 7dff891..7f78971 100644
--- a/settings.php
+++ b/settings.php
@@ -293,6 +293,11 @@ if ($ADMIN->fulltree) {
                 get_string('removeuser_graceperiod', 'auth_ldap_syncplus'),
                 get_string('removeuser_graceperiod_desc', 'auth_ldap_syncplus'), 10, PARAM_INT));
 
+        // Account Expiration.
+        $settings->add(new admin_setting_configselect('auth_ldap_syncplus/ad_accountexpires',
+                new lang_string('ad_accountexpires_key', 'auth_ldap_syncplus'),
+                new lang_string('ad_accountexpires_desc', 'auth_ldap_syncplus'), 0 , $yesno));
+
         // Create users.
         $settings->add(new admin_setting_configselect('auth_ldap_syncplus/sync_script_createuser_enabled',
                 new lang_string('sync_script_createuser_enabled_key', 'auth_ldap_syncplus'),
-- 
GitLab