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
a952a116
Commit
a952a116
authored
11 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
OO-809: better case handling by import of users in group (patch 2 of S. Clemenz)
parent
f268712e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/olat/course/member/wizard/ImportMemberOverviewIdentitiesController.java
+26
-29
26 additions, 29 deletions
...mber/wizard/ImportMemberOverviewIdentitiesController.java
with
26 additions
and
29 deletions
src/main/java/org/olat/course/member/wizard/ImportMemberOverviewIdentitiesController.java
+
26
−
29
View file @
a952a116
...
@@ -44,7 +44,6 @@ import org.olat.core.gui.control.generic.wizard.StepsRunContext;
...
@@ -44,7 +44,6 @@ import org.olat.core.gui.control.generic.wizard.StepsRunContext;
import
org.olat.core.gui.translator.Translator
;
import
org.olat.core.gui.translator.Translator
;
import
org.olat.core.id.Identity
;
import
org.olat.core.id.Identity
;
import
org.olat.core.id.UserConstants
;
import
org.olat.core.id.UserConstants
;
import
org.olat.core.util.mail.MailHelper
;
import
org.olat.user.UserManager
;
import
org.olat.user.UserManager
;
import
org.olat.user.propertyhandlers.UserPropertyHandler
;
import
org.olat.user.propertyhandlers.UserPropertyHandler
;
...
@@ -93,7 +92,7 @@ public class ImportMemberOverviewIdentitiesController extends StepFormBasicContr
...
@@ -93,7 +92,7 @@ public class ImportMemberOverviewIdentitiesController extends StepFormBasicContr
warnLayout
.
setRootForm
(
mainForm
);
warnLayout
.
setRootForm
(
mainForm
);
formLayout
.
add
(
warnLayout
);
formLayout
.
add
(
warnLayout
);
StringBu
ff
er
sb
=
new
StringBu
ff
er
();
StringBu
ild
er
sb
=
new
StringBu
ild
er
();
for
(
String
notfound:
notfounds
)
{
for
(
String
notfound:
notfounds
)
{
if
(
sb
.
length
()
>
0
)
sb
.
append
(
", "
);
if
(
sb
.
length
()
>
0
)
sb
.
append
(
", "
);
sb
.
append
(
notfound
);
sb
.
append
(
notfound
);
...
@@ -160,45 +159,43 @@ public class ImportMemberOverviewIdentitiesController extends StepFormBasicContr
...
@@ -160,45 +159,43 @@ public class ImportMemberOverviewIdentitiesController extends StepFormBasicContr
}
}
}
}
//search by names
//search by institutionalUserIdentifier, case sensitive
List
<
Identity
>
identities
=
securityManager
.
findIdentitiesByName
(
identList
);
List
<
Identity
>
institutIdentities
=
securityManager
.
findIdentitiesByNumber
(
identList
);
for
(
Identity
identity:
identities
)
{
for
(
Identity
identity:
institutIdentities
)
{
identList
.
remove
(
identity
.
getName
());
String
userIdent
=
identity
.
getUser
().
getProperty
(
UserConstants
.
INSTITUTIONALUSERIDENTIFIER
,
null
);
if
(
userIdent
!=
null
)
{
identList
.
remove
(
userIdent
);
}
if
(!
PersistenceHelper
.
containsPersistable
(
oks
,
identity
)
if
(!
PersistenceHelper
.
containsPersistable
(
oks
,
identity
)
&&
!
securityManager
.
isIdentityInSecurityGroup
(
identity
,
anonymousSecGroup
))
{
&&
!
securityManager
.
isIdentityInSecurityGroup
(
identity
,
anonymousSecGroup
))
{
oks
.
add
(
identity
);
oks
.
add
(
identity
);
}
}
}
}
// make a lowercase copy of identList for processing username and email
//search by email
List
<
String
>
identListLowercase
=
new
ArrayList
<
String
>(
identList
.
size
());
List
<
String
>
emails
=
new
ArrayList
<
String
>();
for
(
String
ident:
identList
)
{
for
(
String
ident:
identList
)
{
identListLowercase
.
add
(
ident
.
toLowerCase
());
if
(
MailHelper
.
isValidEmailAddress
(
ident
))
{
}
emails
.
add
(
ident
);
//search by names, must be lower case
List
<
Identity
>
identities
=
securityManager
.
findIdentitiesByName
(
identListLowercase
);
for
(
Identity
identity:
identities
)
{
identListLowercase
.
remove
(
identity
.
getName
());
if
(!
PersistenceHelper
.
containsPersistable
(
oks
,
identity
)
&&
!
securityManager
.
isIdentityInSecurityGroup
(
identity
,
anonymousSecGroup
))
{
oks
.
add
(
identity
);
}
}
}
}
List
<
Identity
>
mailIdentities
=
userManager
.
findIdentitiesByEmail
(
emails
);
//search by email, case insensitive
List
<
Identity
>
mailIdentities
=
userManager
.
findIdentitiesByEmail
(
identListLowercase
);
for
(
Identity
identity:
mailIdentities
)
{
for
(
Identity
identity:
mailIdentities
)
{
String
email
=
identity
.
getUser
().
getProperty
(
UserConstants
.
EMAIL
,
null
);
String
email
=
identity
.
getUser
().
getProperty
(
UserConstants
.
EMAIL
,
null
);
if
(
email
!=
null
)
{
if
(
email
!=
null
)
{
identList
.
remove
(
email
);
identList
Lowercase
.
remove
(
email
.
toLowerCase
()
);
}
}
String
institutEmail
=
identity
.
getUser
().
getProperty
(
UserConstants
.
INSTITUTIONALEMAIL
,
null
);
String
institutEmail
=
identity
.
getUser
().
getProperty
(
UserConstants
.
INSTITUTIONALEMAIL
,
null
);
if
(
institutEmail
!=
null
)
{
if
(
institutEmail
!=
null
)
{
identList
.
remove
(
institutEmail
);
identListLowercase
.
remove
(
institutEmail
.
toLowerCase
());
}
if
(!
PersistenceHelper
.
containsPersistable
(
oks
,
identity
)
&&
!
securityManager
.
isIdentityInSecurityGroup
(
identity
,
anonymousSecGroup
))
{
oks
.
add
(
identity
);
}
}
//search by institutionalUserIdentifier
List
<
Identity
>
institutIdentities
=
securityManager
.
findIdentitiesByNumber
(
identList
);
for
(
Identity
identity:
institutIdentities
)
{
String
userIdent
=
identity
.
getUser
().
getProperty
(
UserConstants
.
INSTITUTIONALUSERIDENTIFIER
,
null
);
if
(
userIdent
!=
null
)
{
identList
.
remove
(
userIdent
);
}
}
if
(!
PersistenceHelper
.
containsPersistable
(
oks
,
identity
)
if
(!
PersistenceHelper
.
containsPersistable
(
oks
,
identity
)
&&
!
securityManager
.
isIdentityInSecurityGroup
(
identity
,
anonymousSecGroup
))
{
&&
!
securityManager
.
isIdentityInSecurityGroup
(
identity
,
anonymousSecGroup
))
{
...
@@ -206,7 +203,7 @@ public class ImportMemberOverviewIdentitiesController extends StepFormBasicContr
...
@@ -206,7 +203,7 @@ public class ImportMemberOverviewIdentitiesController extends StepFormBasicContr
}
}
}
}
notfounds
.
addAll
(
identList
);
notfounds
.
addAll
(
identList
Lowercase
);
}
}
public
boolean
validate
()
{
public
boolean
validate
()
{
...
...
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