示例#1
0
function make_result_table($user_ids, $signer, $ma_url)
{
    print "<h3>Results</h3>";
    if (count($user_ids) == 0) {
        print "<p>No results found. (warning: no partial matches!)</p>";
    } else {
        print "<table><tr><th>Name</th><th>Username</th><th>Email</th><th>URN</th><th>UUID</th><th>Actions</th></tr>";
        $requester_details = lookup_member_details($ma_url, $signer, $user_ids);
        foreach ($user_ids as $user_id) {
            $user_details = $requester_details[$user_id];
            $username = $user_details[MA_ATTRIBUTE_NAME::USERNAME];
            $member = new Member($user_id);
            $member->init_from_record($user_details);
            $name = $member->prettyName();
            $email = $user_details[MA_ATTRIBUTE_NAME::EMAIL_ADDRESS];
            $urn = $user_details[MA_ATTRIBUTE_NAME::URN];
            $mail_to = "<a href='mailto:{$email}'>{$email}</a>";
            print "<tr><td>{$name}</td><td>{$username}</td><td>{$mail_to}</td><td>{$urn}</td><td>{$user_id}</td>";
            print "<td><button onclick='expand_info(this);'>More info</button>";
            print "<button class='hideinfo' onclick='hide_info(this);' style='display:none;'>Close</button></td></tr>";
            $user_profile_info = get_user_profile_info($user_details, $name, $user_id);
            $user_project_info = get_user_project_info($user_id, $name, $signer);
            $user_slice_info = get_user_slice_info($user_id, $name, $signer);
            print "<tr style='display:none'>";
            print "<td colspan='3' style='vertical-align:top'>{$user_profile_info}</td>";
            print "<td style='vertical-align: top;'>{$user_project_info}</td>";
            print "<td style='vertical-align: top;'>{$user_slice_info}</td>";
            print "<td style='vertical-align: top;'><button onclick='disable_user(\"{$name}\", \"{$urn}\");'>Disable user</button></tr>";
        }
        print "</table>";
    }
}
示例#2
0
function get_member_info($slice, $signer, $ma_url, $sa_url)
{
    $slice_id = $slice[SA_SLICE_TABLE_FIELDNAME::SLICE_ID];
    $slice_members = get_slice_members($sa_url, $signer, $slice_id);
    $member_ids = array();
    $admin_ids = array();
    foreach ($slice_members as $slice_member) {
        if ($slice_member[SA_SLICE_MEMBER_TABLE_FIELDNAME::ROLE] == CS_ATTRIBUTE_TYPE::LEAD) {
            $slice_lead_id = $slice_member[SA_SLICE_MEMBER_TABLE_FIELDNAME::MEMBER_ID];
        } else {
            if ($slice_member[SA_SLICE_MEMBER_TABLE_FIELDNAME::ROLE] == CS_ATTRIBUTE_TYPE::ADMIN) {
                $admin_ids[] = $slice_member[SA_SLICE_MEMBER_TABLE_FIELDNAME::MEMBER_ID];
            } else {
                $member_ids[] = $slice_member[SA_SLICE_MEMBER_TABLE_FIELDNAME::MEMBER_ID];
            }
        }
    }
    $slice_member_details = lookup_member_details($ma_url, $signer, $member_ids);
    $slice_admin_details = lookup_member_details($ma_url, $signer, $admin_ids);
    $member_info_str = "<b style='text-decoration: underline;'>Slice members</b><br>";
    if (count($slice_admin_details) > 0) {
        $member_info_str .= "<b>Admins</b><br>";
        foreach ($slice_admin_details as $slice_admin_id => $slice_admin_info) {
            $slice_admin_obj = new Member($slice_admin_id);
            $slice_admin_obj->init_from_record($slice_admin_info);
            $slice_admin_name = $slice_admin_obj->prettyName();
            $slice_admin_username = $slice_admin_info[MA_ATTRIBUTE_NAME::USERNAME];
            $member_info_str .= "{$slice_admin_name} ({$slice_admin_username})<br>";
        }
    } else {
        $member_info_str .= "<i>No admins on slice</i><br>";
    }
    if (count($slice_member_details) > 0) {
        $member_info_str .= "<b>Members</b><br>";
        foreach ($slice_member_details as $slice_member_id => $slice_member_info) {
            $slice_member_obj = new Member($slice_member_id);
            $slice_member_obj->init_from_record($slice_member_info);
            $slice_member_name = $slice_member_obj->prettyName();
            $slice_member_username = $slice_member_info[MA_ATTRIBUTE_NAME::USERNAME];
            $member_info_str .= "{$slice_member_name} ({$slice_member_username})<br>";
        }
    } else {
        if (count($slice_admin_details) == 0) {
            $member_info_str .= "<i>No members on slice</i><br>";
        }
    }
    return $member_info_str;
}
function get_all_members_of_slice_as_users($sa_url, $ma_url, $user, $slice_id)
{
    // Get other users on this project
    $members = get_slice_members($sa_url, $user, $slice_id);
    //error_log("Return from get_slice_members = " . print_r($members, TRUE));
    $member_uuids = array();
    foreach ($members as $member) {
        $member_id = $member[MA_ARGUMENT::MEMBER_ID];
        // In Future consider FILTER by ROLE?
        //	$role_id = $member[ 'role' ]; // FIND VARIABLE TO REPLACE
        $member_uuids[] = $member_id;
    }
    $slice_members = lookup_member_details($ma_url, $user, $member_uuids);
    //error_log("Slice members = " . print_r($slice_members, TRUE));
    $slice_users = array();
    foreach ($slice_members as $member_id => $slice_member) {
        // initialize members
        $member = new Member();
        $member->init_from_record($slice_member);
        //error_log("Member = " . print_r($member, TRUE));
        // now as users
        $slice_user = new GeniUser();
        $slice_user->init_from_member($member);
        //	error_log("Slice user = "******"Slice users = " . print_r($slice_users, TRUE));
    return $slice_users;
}
    relative_redirect("slice.php?slice_id={$slice_id}");
}
// Get current list of members
$current_members = get_slice_members($sa_url, $user, $slice_id);
//foreach($current_members as $cm) {
//  error_log("CM = " . print_r($cm, true));
//}
// Get list of all members of project
$all_project_members = get_project_members($sa_url, $user, $project_id);
$all_project_member_names = lookup_member_names_for_rows($ma_url, $user, $all_project_members, PA_PROJECT_MEMBER_TABLE_FIELDNAME::MEMBER_ID);
$all_project_member_ids = array();
foreach ($all_project_members as $apm) {
    //  error_log("APM = " . print_r($apm, true));
    $all_project_member_ids[] = $apm[PA_PROJECT_MEMBER_TABLE_FIELDNAME::MEMBER_ID];
}
$all_project_member_details = lookup_member_details($ma_url, $user, $all_project_member_ids);
//foreach($all_project_member_details as $apmd) {
//  error_log("APMD = " . print_r($apmd, true));
//}
$disabled = "disabled = " . '"' . "disabled" . '"';
$edit_members_disabled = "";
if (!$user->isAllowed(SA_ACTION::ADD_SLICE_MEMBER, CS_CONTEXT_TYPE::SLICE, $slice_id) || $in_lockdown_mode) {
    $edit_members_disabled = $disabled;
    $_SESSION['lasterror'] = "User has no privileges to edit slice '" . $slice_name . "'.";
    relative_redirect("slice.php?slice_id={$slice_id}");
}
// First capture all the row details for the members
$all_project_member_row_elements = array();
foreach ($all_project_member_details as $apmd) {
    $project_member_row_elements = compute_member_row_elements($apmd, $all_project_member_names, $project_id, $current_members);
    $all_project_member_row_elements[] = $project_member_row_elements;
    relative_redirect("home.php");
}
// OK, inputs validated
// At this point, we should be able to bring up the table of all pending
// requests (or only that one if that is what is asked for)
// Get ID's of all member to be added by pending request for this project
$all_requestors = array();
foreach ($requests as $request) {
    $member_id = $request['requestor'];
    if (!array_key_exists($member_id, $all_requestors)) {
        $all_requestors[] = $member_id;
    }
}
// error_log("REQUESTS = " . print_r($requests, true));
// error_log("ALL REQUESTORS = " . print_r($all_requestors, true));
$member_details = lookup_member_details($ma_url, $user, $all_requestors);
// error_log("MEMBERS = " . print_r($member_details, true));
$member_names = lookup_member_names_for_rows($ma_url, $user, $member_details, MA_MEMBER_TABLE_FIELDNAME::MEMBER_ID);
// error_log("MEMBER_NAMES = " . print_r($member_names, true));
// FIXME: Allow per request deny text from here?
show_header('GENI Portal: Projects');
include "tool-breadcrumbs.php";
print "<h2>Handle Project Request: " . $project_name . "</h2>";
print "<p> The following request(s) have been made to join your\nproject. You may approve (add the member) or deny each request.</p>\n<p>You should only add people to your project that you\nknow. Remember that when you approve a project join request, you agree\nthat the project lead will be held responsible for all GENI actions this person\ntakes in this project.</p>";
print "<p>For an explanation of the different project roles, see the <a href='http://groups.geni.net/geni/wiki/GENIGlossary#Project'>GENI Glossary</a>.</p>";
print '<form method="POST" action="do-handle-project-request.php">';
print '<table>';
print '<tr><th>Candidate Name</th><th>Candidate Email</th>';
print '<th>Request Text</th>';
// <th>Can Add <br/>Immediately?</th>
print '<th>Action</th></tr>';
示例#6
0
<div id='leadrequests'>
<h2>Open lead requests</h2>

<?php 
// Find open lead requests and display table with information about the requesters
$ma_url = get_first_service_of_type(SR_SERVICE_TYPE::MEMBER_AUTHORITY);
$conn = portal_conn();
$sql = "SELECT *" . " FROM lead_request WHERE status='open'";
$rows = db_fetch_rows($sql, "fetch all lead requests for admin page");
$lead_requests = $rows[RESPONSE_ARGUMENT::VALUE];
$requester_uuids = array();
foreach ($lead_requests as $lead_request) {
    $requester_uuids[] = $lead_request['requester_uuid'];
}
$requester_details = lookup_member_details($ma_url, $user, $requester_uuids);
print "<table><tr><th>Name</th><th>Link</th><th>Requested At</th><th>Email</th><th>Admin Notes</th><th>Actions</th></tr>";
$open_requests = 0;
foreach ($lead_requests as $lead_request) {
    $requester_uuid = $lead_request['requester_uuid'];
    $notes = $lead_request['notes'] == "" ? "None" : $lead_request['notes'];
    $timestamp = dateUIFormat($lead_request['request_ts']);
    $request_id = $lead_request['id'];
    $details = $requester_details[$requester_uuid];
    make_user_info_rows($details, $requester_uuid, $request_id, $notes, $timestamp);
    $open_requests++;
}
// Returns what's between the '@' and the "." in a user's affiliation. Likely their school/ institution
function get_school($affiliation)
{
    if ($affiliation == NULL) {