From 3a651f4c601a7c2b4ae82d4380493a817a4d50c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michal=20=C5=A0vamberg?= <svamberg@cesnet.cz>
Date: Fri, 23 Aug 2024 10:59:25 +0200
Subject: [PATCH] Uprava identifikace cesnetich uzivatelu

---
 action.php | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/action.php b/action.php
index d3d9b95..c39934a 100644
--- a/action.php
+++ b/action.php
@@ -51,6 +51,19 @@ class action_plugin_oauthgeneric extends Adapter
             $grps = array_map('trim', $grps);
         }
 
+# CESNET, start
+        # cesneti uzivatele identifikujeme skrze email shodny s LDAPem
+        $eppns = DotAccess::get($result, 'voperson_external_id', '');
+#       msg(print_r($grps, 1));
+#       msg(print_r($eppns, 1));
+        foreach ($eppns as $eppn) {
+                if (strpos($eppn, "@cesnet.cz")) {
+                        $user = $eppn;
+                }
+        }
+# CESNET, end
+
+
         // fallbacks for user name
         if (empty($user)) {
             if (!empty($name)) {
-- 
GitLab