Example #1
0
 */
require_once 'vendor/autoload.php';
try {
    if (!isset($argv[1])) {
        echo "Please specify entityId" . PHP_EOL;
        die;
    }
    $spEntityId = $argv[1];
    $configFile = __DIR__ . DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR . "config.ini";
    $config = \fkooman\Config\Config::fromIniFile($configFile);
    // data directory
    $exportDir = $config->s('output')->l('exportDir', true);
    // REQ
    $timezone = $config->l('timezone', false, "Europe/Amsterdam");
    date_default_timezone_set($timezone);
    $inputFile = $exportDir . DIRECTORY_SEPARATOR . "export.json";
    $exportData = @file_get_contents($inputFile);
    if (false === $exportData) {
        throw new Exception(sprintf("unable to read JSON file '%s' from disk", $inputFile));
    }
    $entities = json_decode($exportData, true);
    $aclResolve = new \SURFnet\janus\acl\Resolve($entities);
    $allowedIdps = $aclResolve->aclAllowedIdps($spEntityId, true);
    echo $spEntityId . PHP_EOL;
    foreach ($allowedIdps as $allowedIdp) {
        echo "    " . $allowedIdp . PHP_EOL;
    }
} catch (Exception $e) {
    echo sprintf("ERROR: %s", $e->getMessage());
    die(PHP_EOL);
}