Esempio n. 1
0
function update_ma($ma_url, $user, $name, $value, $old_value)
{
    if ($value === $old_value) {
        // If no change, do nothing.
        return;
    } else {
        if (empty($value)) {
            remove_member_attribute($ma_url, $user, $user->account_id, $name);
        } else {
            add_member_attribute($ma_url, $user, $user->account_id, $name, $value, true);
        }
    }
}
Esempio n. 2
0
}
// Now that the user has an account, make sure there is an irods group for all their projects and they are in those groups
// FIXME: In future take out that $userExisted piece. That is just to help bootstrap group creation but slow and not needed in the long run
if ($didCreate or $userExisted) {
    // Ensure we've saved the username in the local DB
    if (!isset($ma_url)) {
        $ma_url = get_first_service_of_type(SR_SERVICE_TYPE::MEMBER_AUTHORITY);
        if (!isset($ma_url) || is_null($ma_url) || $ma_url == '') {
            error_log("Found no MA in SR!'");
        }
    }
    if (isset($user->ma_member->irods_username)) {
        remove_member_attribute($ma_url, $user, $user->account_id, 'irods_username');
        // Race condition possible here, where another thread thinks the user has no account. The user would have to reload this page to fix things
    }
    add_member_attribute($ma_url, $user, $user->account_id, 'irods_username', $username, 't');
    $user->ma_member->irods_username = $username;
    if (!isset($sa_url)) {
        $sa_url = get_first_service_of_type(SR_SERVICE_TYPE::SLICE_AUTHORITY);
        if (!isset($sa_url) || is_null($sa_url) || $sa_url == '') {
            error_log("Found no SA in SR!'");
        }
    }
    // Use $username
    // Get users projects
    $project_ids = get_projects_for_member($sa_url, $user, $user->account_id, true);
    $num_projects = count($project_ids);
    // for each project
    foreach ($project_ids as $project_id) {
        $project = lookup_project($sa_url, $user, $project_id);
        if (convert_boolean($project[PA_PROJECT_TABLE_FIELDNAME::EXPIRED])) {