diff options
author | Simon Rettberg | 2020-06-25 12:07:09 +0200 |
---|---|---|
committer | Simon Rettberg | 2020-06-25 12:07:09 +0200 |
commit | d6b5b9998ae979e129752f50ddf689997745d75e (patch) | |
tree | f8239c7fd7b7acc69f6b8ddc6bfcc908a417e952 /extras/import-idp.php | |
parent | Add --debug option (diff) | |
download | masterserver-d6b5b9998ae979e129752f50ddf689997745d75e.tar.gz masterserver-d6b5b9998ae979e129752f50ddf689997745d75e.tar.xz masterserver-d6b5b9998ae979e129752f50ddf689997745d75e.zip |
Allow overriding default config
Diffstat (limited to 'extras/import-idp.php')
-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; } |