Example #1
0
    $entity = array_pop($entities);
    $metadata = $entity->getMetadata20SP();
} else {
    $metadata = array('owner' => $userid);
}
$editor = new sspmod_metaedit_MetaEditor();
if (isset($_POST['submit'])) {
    $editor->checkForm($_POST);
    $metadata = $editor->formToMeta($_POST, array(), array('owner' => $userid));
    if (isset($_REQUEST['was-entityid']) && $_REQUEST['was-entityid'] !== $metadata['entityid']) {
        $premetadata = $mdh->getMetadata($_REQUEST['was-entityid'], 'saml20-sp-remote');
        requireOwnership($premetadata, $userid);
        $mdh->deleteMetadata($_REQUEST['was-entityid'], 'saml20-sp-remote');
    }
    $testmetadata = NULL;
    try {
        $testmetadata = $mdh->getMetadata($metadata['entityid'], 'saml20-sp-remote');
    } catch (Exception $e) {
    }
    if ($testmetadata) {
        requireOwnership($testmetadata, $userid);
    }
    $mdh->saveMetadata($metadata['entityid'], 'saml20-sp-remote', $metadata);
    $template = new SimpleSAML_XHTML_Template($config, 'metaedit:saved.php');
    $template->show();
    exit;
}
$form = $editor->metaToForm($metadata);
$template = new SimpleSAML_XHTML_Template($config, 'metaedit:formedit.php');
$template->data['form'] = $form;
$template->show();
Example #2
0
            requireOwnership();
        } else {
            requireMembership();
        }
    } else {
        if ($blogVisibility == 0) {
            requireOwnership();
        } else {
            if ($blogVisibility == 1) {
                requireMembership();
            }
        }
    }
}
if (in_array($context->getProperty('uri.interfaceType'), array('owner', 'reader'))) {
    requireOwnership();
    // Check access control list
    if (!empty($_SESSION['acl'])) {
        $requiredPriv = Aco::getRequiredPrivFromUrl($context->getProperty('suri.directive'));
        if (!empty($requiredPriv) && !Acl::check($requiredPriv)) {
            if (in_array('group.administrators', $requiredPriv)) {
                header("location:" . $context->getProperty('uri.blog') . "/owner/center/dashboard");
                exit;
            } else {
                header("location:" . $context->getProperty('uri.blog') . "/owner/entry");
                exit;
            }
        }
    }
}
/** INITIALIZE : Cookie prefix
Example #3
0
{
    if (!isset($entry['owner'])) {
        throw new Exception('OAuth Consumer has no owner. Which means no one is granted access, not even you.');
    }
    if ($entry['owner'] !== $userid) {
        throw new Exception('OAuth Consumer has an owner that is not equal to your userid, hence you are not granted access.');
    }
}
if (array_key_exists('editkey', $_REQUEST)) {
    $entryc = $store->get('consumers', $_REQUEST['editkey'], '');
    $entry = $entryc['value'];
    requireOwnership($entry, $userid);
} else {
    $entry = array('owner' => $userid, 'key' => SimpleSAML_Utilities::generateID(), 'secret' => SimpleSAML_Utilities::generateID());
}
$editor = new sspmod_oauth_Registry();
if (isset($_POST['submit'])) {
    $editor->checkForm($_POST);
    $entry = $editor->formToMeta($_POST, array(), array('owner' => $userid));
    requireOwnership($entry, $userid);
    #	echo('<pre>Created: '); print_r($entry); exit;
    $store->set('consumers', $entry['key'], '', $entry);
    $template = new SimpleSAML_XHTML_Template($config, 'oauth:registry.saved.php');
    $template->data['entry'] = $entry;
    $template->show();
    exit;
}
$form = $editor->metaToForm($entry);
$template = new SimpleSAML_XHTML_Template($config, 'oauth:registry.edit.tpl.php');
$template->data['form'] = $form;
$template->show();
Example #4
0
if (!isset($attributes[$useridattr])) {
    throw new Exception('User ID is missing');
}
$userid = $attributes[$useridattr][0];
function requireOwnership($metadata, $userid)
{
    if (!isset($metadata['owner'])) {
        throw new Exception('Metadata has no owner. Which means no one is granted access, not even you.');
    }
    if ($metadata['owner'] !== $userid) {
        throw new Exception('Metadata has an owner that is not equal to your userid, hence you are not granted access.');
    }
}
if (isset($_REQUEST['delete'])) {
    $premetadata = $mdh->getMetadata($_REQUEST['delete'], 'saml20-sp-remote');
    requireOwnership($premetadata, $userid);
    $mdh->deleteMetadata($_REQUEST['delete'], 'saml20-sp-remote');
}
$list = $mdh->getMetadataSet('saml20-sp-remote');
$slist = array('mine' => array(), 'others' => array());
foreach ($list as $listitem) {
    if (array_key_exists('owner', $listitem)) {
        if ($listitem['owner'] === $userid) {
            $slist['mine'][] = $listitem;
            continue;
        }
    }
    $slist['others'][] = $listitem;
}
$template = new SimpleSAML_XHTML_Template($config, 'metaedit:metalist.php');
$template->data['metadata'] = $slist;