示例#1
0
function getARP($params)
{
    if (!isset($params['aid'])) {
        return false;
    }
    $arp = new sspmod_janus_ARP();
    $arp->setAid((int) $params['aid']);
    $arp->load();
    $attributes = $arp->getAttributes();
    if (empty($attributes)) {
        $attributes = array();
    }
    ksort($attributes);
    return array('aid' => $arp->getAid(), 'name' => $arp->getName(), 'description' => $arp->getDescription(), 'is_default' => $arp->isDefault(), 'attributes' => $attributes);
}
}
if (isset($_POST['usersubmit'])) {
    $user->setData($_POST['userdata']);
    $user->setEmail($_POST['user_email']);
    $user->setSecret($_POST['user_secret']);
    $user->save();
    $pm->post('Userinfo update', 'User info updated:<br /><br />' . $_POST['userdata'] . '<br /><br />E-mail: ' . $_POST['user_email'], 'USER-' . $user->getUid(), $user->getUid());
    SimpleSAML_Utilities::redirect(SimpleSAML_Utilities::selfURLNoQuery(), array('selectedtab' => $selectedtab));
}
if (isset($_POST['arp_delete'])) {
    $arp = new sspmod_janus_ARP();
    $arp->setAid((int) $_POST['arp_delete']);
    $arp->delete();
}
if (isset($_POST['arp_edit'])) {
    $arp = new sspmod_janus_ARP();
    if (isset($_POST['arp_id'])) {
        $arp->setAid((int) $_POST['arp_id']);
    }
    if (isset($_POST['arp_name'])) {
        $arp->setName($_POST['arp_name']);
    }
    if (isset($_POST['arp_description'])) {
        $arp->setDescription($_POST['arp_description']);
    }
    if (isset($_POST['arp_is_default'])) {
        $arp->setDefault();
    }
    if (isset($_POST['arp_attributes'])) {
        $arp->setAttributes($_POST['arp_attributes']);
    }
 /**
  * Get a complete list of all ARPs in the system
  *
  * @return array
  */
 public function getARPList()
 {
     $arp = new sspmod_janus_ARP();
     return $arp->getARPlist();
 }
        $econtroller->saveEntity();
        echo $key . ' imported<br />';
    }
}
echo '<h1>SAML20 SP</h1>';
include 'saml20-sp-remote.php';
foreach ($metadata as $key => $val) {
    $msg = $mcontrol->createNewEntity($key, 'saml20-sp');
    echo "Id: " . $msg . '<br />';
    if (is_int($msg)) {
        $econtroller = new sspmod_janus_EntityController($janus_config);
        $econtroller->setEntity((string) $msg);
        $econtroller->loadEntity();
        foreach ($val as $k => $v) {
            if ($k == 'attributes') {
                $arp = new sspmod_janus_ARP();
                $arp->setName($key);
                $arp->setAttributes($v);
                $arp->save();
                $econtroller->setArp($arp->getAid());
            }
            if ($k == 'name') {
                $k = 'entity:name';
            }
            if ($k == 'description') {
                $k = 'entity:description';
            }
            echo '<br>Key: ' . $k . '<br>';
            if (is_string($v)) {
                echo '<br/>Insert ' . $v . '<br/>';
                if (!$econtroller->addMetadata($k, $v)) {
// Get allowed workflows
$allowed_workflow = array();
$allowed_workflow[] = $entity->getWorkflow();
$workflowstates = array();
if (isset($workflow[$entity->getWorkflow()])) {
    $workflowstates = $janus_config->getValue('workflowstates');
    foreach ($workflow[$entity->getWorkflow()] as $k_wf => $v_wf) {
        $tmp = array_intersect($user->getType(), $v_wf['role']);
        if (!empty($tmp) || in_array('all', $v_wf['role'])) {
            $allowed_workflow[] = $k_wf;
        }
    }
} else {
    $workflowstates = array($entity->getWorkflow() => array('name' => array('en' => $entity->getWorkflow()), 'description' => array('en' => 'No description available. Workflow state `' . $entity->getWorkflow() . '` is not defined in the configuration file. This is probably an error. Contact your system administrator to get this error fixed.')));
}
$arp = new sspmod_janus_ARP();
$arplist = $arp->getARPlist();
array_unshift($arplist, array("aid" => '0', "name" => "No ARP", "description" => "No ARP"));
$et->data['entity_state'] = $entity->getWorkflow();
$et->data['entity_type'] = $entity->getType();
$et->data['revisionid'] = $entity->getRevisionid();
$et->data['types'] = $janus_config->getValue('types');
$et->data['workflowstates'] = $workflowstates;
$et->data['access'] = $janus_config->getValue('access');
$et->data['workflow'] = $allowed_workflow;
$et->data['entity'] = $entity;
$et->data['user'] = $user;
$et->data['uiguard'] = $guard;
$et->data['mcontroller'] = $mcontroller;
$et->data['blocked_entities'] = $mcontroller->getBlockedEntities();
$et->data['allowed_entities'] = $mcontroller->getAllowedEntities();