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,
|
||||
'limit' => 1000,
|
||||
'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;
|
||||
$clTRID = (string) $xml->command->clTRID;
|
||||
|
||||
|
@ -980,12 +980,41 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
|
||||
// Registrant
|
||||
$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);
|
||||
|
||||
$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->execute();
|
||||
|
||||
|
@ -1055,10 +1084,6 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
return;
|
||||
}
|
||||
|
||||
$registrantStmt = $db->prepare("SELECT id FROM contact WHERE identifier = :registrant LIMIT 1");
|
||||
$registrantStmt->execute([':registrant' => $registrant_id]);
|
||||
$registrant_id = $registrantStmt->fetchColumn();
|
||||
|
||||
try {
|
||||
$db->beginTransaction();
|
||||
|
||||
|
|
|
@ -279,13 +279,15 @@ function processDomainInfo($conn, $db, $xml, $trans) {
|
|||
'name' => $domain['name'],
|
||||
'roid' => 'A' . $domain['id'],
|
||||
'status' => $status['status'],
|
||||
'registrant' => $registrant_id,
|
||||
'contact' => $transformedContacts,
|
||||
'clID' => getRegistrarClid($db, $domain['clid']),
|
||||
'crID' => getRegistrarClid($db, $domain['crid']),
|
||||
'crDate' => $domain['crdate'],
|
||||
'exDate' => $domain['exdate']
|
||||
];
|
||||
if ($registrant_id !== null && $registrant_id !== false) {
|
||||
$response['registrant'] = $registrant_id;
|
||||
}
|
||||
if (isset($domain['authinfo'])) {
|
||||
$response['authInfo'] = 'valid';
|
||||
$response['authInfo_type'] = $domain['authtype'];
|
||||
|
@ -432,13 +434,15 @@ function processDomainInfo($conn, $db, $xml, $trans) {
|
|||
'name' => $domain['name'],
|
||||
'roid' => 'D' . $domain['id'],
|
||||
'status' => $statusArray,
|
||||
'registrant' => $registrant_id,
|
||||
'contact' => $transformedContacts,
|
||||
'clID' => getRegistrarClid($db, $domain['clid']),
|
||||
'crID' => getRegistrarClid($db, $domain['crid']),
|
||||
'crDate' => $domain['crdate'],
|
||||
'exDate' => $domain['exdate']
|
||||
];
|
||||
if ($registrant_id !== null && $registrant_id !== false) {
|
||||
$response['registrant'] = $registrant_id;
|
||||
}
|
||||
// Conditionally add upID, upDate, and trDate to the response
|
||||
if (isset($domain['upid']) && $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);
|
||||
$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);
|
||||
break;
|
||||
}
|
||||
|
@ -275,6 +279,10 @@ $server->handle(function (Connection $conn) use ($table, $pool, $c, $log, $permi
|
|||
sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID);
|
||||
$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);
|
||||
break;
|
||||
}
|
||||
|
@ -290,6 +298,10 @@ $server->handle(function (Connection $conn) use ($table, $pool, $c, $log, $permi
|
|||
sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID);
|
||||
$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);
|
||||
break;
|
||||
}
|
||||
|
@ -305,6 +317,10 @@ $server->handle(function (Connection $conn) use ($table, $pool, $c, $log, $permi
|
|||
sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID);
|
||||
$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);
|
||||
break;
|
||||
}
|
||||
|
@ -320,6 +336,10 @@ $server->handle(function (Connection $conn) use ($table, $pool, $c, $log, $permi
|
|||
sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID);
|
||||
$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);
|
||||
break;
|
||||
}
|
||||
|
@ -335,6 +355,10 @@ $server->handle(function (Connection $conn) use ($table, $pool, $c, $log, $permi
|
|||
sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID);
|
||||
$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);
|
||||
break;
|
||||
}
|
||||
|
@ -395,7 +419,7 @@ $server->handle(function (Connection $conn) use ($table, $pool, $c, $log, $permi
|
|||
sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID);
|
||||
$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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue