diff --git a/action.php b/action.php
index d3d9b95306660dd2dde1198bc81f25ae5fd46644..c39934a8fcdaf632253b7f83110fc1d85e15ca1b 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)) {