From 712cd6dca70636e7c92927460cd780ca3869361a Mon Sep 17 00:00:00 2001
From: David Surville <david.surville@unicaen.fr>
Date: Mon, 29 Nov 2021 16:40:56 +0100
Subject: [PATCH] [Evo] Ajout de l'attribut "schacPersonalUniqueCode"

---
 src/UnicaenLdap/Entity/Base/People.php | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/src/UnicaenLdap/Entity/Base/People.php b/src/UnicaenLdap/Entity/Base/People.php
index 3a1a8d5..0152519 100644
--- a/src/UnicaenLdap/Entity/Base/People.php
+++ b/src/UnicaenLdap/Entity/Base/People.php
@@ -102,6 +102,7 @@ class People extends Entity
         'sambaSID',
         'schacDateOfBirth',
         'schacExpiryDate',
+        'schacPersonalUniqueCode',
         'sexe',
         'sn',
         'supannActivite',
@@ -305,6 +306,7 @@ class People extends Entity
         '\[libelle=(?<libelle>.+)\]$/';
     static protected $role_src_pattern = '/^(?<code>\d{4});(?<libelle>.+)$/';
     static protected $service_etat_pattern = '/^(?<etiquette>\{[\w\-]+\})(?<value>(A|I|S){1})$/';
+    static protected $personal_unique_code_pattern = '/^urn:schac:personalUniqueCode:(int:esi:)*(?<country_code>[\w]{2}):(?<code>.+)$/';
 
 
     /**
@@ -434,6 +436,27 @@ class People extends Entity
         return $this;
     }
 
+    /**
+     * Attribut Ldap "schacPersonalUniqueCode"
+     *
+     * @param array|string|null $value
+     * @param bool $append
+     * @return $this
+     * @throws Exception
+     * @throws LdapException
+     */
+    public function setSchacPersonalUniqueCode($value = null, $append = false)
+    {
+        $value = $this->preFormat($value);
+        $value = array_filter($value, function ($v) {
+            return preg_match(self::$personal_unique_code_pattern, $v);
+        });
+
+        $this->appendOrNot('schacPersonalUniqueCode', $value, $append);
+
+        return $this;
+    }
+
     /**
      * Attribut Ldap "dateFinInscription"
      *
-- 
GitLab