Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-auth_ldap_syncplus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
moodle-auth_ldap_syncplus
Commits
78c533ae
Commit
78c533ae
authored
10 years ago
by
Alexander Bias
Browse files
Options
Downloads
Patches
Plain Diff
Change line breaks to mtrace() (MDL-30589)
parent
43dfece6
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+1
-0
1 addition, 0 deletions
README.md
auth.php
+38
-36
38 additions, 36 deletions
auth.php
with
39 additions
and
36 deletions
README.md
+
1
−
0
View file @
78c533ae
...
@@ -10,6 +10,7 @@ This plugin requires Moodle 2.7+
...
@@ -10,6 +10,7 @@ This plugin requires Moodle 2.7+
Changes
Changes
=======
=======
2014-08-27 - Change line breaks to mtrace() (MDL-30589)
2014-08-25 - Support new event API, remove legacy event handling
2014-08-25 - Support new event API, remove legacy event handling
2014-07-31 - Add event handler for "user_created" event (see "Fetching user details from LDAP on manual user creation" below for details)
2014-07-31 - Add event handler for "user_created" event (see "Fetching user details from LDAP on manual user creation" below for details)
2014-06-30 - Check compatibility for Moodle 2.7, no functionality change
2014-06-30 - Check compatibility for Moodle 2.7, no functionality change
...
...
This diff is collapsed.
Click to expand it.
auth.php
+
38
−
36
View file @
78c533ae
...
@@ -57,7 +57,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
...
@@ -57,7 +57,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
function
sync_users
(
$do_updates
=
true
)
{
function
sync_users
(
$do_updates
=
true
)
{
global
$CFG
,
$DB
;
global
$CFG
,
$DB
;
prin
t_string
(
'connectingldap'
,
'auth_ldap'
)
;
echo
"
\n
"
;
mtrace
(
ge
t_string
(
'connectingldap'
,
'auth_ldap'
)
)
;
$ldapconnection
=
$this
->
ldap_connect
();
$ldapconnection
=
$this
->
ldap_connect
();
$dbman
=
$DB
->
get_manager
();
$dbman
=
$DB
->
get_manager
();
...
@@ -70,7 +70,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
...
@@ -70,7 +70,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
$table
->
add_key
(
'primary'
,
XMLDB_KEY_PRIMARY
,
array
(
'id'
));
$table
->
add_key
(
'primary'
,
XMLDB_KEY_PRIMARY
,
array
(
'id'
));
$table
->
add_index
(
'username'
,
XMLDB_INDEX_UNIQUE
,
array
(
'mnethostid'
,
'username'
));
$table
->
add_index
(
'username'
,
XMLDB_INDEX_UNIQUE
,
array
(
'mnethostid'
,
'username'
));
prin
t_string
(
'creatingtemptable'
,
'auth_ldap'
,
'tmp_extuser'
)
;
echo
"
\n
"
;
mtrace
(
ge
t_string
(
'creatingtemptable'
,
'auth_ldap'
,
'tmp_extuser'
)
)
;
$dbman
->
create_temp_table
(
$table
);
$dbman
->
create_temp_table
(
$table
);
////
////
...
@@ -133,10 +133,10 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
...
@@ -133,10 +133,10 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
/// so as to avoid mass deletion of users; which is hard to undo
/// so as to avoid mass deletion of users; which is hard to undo
$count
=
$DB
->
count_records_sql
(
'SELECT COUNT(username) AS count, 1 FROM {tmp_extuser}'
);
$count
=
$DB
->
count_records_sql
(
'SELECT COUNT(username) AS count, 1 FROM {tmp_extuser}'
);
if
(
$count
<
1
)
{
if
(
$count
<
1
)
{
prin
t_string
(
'didntgetusersfromldap'
,
'auth_ldap'
)
;
echo
"
\n
"
;
mtrace
(
ge
t_string
(
'didntgetusersfromldap'
,
'auth_ldap'
)
)
;
exit
;
exit
;
}
else
{
}
else
{
prin
t_string
(
'gotcountrecordsfromldap'
,
'auth_ldap'
,
$count
)
;
echo
"
\n
"
;
mtrace
(
ge
t_string
(
'gotcountrecordsfromldap'
,
'auth_ldap'
,
$count
)
)
;
}
}
...
@@ -157,16 +157,17 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
...
@@ -157,16 +157,17 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
$remove_users
=
$DB
->
get_records_sql
(
$sql
,
array
(
'auth'
=>
$this
->
authtype
));
$remove_users
=
$DB
->
get_records_sql
(
$sql
,
array
(
'auth'
=>
$this
->
authtype
));
if
(
!
empty
(
$remove_users
))
{
if
(
!
empty
(
$remove_users
))
{
print_string
(
'userentriestoremove'
,
'auth_ldap'
,
count
(
$remove_users
));
echo
"
\n
"
;
mtrace
(
get_string
(
'userentriestoremove'
,
'auth_ldap'
,
count
(
$remove_users
)));
foreach
(
$remove_users
as
$user
)
{
foreach
(
$remove_users
as
$user
)
{
if
(
delete_user
(
$user
))
{
if
(
delete_user
(
$user
))
{
echo
"
\t
"
;
prin
t_string
(
'auth_dbdeleteuser'
,
'auth_db'
,
array
(
'name'
=>
$user
->
username
,
'id'
=>
$user
->
id
))
;
echo
"
\n
"
;
mtrace
(
"
\t
"
.
ge
t_string
(
'auth_dbdeleteuser'
,
'auth_db'
,
array
(
'name'
=>
$user
->
username
,
'id'
=>
$user
->
id
))
)
;
}
else
{
}
else
{
echo
"
\t
"
;
prin
t_string
(
'auth_dbdeleteusererror'
,
'auth_db'
,
$user
->
username
)
;
echo
"
\n
"
;
mtrace
(
"
\t
"
.
ge
t_string
(
'auth_dbdeleteusererror'
,
'auth_db'
,
$user
->
username
)
)
;
}
}
}
}
}
else
{
}
else
{
prin
t_string
(
'nouserentriestoremove'
,
'auth_ldap'
)
;
echo
"
\n
"
;
mtrace
(
ge
t_string
(
'nouserentriestoremove'
,
'auth_ldap'
)
)
;
}
}
unset
(
$remove_users
);
// Free mem!
unset
(
$remove_users
);
// Free mem!
...
@@ -181,18 +182,18 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
...
@@ -181,18 +182,18 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
$remove_users
=
$DB
->
get_records_sql
(
$sql
,
array
(
'auth'
=>
$this
->
authtype
));
$remove_users
=
$DB
->
get_records_sql
(
$sql
,
array
(
'auth'
=>
$this
->
authtype
));
if
(
!
empty
(
$remove_users
))
{
if
(
!
empty
(
$remove_users
))
{
prin
t_string
(
'userentriestoremove'
,
'auth_ldap'
,
count
(
$remove_users
))
;
echo
"
\n
"
;
mtrace
(
ge
t_string
(
'userentriestoremove'
,
'auth_ldap'
,
count
(
$remove_users
))
)
;
foreach
(
$remove_users
as
$user
)
{
foreach
(
$remove_users
as
$user
)
{
$updateuser
=
new
stdClass
();
$updateuser
=
new
stdClass
();
$updateuser
->
id
=
$user
->
id
;
$updateuser
->
id
=
$user
->
id
;
$updateuser
->
suspended
=
1
;
$updateuser
->
suspended
=
1
;
user_update_user
(
$updateuser
,
false
);
user_update_user
(
$updateuser
,
false
);
echo
"
\t
"
;
prin
t_string
(
'auth_dbsuspenduser'
,
'auth_db'
,
array
(
'name'
=>
$user
->
username
,
'id'
=>
$user
->
id
))
;
echo
"
\n
"
;
mtrace
(
"
\t
"
.
ge
t_string
(
'auth_dbsuspenduser'
,
'auth_db'
,
array
(
'name'
=>
$user
->
username
,
'id'
=>
$user
->
id
))
)
;
\core\session\manager
::
kill_user_sessions
(
$user
->
id
);
\core\session\manager
::
kill_user_sessions
(
$user
->
id
);
}
}
}
else
{
}
else
{
prin
t_string
(
'nouserentriestoremove'
,
'auth_ldap'
)
;
echo
"
\n
"
;
mtrace
(
ge
t_string
(
'nouserentriestoremove'
,
'auth_ldap'
)
)
;
}
}
unset
(
$remove_users
);
// Free mem!
unset
(
$remove_users
);
// Free mem!
}
}
...
@@ -207,7 +208,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
...
@@ -207,7 +208,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
$revive_users
=
$DB
->
get_records_sql
(
$sql
,
array
(
$this
->
authtype
));
$revive_users
=
$DB
->
get_records_sql
(
$sql
,
array
(
$this
->
authtype
));
if
(
!
empty
(
$revive_users
))
{
if
(
!
empty
(
$revive_users
))
{
prin
t_string
(
'userentriestorevive'
,
'auth_ldap'
,
count
(
$revive_users
))
;
echo
"
\n
"
;
mtrace
(
ge
t_string
(
'userentriestorevive'
,
'auth_ldap'
,
count
(
$revive_users
))
)
;
foreach
(
$revive_users
as
$user
)
{
foreach
(
$revive_users
as
$user
)
{
$updateuser
=
new
stdClass
();
$updateuser
=
new
stdClass
();
...
@@ -215,10 +216,10 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
...
@@ -215,10 +216,10 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
$updateuser
->
auth
=
$this
->
authtype
;
$updateuser
->
auth
=
$this
->
authtype
;
$updateuser
->
suspended
=
0
;
$updateuser
->
suspended
=
0
;
user_update_user
(
$updateuser
,
false
);
user_update_user
(
$updateuser
,
false
);
echo
"
\t
"
;
prin
t_string
(
'auth_dbreviveduser'
,
'auth_db'
,
array
(
'name'
=>
$user
->
username
,
'id'
=>
$user
->
id
))
;
echo
"
\n
"
;
mtrace
(
"
\t
"
.
ge
t_string
(
'auth_dbreviveduser'
,
'auth_db'
,
array
(
'name'
=>
$user
->
username
,
'id'
=>
$user
->
id
))
)
;
}
}
}
else
{
}
else
{
prin
t_string
(
'nouserentriestorevive'
,
'auth_ldap'
)
;
echo
"
\n
"
;
mtrace
(
ge
t_string
(
'nouserentriestorevive'
,
'auth_ldap'
)
)
;
}
}
unset
(
$revive_users
);
unset
(
$revive_users
);
...
@@ -237,7 +238,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
...
@@ -237,7 +238,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
$revive_users
=
$DB
->
get_records_sql
(
$sql
,
array
(
$this
->
authtype
));
$revive_users
=
$DB
->
get_records_sql
(
$sql
,
array
(
$this
->
authtype
));
if
(
!
empty
(
$revive_users
))
{
if
(
!
empty
(
$revive_users
))
{
prin
t_string
(
'userentriestorevive'
,
'auth_ldap'
,
count
(
$revive_users
))
;
echo
"
\n
"
;
mtrace
(
ge
t_string
(
'userentriestorevive'
,
'auth_ldap'
,
count
(
$revive_users
))
)
;
foreach
(
$revive_users
as
$user
)
{
foreach
(
$revive_users
as
$user
)
{
$updateuser
=
new
stdClass
();
$updateuser
=
new
stdClass
();
...
@@ -245,10 +246,10 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
...
@@ -245,10 +246,10 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
$updateuser
->
auth
=
$this
->
authtype
;
$updateuser
->
auth
=
$this
->
authtype
;
$updateuser
->
suspended
=
0
;
$updateuser
->
suspended
=
0
;
user_update_user
(
$updateuser
,
false
);
user_update_user
(
$updateuser
,
false
);
echo
"
\t
"
;
prin
t_string
(
'auth_dbreviveduser'
,
'auth_db'
,
array
(
'name'
=>
$user
->
username
,
'id'
=>
$user
->
id
))
;
echo
"
\n
"
;
mtrace
(
"
\t
"
.
ge
t_string
(
'auth_dbreviveduser'
,
'auth_db'
,
array
(
'name'
=>
$user
->
username
,
'id'
=>
$user
->
id
))
)
;
}
}
}
else
{
}
else
{
prin
t_string
(
'nouserentriestorevive'
,
'auth_ldap'
)
;
echo
"
\n
"
;
mtrace
(
ge
t_string
(
'nouserentriestorevive'
,
'auth_ldap'
)
)
;
}
}
unset
(
$revive_users
);
unset
(
$revive_users
);
...
@@ -263,7 +264,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
...
@@ -263,7 +264,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
$remove_users
=
$DB
->
get_records_sql
(
$sql
,
array
(
'auth'
=>
$this
->
authtype
));
$remove_users
=
$DB
->
get_records_sql
(
$sql
,
array
(
'auth'
=>
$this
->
authtype
));
if
(
!
empty
(
$remove_users
))
{
if
(
!
empty
(
$remove_users
))
{
prin
t_string
(
'userentriestosuspend'
,
'auth_ldap_syncplus'
,
count
(
$remove_users
))
;
echo
"
\n
"
;
mtrace
(
ge
t_string
(
'userentriestosuspend'
,
'auth_ldap_syncplus'
,
count
(
$remove_users
))
)
;
foreach
(
$remove_users
as
$user
)
{
foreach
(
$remove_users
as
$user
)
{
$updateuser
=
new
stdClass
();
$updateuser
=
new
stdClass
();
...
@@ -271,11 +272,11 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
...
@@ -271,11 +272,11 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
$updateuser
->
suspended
=
1
;
$updateuser
->
suspended
=
1
;
$updateuser
->
timemodified
=
time
();
// Remember suspend time, abuse timemodified column for this
$updateuser
->
timemodified
=
time
();
// Remember suspend time, abuse timemodified column for this
user_update_user
(
$updateuser
,
false
);
user_update_user
(
$updateuser
,
false
);
echo
"
\t
"
;
prin
t_string
(
'auth_dbsuspenduser'
,
'auth_db'
,
array
(
'name'
=>
$user
->
username
,
'id'
=>
$user
->
id
))
;
echo
"
\n
"
;
mtrace
(
"
\t
"
.
ge
t_string
(
'auth_dbsuspenduser'
,
'auth_db'
,
array
(
'name'
=>
$user
->
username
,
'id'
=>
$user
->
id
))
)
;
\core\session\manager
::
kill_user_sessions
(
$user
->
id
);
\core\session\manager
::
kill_user_sessions
(
$user
->
id
);
}
}
}
else
{
}
else
{
prin
t_string
(
'nouserentriestosuspend'
,
'auth_ldap_syncplus'
)
;
echo
"
\n
"
;
mtrace
(
ge
t_string
(
'nouserentriestosuspend'
,
'auth_ldap_syncplus'
)
)
;
}
}
unset
(
$remove_users
);
// Free mem!
unset
(
$remove_users
);
// Free mem!
...
@@ -289,25 +290,25 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
...
@@ -289,25 +290,25 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
$remove_users
=
$DB
->
get_records_sql
(
$sql
,
array
(
'auth'
=>
$this
->
authtype
));
$remove_users
=
$DB
->
get_records_sql
(
$sql
,
array
(
'auth'
=>
$this
->
authtype
));
if
(
!
empty
(
$remove_users
))
{
if
(
!
empty
(
$remove_users
))
{
prin
t_string
(
'userentriestoremove'
,
'auth_ldap'
,
count
(
$remove_users
))
;
echo
"
\n
"
;
mtrace
(
ge
t_string
(
'userentriestoremove'
,
'auth_ldap'
,
count
(
$remove_users
))
)
;
foreach
(
$remove_users
as
$user
)
{
foreach
(
$remove_users
as
$user
)
{
// Do only if user was suspended before grace period
// Do only if user was suspended before grace period
$graceperiod
=
max
(
intval
(
$this
->
config
->
removeuser_graceperiod
),
0
);
// Fix problems if grace period setting was negative or no number
$graceperiod
=
max
(
intval
(
$this
->
config
->
removeuser_graceperiod
),
0
);
// Fix problems if grace period setting was negative or no number
if
(
time
()
-
$user
->
timemodified
>=
$graceperiod
*
24
*
3600
)
{
if
(
time
()
-
$user
->
timemodified
>=
$graceperiod
*
24
*
3600
)
{
if
(
delete_user
(
$user
))
{
if
(
delete_user
(
$user
))
{
echo
"
\t
"
;
prin
t_string
(
'auth_dbdeleteuser'
,
'auth_db'
,
array
(
'name'
=>
$user
->
username
,
'id'
=>
$user
->
id
))
;
echo
"
\n
"
;
mtrace
(
"
\t
"
.
ge
t_string
(
'auth_dbdeleteuser'
,
'auth_db'
,
array
(
'name'
=>
$user
->
username
,
'id'
=>
$user
->
id
))
)
;
}
else
{
}
else
{
echo
"
\t
"
;
prin
t_string
(
'auth_dbdeleteusererror'
,
'auth_db'
,
$user
->
username
)
;
echo
"
\n
"
;
mtrace
(
"
\t
"
.
ge
t_string
(
'auth_dbdeleteusererror'
,
'auth_db'
,
$user
->
username
)
)
;
}
}
}
}
// Otherwise inform about ongoing grace period
// Otherwise inform about ongoing grace period
else
{
else
{
echo
"
\t
"
;
prin
t_string
(
'waitinginremovalqueue'
,
'auth_ldap_syncplus'
,
array
(
'days'
=>
$graceperiod
,
'name'
=>
$user
->
username
,
'id'
=>
$user
->
id
))
;
echo
"
\n
"
;
mtrace
(
"
\t
"
.
ge
t_string
(
'waitinginremovalqueue'
,
'auth_ldap_syncplus'
,
array
(
'days'
=>
$graceperiod
,
'name'
=>
$user
->
username
,
'id'
=>
$user
->
id
))
)
;
}
}
}
}
}
else
{
}
else
{
prin
t_string
(
'nouserentriestoremove'
,
'auth_ldap'
)
;
echo
"
\n
"
;
mtrace
(
ge
t_string
(
'nouserentriestoremove'
,
'auth_ldap'
)
)
;
}
}
unset
(
$remove_users
);
// Free mem!
unset
(
$remove_users
);
// Free mem!
}
}
...
@@ -329,9 +330,8 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
...
@@ -329,9 +330,8 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
}
}
}
}
unset
(
$all_keys
);
unset
(
$key
);
unset
(
$all_keys
);
unset
(
$key
);
}
else
{
}
else
{
prin
t_string
(
'noupdatestobedone'
,
'auth_ldap'
)
;
echo
"
\n
"
;
mtrace
(
ge
t_string
(
'noupdatestobedone'
,
'auth_ldap'
)
)
;
}
}
if
(
$do_updates
and
!
empty
(
$updatekeys
))
{
// run updates only if relevant
if
(
$do_updates
and
!
empty
(
$updatekeys
))
{
// run updates only if relevant
$users
=
$DB
->
get_records_sql
(
'SELECT u.username, u.id
$users
=
$DB
->
get_records_sql
(
'SELECT u.username, u.id
...
@@ -339,7 +339,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
...
@@ -339,7 +339,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
WHERE u.deleted = 0 AND u.auth = ? AND u.mnethostid = ?'
,
WHERE u.deleted = 0 AND u.auth = ? AND u.mnethostid = ?'
,
array
(
$this
->
authtype
,
$CFG
->
mnet_localhost_id
));
array
(
$this
->
authtype
,
$CFG
->
mnet_localhost_id
));
if
(
!
empty
(
$users
))
{
if
(
!
empty
(
$users
))
{
prin
t_string
(
'userentriestoupdate'
,
'auth_ldap'
,
count
(
$users
))
;
echo
"
\n
"
;
mtrace
(
ge
t_string
(
'userentriestoupdate'
,
'auth_ldap'
,
count
(
$users
))
)
;
$sitecontext
=
context_system
::
instance
();
$sitecontext
=
context_system
::
instance
();
if
(
!
empty
(
$this
->
config
->
creators
)
and
!
empty
(
$this
->
config
->
memberattribute
)
if
(
!
empty
(
$this
->
config
->
creators
)
and
!
empty
(
$this
->
config
->
memberattribute
)
...
@@ -354,11 +354,13 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
...
@@ -354,11 +354,13 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
$maxxcount
=
100
;
$maxxcount
=
100
;
foreach
(
$users
as
$user
)
{
foreach
(
$users
as
$user
)
{
echo
"
\t
"
;
print_string
(
'auth_dbupdatinguser'
,
'auth_db'
,
array
(
'name'
=>
$user
->
username
,
'id'
=>
$user
->
id
));
if
(
!
$this
->
update_user_record
(
$user
->
username
,
$updatekeys
))
{
// user_updated event is fired hereby
if
(
!
$this
->
update_user_record
(
$user
->
username
,
$updatekeys
))
{
// user_updated event is fired hereby
echo
' - '
.
get_string
(
'skipped'
);
$skipped
=
' - '
.
get_string
(
'skipped'
);
}
else
{
$skipped
=
''
;
}
}
echo
"
\n
"
;
mtrace
(
"
\t
"
.
get_string
(
'auth_dbupdatinguser'
,
'auth_db'
,
array
(
'name'
=>
$user
->
username
,
'id'
=>
$user
->
id
))
.
$skipped
)
;
$xcount
++
;
$xcount
++
;
// Update course creators if needed
// Update course creators if needed
...
@@ -374,7 +376,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
...
@@ -374,7 +376,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
unset
(
$users
);
// free mem
unset
(
$users
);
// free mem
}
}
}
else
{
// end do updates
}
else
{
// end do updates
prin
t_string
(
'noupdatestobedone'
,
'auth_ldap'
)
;
echo
"
\n
"
;
mtrace
(
ge
t_string
(
'noupdatestobedone'
,
'auth_ldap'
)
)
;
}
}
/// User Additions
/// User Additions
...
@@ -389,7 +391,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
...
@@ -389,7 +391,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
$add_users
=
$DB
->
get_records_sql
(
$sql
);
$add_users
=
$DB
->
get_records_sql
(
$sql
);
if
(
!
empty
(
$add_users
))
{
if
(
!
empty
(
$add_users
))
{
prin
t_string
(
'userentriestoadd'
,
'auth_ldap'
,
count
(
$add_users
))
;
echo
"
\n
"
;
mtrace
(
ge
t_string
(
'userentriestoadd'
,
'auth_ldap'
,
count
(
$add_users
))
)
;
$sitecontext
=
context_system
::
instance
();
$sitecontext
=
context_system
::
instance
();
if
(
!
empty
(
$this
->
config
->
creators
)
and
!
empty
(
$this
->
config
->
memberattribute
)
if
(
!
empty
(
$this
->
config
->
creators
)
and
!
empty
(
$this
->
config
->
memberattribute
)
...
@@ -419,7 +421,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
...
@@ -419,7 +421,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
}
}
$id
=
user_create_user
(
$user
,
false
);
$id
=
user_create_user
(
$user
,
false
);
echo
"
\t
"
;
prin
t_string
(
'auth_dbinsertuser'
,
'auth_db'
,
array
(
'name'
=>
$user
->
username
,
'id'
=>
$id
))
;
echo
"
\n
"
;
mtrace
(
"
\t
"
.
ge
t_string
(
'auth_dbinsertuser'
,
'auth_db'
,
array
(
'name'
=>
$user
->
username
,
'id'
=>
$id
))
)
;
$euser
=
$DB
->
get_record
(
'user'
,
array
(
'id'
=>
$id
));
$euser
=
$DB
->
get_record
(
'user'
,
array
(
'id'
=>
$id
));
if
(
!
empty
(
$this
->
config
->
forcechangepassword
))
{
if
(
!
empty
(
$this
->
config
->
forcechangepassword
))
{
...
@@ -435,10 +437,10 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
...
@@ -435,10 +437,10 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
$transaction
->
allow_commit
();
$transaction
->
allow_commit
();
unset
(
$add_users
);
// free mem
unset
(
$add_users
);
// free mem
}
else
{
}
else
{
prin
t_string
(
'nouserstobeadded'
,
'auth_ldap'
)
;
echo
"
\n
"
;
mtrace
(
ge
t_string
(
'nouserstobeadded'
,
'auth_ldap'
)
)
;
}
}
}
else
{
}
else
{
prin
t_string
(
'nouserstobeadded'
,
'auth_ldap'
)
;
echo
"
\n
"
;
mtrace
(
ge
t_string
(
'nouserstobeadded'
,
'auth_ldap'
)
)
;
}
}
$dbman
->
drop_table
(
$table
);
$dbman
->
drop_table
(
$table
);
...
...
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