if ($auth_method == 'Basic') {
    _wl(' using Basic auth with user="******"');
    $osmApi->setCredentials(new OSM_Auth_Basic($auth_basic_user, $auth_basic_password));
} else {
    if ($auth_method == 'OAuth') {
        _wl(' using OAuth auth with consumerKey="' . $auth_oauth_consumer_key . '"');
        $oauth = new OSM_Auth_OAuth($auth_oauth_consumer_key, $auth_oauth_consumer_secret);
        $oauth->setAccessToken($auth_oauth_token, $auth_oauth_secret);
        $osmApi->setCredentials($oauth);
    }
}
// http://api06.dev.openstreetmap.org/api/0.6/relation/500
// http://api06.dev.openstreetmap.org/api/0.6/way/8184
// http://api06.dev.openstreetmap.org/api/0.6/node/611571
// get a node
$permissions = $osmApi->getAuthPermissions();
echo print_r($permissions, true) . "\n";
if ($auth_method == 'Basic') {
    _assert($osmApi->isAllowedToReadPrefs() === true);
    _assert($osmApi->isAllowedToWritePrefs() === true);
    _assert($osmApi->isAllowedToWriteDiary() === true);
    _assert($osmApi->isAllowedToWriteApi() === true);
    _assert($osmApi->isAllowedToReadGpx() === true);
    _assert($osmApi->isAllowedToWriteGpx() === true);
} else {
    _assert($osmApi->isAllowedToReadPrefs() === true);
    _assert($osmApi->isAllowedToWritePrefs() === true);
    _assert($osmApi->isAllowedToWriteDiary() === false);
    _assert($osmApi->isAllowedToWriteApi() === true);
    _assert($osmApi->isAllowedToReadGpx() === true);
    _assert($osmApi->isAllowedToWriteGpx() === false);