diff options
Diffstat (limited to 'extras')
-rw-r--r-- | extras/import-idp.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/extras/import-idp.php b/extras/import-idp.php index b18b923..4518bbf 100644 --- a/extras/import-idp.php +++ b/extras/import-idp.php @@ -24,6 +24,12 @@ while (($line = fgets($handle)) !== false) { } fclose($handle); +// Default/Fallback +$requiredAttribute = 'http://aai.dfn.de/category/bwidm-member'; +$url = 'https://www.aai.dfn.de/fileadmin/metadata/dfn-aai-metadata.xml'; +$f = __DIR__ . '/shib.conf.php'; +if (is_readable($f)) require_once $f; + $ch = curl_init(); if ($ch === false) die("Could not init curl\n"); @@ -33,7 +39,6 @@ $db = new mysqli($settings['host'], $settings['user'], $settings['password'], $s if ($db->connect_errno) die("Could not connect to db: " . $db->connect_error . "\n"); $db->set_charset("utf8"); -$url = 'https://www.aai.dfn.de/fileadmin/metadata/dfn-aai-metadata.xml'; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); @@ -118,7 +123,7 @@ foreach ($out[0] as $data) { pdebug(" *** Entry without DisplayName..."); continue; } - if (!in_array('http://aai.dfn.de/category/bwidm-member', getAttributes($xml, 'Extensions/EntityAttributes/Attribute/AttributeValue'))) { + if ($requiredAttribute !== false && !in_array($requiredAttribute, getAttributes($xml, 'Extensions/EntityAttributes/Attribute/AttributeValue'))) { pdebug("Not bwIDM member..."); continue; } |