Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rules not applied to new users created with LDAP sync scheduled task #29

Open
zozo1977 opened this issue Mar 17, 2020 · 2 comments
Open

Comments

@zozo1977
Copy link

I Have Moodle with standard LDAP authentication, without any LDAP plugin customization. When user login to the system for the first time, the rule is applied in he becomes the member of the cohort. Then I deleted the user, ran the auth_ldap\task\sync_task that authomatically creates users from LDAP. The same user with the same data is created again but this time the user is not added to the cohort. If I update any data in user profile in LDAP and then run the auth_ldap\task\sync_task again, then he is added to the cohort as it should be. So the issue is only with creating new users with auth_ldap\task\sync_task. Scheduled task \local_profilecohort\task\update_cohorts doesn't fix the issue because it updates cohort membership only if the rule has changed or created.
I checked the logs an there is a record of creating the user so it appears that the user creating event is triggered.

I tested and reproduced this issue on two Moodle installation with different LDAPs: one is Moodle 3.7.2+ (Build: 20191012) connected to MS Active Directory and the other is Moodle 3.6.3+ (Build: 20190322). I installed latest version of the plugin on both systems.

Simple suggestion of the workaround would be to add another scheduled task that updates all membership to all users regardles of changes done to user profile data. We could run that task every night to catch those users not covered with create user event.

@stdoma
Copy link

stdoma commented Apr 13, 2023

I have a similar problem.
During the night I have the accounts updated from LDAP (pure update; no creation).
After that, I want to re-form the global groups.
Since the rules in the plugin have not changed, the task is not executed.

I removed the task's execution check so that it always runs.
In my case, this is not particularly dramatic since the task only runs once a night.
Depending on the frequency of the normal task, an extended task might be appropriate. Alternatively, an "always run" setting would be good.

@j-r-git
Copy link

j-r-git commented Aug 5, 2023

Hi,

while #48 would provide a workaround for this problem, this might still be a bug of the plugin:

When the value of a profile field is being changed without a user login, e. g. by a LDAP sync, the value of "updatecohorts" will not change to true. And hence the cohort membership will not be updated by the task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants