Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
best-practical
rt-extension-ldapimport
Commits
91b5a08f
Commit
91b5a08f
authored
Feb 23, 2013
by
Alex Vandiver
Browse files
Push Name checking into _import_user, to tighten the import_users loop
parent
70259d7d
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/RT/Extension/LDAPImport.pm
View file @
91b5a08f
...
...
@@ -500,14 +500,6 @@ sub import_users {
my
$done
=
0
;
my
$count
=
scalar
@results
;
while
(
my
$entry
=
shift
@results
)
{
my
$user
=
$self
->
_build_user_object
(
ldap_entry
=>
$entry
);
unless
(
$user
->
{
Name
}
)
{
$self
->
_warn
("
No Name or Emailaddress for user, skipping
"
.
Dumper
$user
);
next
;
}
if
(
$user
->
{
Name
}
=~
/^[0-9]+$/
)
{
$self
->
_debug
("
Skipping user '
$user
->{Name}', as it is numeric
");
next
;
}
$self
->
_import_user
(
user
=>
$user
,
ldap_entry
=>
$entry
,
import
=>
$args
{
import
}
);
$done
++
;
$self
->
_debug
("
Imported
$done
/
$count
users
");
...
...
@@ -526,6 +518,15 @@ sub _import_user {
my
$self
=
shift
;
my
%args
=
@_
;
unless
(
$args
{
user
}{
Name
}
)
{
$self
->
_warn
("
No Name or Emailaddress for user, skipping
"
.
Dumper
(
$args
{
user
}));
return
;
}
if
(
$args
{
user
}{
Name
}
=~
/^[0-9]+$/
)
{
$self
->
_debug
("
Skipping user '
$args
{user}{Name}', as it is numeric
");
return
;
}
$self
->
_debug
("
Processing user
$args
{user}{Name}
");
$self
->
_cache_user
(
%args
);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment