Example #1
0
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
require_once 'vendor/autoload.php';
echo date("Y-m-d H:i:s") . " :: starting Janus entity validation\n";
try {
    $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
    $logDir = $config->s('output')->l('logDir', true);
    // REQ
    // validate classes
    $validators = $config->s('validator')->s('validate', false, array())->toArray();
    $timezone = $config->l('timezone', false, "Europe/Amsterdam");
    date_default_timezone_set($timezone);
    $logger = new \SURFnet\janus\log\EntityLog();
    $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));
    }
Example #2
0
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
require_once 'vendor/autoload.php';
use Guzzle\Http\Client;
use fkooman\Config\Config;
echo date("Y-m-d H:i:s") . " :: retrieving entity metadata\n";
try {
    $configFile = __DIR__ . DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR . "config.ini";
    $config = Config::fromIniFile($configFile);
    // data directory
    $exportDir = $config->s('output')->l('exportDir', true);
    // REQ
    $metadataDir = $config->s('output')->l('metadataDir', true);
    // REQ
    // remove all files from metadataDir
    foreach (glob($metadataDir . "/*.xml") as $f) {
        unlink($f);
    }
    $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);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once dirname(__DIR__) . '/vendor/autoload.php';
if ($argc < 2) {
    echo "specify userId as a parameter" . PHP_EOL;
    exit(1);
}
use fkooman\Config\Config;
$config = Config::fromIniFile(dirname(__DIR__) . '/config/voot.ini');
$vootStorageBackend = "fkooman\\VootProvider\\" . $config->getValue('storageBackend');
try {
    $vootStorage = new $vootStorageBackend($config);
    $groupMembership = $vootStorage->isMemberOf($argv[1]);
    var_dump($groupMembership);
    if (2 < count($argv)) {
        // second parameter is group identifier we want to query users for
        $groupMembers = $vootStorage->getGroupMembers($argv[1], $argv[2]);
        var_dump($groupMembers);
    }
} catch (Exception $e) {
    echo $e->getMessage() . PHP_EOL;
}
Example #4
0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once dirname(__DIR__) . "/vendor/autoload.php";
use fkooman\Config\Config;
use fkooman\Http\JsonResponse;
use fkooman\Http\Request;
use fkooman\Http\IncomingRequest;
use fkooman\Rest\Service;
use fkooman\Rest\Plugin\BasicAuthentication;
use fkooman\VootProvider\VootStorageException;
try {
    $config = Config::fromIniFile(dirname(__DIR__) . DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR . "voot.ini");
    $vootStorageBackend = sprintf('fkooman\\VootProvider\\%s', $config->getValue('storageBackend'));
    $vootStorage = new $vootStorageBackend($config);
    $request = Request::fromIncomingRequest(new IncomingRequest());
    $service = new Service($request);
    // require authentication?
    if (null !== $config->getValue('basicUser')) {
        $basicAuthPlugin = new BasicAuthentication($config->getValue('basicUser'), $config->getValue('basicPass'), $config->getValue('serviceName'));
        $service->registerBeforeMatchingPlugin($basicAuthPlugin);
    }
    // GROUPS
    $service->match("GET", "/groups/:uid", function ($uid) use($request, $vootStorage) {
        $groups = $vootStorage->isMemberOf($uid, $request->getQueryParameter("startIndex"), $request->getQueryParameter("count"));
        $response = new JsonResponse(200);
        $response->setContent($groups);
        return $response;