Page MenuHomePhorge

D5466.1775209484.diff
No OneTemporary

Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None

D5466.1775209484.diff

diff --git a/config.prod/src/database/seeds/AdminSeeder.php b/config.prod/src/database/seeds/AdminSeeder.php
--- a/config.prod/src/database/seeds/AdminSeeder.php
+++ b/config.prod/src/database/seeds/AdminSeeder.php
@@ -212,7 +212,7 @@
$domainPackage = Package::create(
[
- 'title' => 'domain',
+ 'title' => 'domain-hosting',
'name' => 'Domain',
'description' => 'Domain.',
'discount_rate' => 0,
diff --git a/src/app/Console/Commands/Data/Import/LdifCommand.php b/src/app/Console/Commands/Data/Import/LdifCommand.php
--- a/src/app/Console/Commands/Data/Import/LdifCommand.php
+++ b/src/app/Console/Commands/Data/Import/LdifCommand.php
@@ -230,7 +230,7 @@
$contact = $this->wallet->owner->contacts()->where('email', $data->email)->first();
if ($contact) {
- $this->setImportWarning($_contact->id, "Contact already exists");
+ $this->setImportWarning($_contact->id, "Contact '{$data->email}' already exists");
continue;
}
@@ -288,7 +288,13 @@
$domain = Domain::withTrashed()->where('namespace', $data->namespace)->first();
if ($domain) {
- $this->setImportWarning($_domain->id, "Domain already exists");
+ if ($domain->wallet()?->id == $this->wallet?->id) {
+ $this->domains[] = $domain->namespace;
+ $this->setImportWarning($_domain->id, "Domain '{$data->namespace}' already exists");
+ } else {
+ $this->setImportWarning($_domain->id, "Domain '{$data->namespace}' already exists (different owner)");
+ }
+
continue;
}
@@ -309,7 +315,7 @@
$domain = Domain::withTrashed()->where('namespace', $alias)->first();
if ($domain) {
- $this->setImportWarning($_domain->id, "Domain already exists");
+ $this->setImportWarning($_domain->id, "Domain '{$alias}' already exists");
continue;
}
@@ -357,13 +363,13 @@
$group = Group::withTrashed()->where('email', $data->email)->first();
if ($group) {
- $this->setImportWarning($_group->id, "Group already exists");
+ $this->setImportWarning($_group->id, "Group '{$data->email}' already exists");
continue;
}
// Make sure the domain exists
if (!$this->domainExists($data->domain)) {
- $this->setImportWarning($_group->id, "Domain not found");
+ $this->setImportWarning($_group->id, "Domain '{$data->domain}' not found");
continue;
}
@@ -425,7 +431,7 @@
// Make sure the domain exists
if (!$this->domainExists($data->domain)) {
- $this->setImportWarning($_resource->id, "Domain not found");
+ $this->setImportWarning($_resource->id, "Domain '{$data->domain}' not found");
continue;
}
@@ -479,7 +485,7 @@
// Make sure the domain exists
if (!$this->domainExists($data->domain)) {
- $this->setImportWarning($_folder->id, "Domain not found");
+ $this->setImportWarning($_folder->id, "Domain '{$data->domain}' not found");
continue;
}
@@ -591,7 +597,7 @@
// Make sure the domain exists
if ($this->wallet && !$this->domainExists($data->domain)) {
- $this->setImportWarning($ldap_user->id, "Domain not found");
+ $this->setImportWarning($ldap_user->id, "Domain '{$data->domain}' not found");
return;
}
@@ -1192,6 +1198,15 @@
'domain' => Package::where('title', 'domain-hosting')->where('tenant_id', $this->tenantId)->first(),
];
+ if (empty($this->packages['domain'])) {
+ $this->error("Package 'domain-hosting' not found.");
+ exit;
+ }
+ if (empty($this->packages['user'])) {
+ $this->error("Package 'kolab' not found.");
+ exit;
+ }
+
// Count storage skus
$sku = $this->packages['user']->skus()->where('title', 'storage')->first();
diff --git a/src/tests/Feature/Console/Data/Import/LdifTest.php b/src/tests/Feature/Console/Data/Import/LdifTest.php
--- a/src/tests/Feature/Console/Data/Import/LdifTest.php
+++ b/src/tests/Feature/Console/Data/Import/LdifTest.php
@@ -58,7 +58,7 @@
$this->assertStringContainsString("Importing groups... DONE", $output);
$this->assertStringNotContainsString("ERROR", $output);
$this->assertStringContainsString(
- "WARNING cn=unknowndomain,ou=groups,ou=kolab3.org,dc=hosted,dc=com: Domain not found",
+ "WARNING cn=unknowndomain,ou=groups,ou=kolab3.org,dc=hosted,dc=com: Domain 'kolab3.org' not found",
$output
);

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 3, 9:44 AM (19 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18823524
Default Alt Text
D5466.1775209484.diff (4 KB)

Event Timeline