Page MenuHomePhorge

D5286.1775346362.diff
No OneTemporary

Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None

D5286.1775346362.diff

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
@@ -633,6 +633,14 @@
'Domains' => 'domain',
];
+ // Skip entries with these classes
+ $ignoreByClass = [
+ 'cossuperdefinition',
+ 'extensibleobject',
+ 'nscontainer',
+ 'nsroledefinition',
+ ];
+
// Ignore LDIF header
if (!empty($entry['version'])) {
return null;
@@ -640,15 +648,17 @@
if (!isset($entry['objectclass'])) {
$entry['objectclass'] = [];
+ } else {
+ $entry['objectclass'] = array_map('strtolower', (array) $entry['objectclass']);
}
// Skip non-importable entries
- if (
- preg_match('/uid=(cyrus-admin|kolab-service)/', $entry['dn'])
- || in_array('nsroledefinition', $entry['objectclass'])
- || in_array('organizationalUnit', $entry['objectclass'])
- || in_array('organizationalunit', $entry['objectclass'])
- ) {
+ if (count(array_intersect($entry['objectclass'], $ignoreByClass)) > 0) {
+ return null;
+ }
+
+ // Skip special entries
+ if (preg_match('/uid=(cyrus-admin|kolab-service)/', $entry['dn'])) {
return null;
}
@@ -745,6 +755,8 @@
}
} elseif (!empty($entry['dn']) && str_starts_with($entry['dn'], 'dc=')) {
$result['namespace'] = strtolower(str_replace(['dc=', ','], ['', '.'], $entry['dn']));
+ } elseif (!empty($entry['ou']) && preg_match('/^[a-zA-Z0-9.]+\.[a-zA-Z]+$/', $entry['ou'])) {
+ $result['namespace'] = strtolower($entry['ou']);
} else {
$error = "Missing 'associatedDomain' and 'dn' attribute";
}
diff --git a/src/database/migrations/2025_05_30_100000_users_password_ldap_column.php b/src/database/migrations/2025_05_30_100000_users_password_ldap_column.php
new file mode 100644
--- /dev/null
+++ b/src/database/migrations/2025_05_30_100000_users_password_ldap_column.php
@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration {
+ /**
+ * Run the migrations.
+ */
+ public function up()
+ {
+ Schema::table(
+ 'users',
+ static function (Blueprint $table) {
+ $table->string('password_ldap', 512)->nullable()->change();
+ }
+ );
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down()
+ {
+ Schema::table(
+ 'users',
+ static function (Blueprint $table) {
+ $table->string('password_ldap')->nullable()->change();
+ }
+ );
+ }
+};
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
@@ -287,6 +287,16 @@
$this->assertSame(['namespace' => 'test.com'], $result[0]);
$this->assertNull($result[1]);
+ $entry = ['ou' => 'sub.test.com'];
+ $result = $this->invokeMethod($command, 'parseLDAPDomain', [$entry]);
+ $this->assertSame(['namespace' => 'sub.test.com'], $result[0]);
+ $this->assertNull($result[1]);
+
+ $entry = ['dn' => 'dc=test,dc=kolab,dc=org'];
+ $result = $this->invokeMethod($command, 'parseLDAPDomain', [$entry]);
+ $this->assertSame(['namespace' => 'test.kolab.org'], $result[0]);
+ $this->assertNull($result[1]);
+
$entry = ['associateddomain' => 'test.com', 'inetdomainstatus' => 'deleted'];
$result = $this->invokeMethod($command, 'parseLDAPDomain', [$entry]);
$this->assertSame([], $result[0]);

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 4, 11:46 PM (4 h, 49 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18831615
Default Alt Text
D5286.1775346362.diff (3 KB)

Event Timeline