Ejemplo n.º 1
0
    }
    $response = array();
    $p = new People();
    $p->PersonID = $personid;
    if (!$p->GetPerson()) {
        $response['error'] = true;
        $response['errorcode'] = 404;
        $response['message'] = __("User not found in database.");
        echoResponse(200, $response);
    } else {
        // Slim Framework will simply return null for any variables that were not passed, so this is safe to call without blowing up the script
        foreach ($p as $prop) {
            $p->{$prop} = $app->request->post($prop);
        }
        $p->Disabled = false;
        if (!$p->UpdatePerson()) {
            $response['error'] = true;
            $response['errorcode'] = 403;
            $response['message'] = __("Unable to update People resource with the given parameters.");
            echoResponse(200, $response);
        } else {
            $response['error'] = false;
            $response['errorcode'] = 200;
            $response['message'] = sprintf(__('People resource for UserID=%1$s updated successfully.'), $p->UserID);
            $response['people'] = $p;
            echoResponse(200, $response);
        }
    }
});
//
//	URL:	/api/v1/people
Ejemplo n.º 2
0
        $userRights->ReadAccess = isset($_POST['ReadAccess']) ? 1 : 0;
        $userRights->WriteAccess = isset($_POST['WriteAccess']) ? 1 : 0;
        $userRights->DeleteAccess = isset($_POST['DeleteAccess']) ? 1 : 0;
        $userRights->ContactAdmin = isset($_POST['ContactAdmin']) ? 1 : 0;
        $userRights->RackRequest = isset($_POST['RackRequest']) ? 1 : 0;
        $userRights->RackAdmin = isset($_POST['RackAdmin']) ? 1 : 0;
        $userRights->SiteAdmin = isset($_POST['SiteAdmin']) ? 1 : 0;
        $userRights->Disabled = isset($_POST['Disabled']) ? 1 : 0;
        if ($_POST['action'] == 'Create') {
            $userRights->CreatePerson();
            // We've, hopefully, successfully created a new device. Force them to the new device page.
            header('Location: ' . redirect("usermgr.php?PersonID={$userRights->PersonID}"));
            exit;
        } else {
            $status = __("Updated");
            $userRights->UpdatePerson();
        }
    } else {
        //Should we ever add a delete user function it will go here
    }
    // Reload rights because actions like disable reset other rights
    $userRights->GetUserRights();
}
$userList = $userRights->GetUserList();
$adminown = $userRights->AdminOwnDevices ? "checked" : "";
$read = $userRights->ReadAccess ? "checked" : "";
$write = $userRights->WriteAccess ? "checked" : "";
$delete = $userRights->DeleteAccess ? "checked" : "";
$contact = $userRights->ContactAdmin ? "checked" : "";
$request = $userRights->RackRequest ? "checked" : "";
$RackAdmin = $userRights->RackAdmin ? "checked" : "";