mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-03 01:23:22 +02:00
Added minimum data set support for EPP #114
This commit is contained in:
parent
1e8ab1466d
commit
92a4c1d268
4 changed files with 65 additions and 11 deletions
|
@ -18,4 +18,5 @@ return [
|
||||||
'rately' => false,
|
'rately' => false,
|
||||||
'limit' => 1000,
|
'limit' => 1000,
|
||||||
'period' => 60,
|
'period' => 60,
|
||||||
|
'minimum_data' => false,
|
||||||
];
|
];
|
|
@ -570,7 +570,7 @@ function processHostCreate($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) {
|
function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans, $minimum_data) {
|
||||||
$domainName = $xml->command->create->children('urn:ietf:params:xml:ns:domain-1.0')->create->name;
|
$domainName = $xml->command->create->children('urn:ietf:params:xml:ns:domain-1.0')->create->name;
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
|
||||||
|
@ -980,12 +980,41 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
|
|
||||||
// Registrant
|
// Registrant
|
||||||
$registrant = $xml->xpath('//domain:registrant[1]');
|
$registrant = $xml->xpath('//domain:registrant[1]');
|
||||||
$registrant_id = (string)$registrant[0][0];
|
$registrant_id = null; // Default to null
|
||||||
|
|
||||||
|
if ($registrant && count($registrant) > 0) {
|
||||||
|
$registrant_id = (string)$registrant[0][0];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check $minimum_data and handle registrant_id accordingly
|
||||||
|
if ($minimum_data) {
|
||||||
|
// In minimal data mode, registrant_id should always be null
|
||||||
|
if ($registrant_id !== null) {
|
||||||
|
// If registrant_id is submitted, give an error
|
||||||
|
sendEppError($conn, $db, 2306, 'domain:registrant field is not supported in minimal data mode', $clTRID);
|
||||||
|
$conn->close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Non-minimal data mode: registrant_id must not be null
|
||||||
|
if ($registrant_id === null) {
|
||||||
|
sendEppError($conn, $db, 2303, 'domain:registrant is required and does not exist', $clTRID, $trans);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($registrant) {
|
|
||||||
$validRegistrant = validate_identifier($registrant_id);
|
$validRegistrant = validate_identifier($registrant_id);
|
||||||
|
|
||||||
$stmt = $db->prepare("SELECT id, clid FROM contact WHERE identifier = :registrant LIMIT 1");
|
$registrantStmt = $db->prepare("SELECT id FROM contact WHERE identifier = :registrant LIMIT 1");
|
||||||
|
$registrantStmt->execute([':registrant' => $registrant_id]);
|
||||||
|
$registrant_id = $registrantStmt->fetchColumn();
|
||||||
|
|
||||||
|
// Set registrant_id to null if it returns false
|
||||||
|
if ($registrant_id === false) {
|
||||||
|
sendEppError($conn, $db, 2303, 'domain:registrant does not exist', $clTRID, $trans);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt = $db->prepare("SELECT id, clid FROM contact WHERE id = :registrant LIMIT 1");
|
||||||
$stmt->bindParam(':registrant', $registrant_id);
|
$stmt->bindParam(':registrant', $registrant_id);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
|
@ -1055,10 +1084,6 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$registrantStmt = $db->prepare("SELECT id FROM contact WHERE identifier = :registrant LIMIT 1");
|
|
||||||
$registrantStmt->execute([':registrant' => $registrant_id]);
|
|
||||||
$registrant_id = $registrantStmt->fetchColumn();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$db->beginTransaction();
|
$db->beginTransaction();
|
||||||
|
|
||||||
|
|
|
@ -279,13 +279,15 @@ function processDomainInfo($conn, $db, $xml, $trans) {
|
||||||
'name' => $domain['name'],
|
'name' => $domain['name'],
|
||||||
'roid' => 'A' . $domain['id'],
|
'roid' => 'A' . $domain['id'],
|
||||||
'status' => $status['status'],
|
'status' => $status['status'],
|
||||||
'registrant' => $registrant_id,
|
|
||||||
'contact' => $transformedContacts,
|
'contact' => $transformedContacts,
|
||||||
'clID' => getRegistrarClid($db, $domain['clid']),
|
'clID' => getRegistrarClid($db, $domain['clid']),
|
||||||
'crID' => getRegistrarClid($db, $domain['crid']),
|
'crID' => getRegistrarClid($db, $domain['crid']),
|
||||||
'crDate' => $domain['crdate'],
|
'crDate' => $domain['crdate'],
|
||||||
'exDate' => $domain['exdate']
|
'exDate' => $domain['exdate']
|
||||||
];
|
];
|
||||||
|
if ($registrant_id !== null && $registrant_id !== false) {
|
||||||
|
$response['registrant'] = $registrant_id;
|
||||||
|
}
|
||||||
if (isset($domain['authinfo'])) {
|
if (isset($domain['authinfo'])) {
|
||||||
$response['authInfo'] = 'valid';
|
$response['authInfo'] = 'valid';
|
||||||
$response['authInfo_type'] = $domain['authtype'];
|
$response['authInfo_type'] = $domain['authtype'];
|
||||||
|
@ -432,13 +434,15 @@ function processDomainInfo($conn, $db, $xml, $trans) {
|
||||||
'name' => $domain['name'],
|
'name' => $domain['name'],
|
||||||
'roid' => 'D' . $domain['id'],
|
'roid' => 'D' . $domain['id'],
|
||||||
'status' => $statusArray,
|
'status' => $statusArray,
|
||||||
'registrant' => $registrant_id,
|
|
||||||
'contact' => $transformedContacts,
|
'contact' => $transformedContacts,
|
||||||
'clID' => getRegistrarClid($db, $domain['clid']),
|
'clID' => getRegistrarClid($db, $domain['clid']),
|
||||||
'crID' => getRegistrarClid($db, $domain['crid']),
|
'crID' => getRegistrarClid($db, $domain['crid']),
|
||||||
'crDate' => $domain['crdate'],
|
'crDate' => $domain['crdate'],
|
||||||
'exDate' => $domain['exdate']
|
'exDate' => $domain['exdate']
|
||||||
];
|
];
|
||||||
|
if ($registrant_id !== null && $registrant_id !== false) {
|
||||||
|
$response['registrant'] = $registrant_id;
|
||||||
|
}
|
||||||
// Conditionally add upID, upDate, and trDate to the response
|
// Conditionally add upID, upDate, and trDate to the response
|
||||||
if (isset($domain['upid']) && $domain['upid']) {
|
if (isset($domain['upid']) && $domain['upid']) {
|
||||||
$response['upID'] = getRegistrarClid($db, $domain['upid']);
|
$response['upID'] = getRegistrarClid($db, $domain['upid']);
|
||||||
|
|
|
@ -260,6 +260,10 @@ $server->handle(function (Connection $conn) use ($table, $pool, $c, $log, $permi
|
||||||
sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
}
|
}
|
||||||
|
if ($c['minimum_data']) {
|
||||||
|
sendEppError($conn, $pdo, 2101, 'Contact commands are not supported in minimum data mode', $clTRID);
|
||||||
|
$conn->close();
|
||||||
|
}
|
||||||
processContactCheck($conn, $pdo, $xml, $trans);
|
processContactCheck($conn, $pdo, $xml, $trans);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -275,6 +279,10 @@ $server->handle(function (Connection $conn) use ($table, $pool, $c, $log, $permi
|
||||||
sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
}
|
}
|
||||||
|
if ($c['minimum_data']) {
|
||||||
|
sendEppError($conn, $pdo, 2101, 'Contact commands are not supported in minimum data mode', $clTRID);
|
||||||
|
$conn->close();
|
||||||
|
}
|
||||||
processContactCreate($conn, $pdo, $xml, $data['clid'], $c['db_type'], $trans);
|
processContactCreate($conn, $pdo, $xml, $data['clid'], $c['db_type'], $trans);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -290,6 +298,10 @@ $server->handle(function (Connection $conn) use ($table, $pool, $c, $log, $permi
|
||||||
sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
}
|
}
|
||||||
|
if ($c['minimum_data']) {
|
||||||
|
sendEppError($conn, $pdo, 2101, 'Contact commands are not supported in minimum data mode', $clTRID);
|
||||||
|
$conn->close();
|
||||||
|
}
|
||||||
processContactInfo($conn, $pdo, $xml, $trans);
|
processContactInfo($conn, $pdo, $xml, $trans);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -305,6 +317,10 @@ $server->handle(function (Connection $conn) use ($table, $pool, $c, $log, $permi
|
||||||
sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
}
|
}
|
||||||
|
if ($c['minimum_data']) {
|
||||||
|
sendEppError($conn, $pdo, 2101, 'Contact commands are not supported in minimum data mode', $clTRID);
|
||||||
|
$conn->close();
|
||||||
|
}
|
||||||
processContactUpdate($conn, $pdo, $xml, $data['clid'], $c['db_type'], $trans);
|
processContactUpdate($conn, $pdo, $xml, $data['clid'], $c['db_type'], $trans);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -320,6 +336,10 @@ $server->handle(function (Connection $conn) use ($table, $pool, $c, $log, $permi
|
||||||
sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
}
|
}
|
||||||
|
if ($c['minimum_data']) {
|
||||||
|
sendEppError($conn, $pdo, 2101, 'Contact commands are not supported in minimum data mode', $clTRID);
|
||||||
|
$conn->close();
|
||||||
|
}
|
||||||
processContactDelete($conn, $pdo, $xml, $data['clid'], $c['db_type'], $trans);
|
processContactDelete($conn, $pdo, $xml, $data['clid'], $c['db_type'], $trans);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -335,6 +355,10 @@ $server->handle(function (Connection $conn) use ($table, $pool, $c, $log, $permi
|
||||||
sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
}
|
}
|
||||||
|
if ($c['minimum_data']) {
|
||||||
|
sendEppError($conn, $pdo, 2101, 'Contact commands are not supported in minimum data mode', $clTRID);
|
||||||
|
$conn->close();
|
||||||
|
}
|
||||||
processContactTransfer($conn, $pdo, $xml, $data['clid'], $c['db_type'], $trans);
|
processContactTransfer($conn, $pdo, $xml, $data['clid'], $c['db_type'], $trans);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -395,7 +419,7 @@ $server->handle(function (Connection $conn) use ($table, $pool, $c, $log, $permi
|
||||||
sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
}
|
}
|
||||||
processDomainCreate($conn, $pdo, $xml, $data['clid'], $c['db_type'], $trans);
|
processDomainCreate($conn, $pdo, $xml, $data['clid'], $c['db_type'], $trans, $c['minimum_data']);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue