Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OLAT CI-CD Testing Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Oliver Dam
OLAT CI-CD Testing Project
Commits
f3b8f39b
Commit
f3b8f39b
authored
4 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
OO-4690: prevent duplicate user name in import (with different emails)
parent
1f02891d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/olat/admin/user/imp/ImportStep00.java
+10
-10
10 additions, 10 deletions
src/main/java/org/olat/admin/user/imp/ImportStep00.java
with
10 additions
and
10 deletions
src/main/java/org/olat/admin/user/imp/ImportStep00.java
+
10
−
10
View file @
f3b8f39b
...
@@ -28,7 +28,6 @@ import static org.olat.login.ui.LoginUIFactory.formatDescriptionAsList;
...
@@ -28,7 +28,6 @@ import static org.olat.login.ui.LoginUIFactory.formatDescriptionAsList;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -147,7 +146,7 @@ class ImportStep00 extends BasicStep {
...
@@ -147,7 +146,7 @@ class ImportStep00 extends BasicStep {
addToRunContext
(
"updateIdents"
,
updateIdents
);
addToRunContext
(
"updateIdents"
,
updateIdents
);
addToRunContext
(
"validImport"
,
Boolean
.
TRUE
);
addToRunContext
(
"validImport"
,
Boolean
.
TRUE
);
boolean
newUsers
=
false
;
boolean
newUsers
=
false
;
if
(
newIdents
.
size
()
!=
0
)
{
if
(
!
newIdents
.
isEmpty
()
)
{
setNextStep
(
new
ImportStep01
(
ureq
,
canCreateOLATPassword
,
true
));
setNextStep
(
new
ImportStep01
(
ureq
,
canCreateOLATPassword
,
true
));
newUsers
=
true
;
newUsers
=
true
;
}
}
...
@@ -196,7 +195,9 @@ class ImportStep00 extends BasicStep {
...
@@ -196,7 +195,9 @@ class ImportStep00 extends BasicStep {
// use comma as fallback delimiter, e.g. for better testing
// use comma as fallback delimiter, e.g. for better testing
if
(
line
.
indexOf
(
delimiter
)
==
-
1
)
delimiter
=
","
;
if
(
line
.
indexOf
(
delimiter
)
==
-
1
)
delimiter
=
","
;
String
[]
parts
=
line
.
split
(
delimiter
);
String
[]
parts
=
line
.
split
(
delimiter
);
String
login
,
pwd
,
lang
;
String
login
;
String
pwd
;
String
lang
;
int
columnId
=
0
;
int
columnId
=
0
;
...
@@ -262,9 +263,9 @@ class ImportStep00 extends BasicStep {
...
@@ -262,9 +263,9 @@ class ImportStep00 extends BasicStep {
UpdateIdentity
uIdentity
=
new
UpdateIdentity
(
ident
,
pwd
,
lang
);
UpdateIdentity
uIdentity
=
new
UpdateIdentity
(
ident
,
pwd
,
lang
);
importDataError
=
updateUserProperties
(
uIdentity
,
ident
.
getUser
(),
parts
,
i
,
columnId
,
importedEmails
);
importDataError
|
=
updateUserProperties
(
uIdentity
,
ident
.
getUser
(),
parts
,
i
,
columnId
,
importedEmails
);
if
(
importDataError
)
break
;
if
(
importDataError
)
break
;
importDataError
=
!
validatePassword
(
pwd
,
uIdentity
,
i
);
importDataError
|
=
!
validatePassword
(
pwd
,
uIdentity
,
i
);
if
(
importDataError
)
break
;
if
(
importDataError
)
break
;
idents
.
add
(
uIdentity
);
idents
.
add
(
uIdentity
);
...
@@ -272,8 +273,7 @@ class ImportStep00 extends BasicStep {
...
@@ -272,8 +273,7 @@ class ImportStep00 extends BasicStep {
}
else
{
}
else
{
// no identity/user yet, create
// no identity/user yet, create
// check that no user with same login name is already in list
// check that no user with same login name is already in list
for
(
Iterator
<
TransientIdentity
>
it_news
=
newIdents
.
iterator
();
it_news
.
hasNext
();)
{
for
(
TransientIdentity
singleUser:
newIdents
)
{
TransientIdentity
singleUser
=
it_news
.
next
();
if
(
singleUser
.
getName
().
equalsIgnoreCase
(
login
))
{
if
(
singleUser
.
getName
().
equalsIgnoreCase
(
login
))
{
textAreaElement
.
setErrorKey
(
"error.login.douplicate"
,
new
String
[]
{
String
.
valueOf
(
i
+
1
),
login
});
textAreaElement
.
setErrorKey
(
"error.login.douplicate"
,
new
String
[]
{
String
.
valueOf
(
i
+
1
),
login
});
importDataError
=
true
;
importDataError
=
true
;
...
@@ -287,11 +287,11 @@ class ImportStep00 extends BasicStep {
...
@@ -287,11 +287,11 @@ class ImportStep00 extends BasicStep {
uIdentity
.
setPassword
(
pwd
);
uIdentity
.
setPassword
(
pwd
);
uIdentity
.
setLanguage
(
lang
);
uIdentity
.
setLanguage
(
lang
);
importDataError
=
updateUserProperties
(
uIdentity
,
null
,
parts
,
i
,
columnId
,
importedEmails
);
importDataError
|
=
updateUserProperties
(
uIdentity
,
null
,
parts
,
i
,
columnId
,
importedEmails
);
if
(
importDataError
)
break
;
if
(
importDataError
)
break
;
importDataError
=
!
validateUsername
(
login
,
uIdentity
,
i
);
importDataError
|
=
!
validateUsername
(
login
,
uIdentity
,
i
);
if
(
importDataError
)
break
;
if
(
importDataError
)
break
;
importDataError
=
!
validatePassword
(
pwd
,
uIdentity
,
i
);
importDataError
|
=
!
validatePassword
(
pwd
,
uIdentity
,
i
);
if
(
importDataError
)
break
;
if
(
importDataError
)
break
;
idents
.
add
(
uIdentity
);
idents
.
add
(
uIdentity
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment