diff --git a/filter/filterConfig.xml b/filter/filterConfig.xml
index 98c2a12..94d0770 100644
--- a/filter/filterConfig.xml
+++ b/filter/filterConfig.xml
@@ -26,6 +26,13 @@
description="plugins.importexport.fullJournalTransfer.description"
inputType="xml::schema(plugins/importexport/fullJournalTransfer/fullJournal.xsd)"
outputType="class::classes.journal.Journal" />
+
+
+
getObjectsByGroup('user-xml=>user');
+ $userFilters = $filterDao->getObjectsByGroup('native-xml=>user');
assert(count($userFilters) == 1);
$filter = array_shift($userFilters);
$filter->setDeployment(new PKPUserImportExportDeployment($journal, null));
diff --git a/filter/import/NativeXmlUserFilter.inc.php b/filter/import/NativeXmlUserFilter.inc.php
new file mode 100644
index 0000000..f706d6d
--- /dev/null
+++ b/filter/import/NativeXmlUserFilter.inc.php
@@ -0,0 +1,51 @@
+setDisplayName('Native XML user import');
+ parent::__construct($filterGroup);
+ }
+
+ public function getClassName()
+ {
+ return 'plugins.importexport.fullJournalTransfer.filter.import.NativeXmlUserFilter';
+ }
+
+ public function importUserPasswordValidation($userToImport, $encryption)
+ {
+ $password = parent::importUserPasswordValidation($userToImport, $encryption);
+
+ $this->generateUsername($userToImport);
+
+ return $password;
+ }
+
+ public function generateUsername($user)
+ {
+ $userDAO = DAORegistry::getDAO('UserDAO');
+ $baseUsername = preg_replace('/[^A-Z0-9]/i', '', $user->getUsername());
+ for ($username = $baseUsername, $i = 1; $userDAO->userExistsByUsername($username); $i++) {
+ $username = $baseUsername . $i;
+ }
+
+ $user->setUsername($username);
+ }
+}
diff --git a/tests/import/NativeXmlUserFilterTest.php b/tests/import/NativeXmlUserFilterTest.php
new file mode 100644
index 0000000..5a180d0
--- /dev/null
+++ b/tests/import/NativeXmlUserFilterTest.php
@@ -0,0 +1,43 @@
+user';
+ }
+
+ protected function getNativeImportExportFilterClass()
+ {
+ return NativeXmlUserFilter::class;
+ }
+
+ protected function getMockedDAOs()
+ {
+ return ['UserDAO'];
+ }
+
+ public function testGenerateUsername()
+ {
+ $userImportFilter = $this->getNativeImportExportFilter();
+
+ $mockUserDAO = $this->getMockBuilder(UserDAO::class)
+ ->setMethods(['userExistsByUsername'])
+ ->getMock();
+ $mockUserDAO->expects($this->any())
+ ->method('userExistsByUsername')
+ ->will($this->onConsecutiveCalls(true, false));
+
+ DAORegistry::registerDAO('UserDAO', $mockUserDAO);
+
+ $user = new User();
+ $user->setUsername('reviewer');
+
+ $userImportFilter->generateUsername($user);
+
+ $this->assertEquals('reviewer1', $user->getUsername());
+ }
+}
diff --git a/version.xml b/version.xml
index dcee599..71bdee9 100644
--- a/version.xml
+++ b/version.xml
@@ -10,7 +10,7 @@
fullJournalTransfer
plugins.importexport
- 2.0.10.1
- 2024-04-24
+ 2.0.10.2
+ 2024-04-25
FullJournalImportExportPlugin