Notification > ldap after upgrade 3.0 to 3.3

Notification > ldap after upgrade 3.0 to 3.3

by Gemma Lesterhuis -
Number of replies: 31
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hello, 

I am kind of hoping someone knows this issue and knows a solution. 


The case

We use to have a Moodle 3.0 enviroment with LDAP synch. When migrating to a different hosting party we changed from LDAP to SAML2. Sofar I know their where no issues during this process. 


Last summer we have upgraded the same enviroment from 3.0 to 3.3. And since that upgrade - when I click at Siteadministration > Notifications I get the screen below. 



The LDAP authentication is not set! We are still using SAML2. 
The data mapping is refering to custom profile fields we made. 

On a testserver we have tried to delete the custom profile fields, and still we get the notification. 

Does anyone has a suggestion and/or idea??? 


Thank you 

Gemma


Average of ratings: -
In reply to Gemma Lesterhuis

Re: Notification > ldap after upgrade 3.0 to 3.3

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

This is just because the plugin was upgraded during the Moodle upgrade.  It will not affect your active authentication - it is just a typical upgrade screen showing you that there are new settings if you want to use them.  Leave it blank, click continue and move on.

In reply to Emma Richardson

Re: Notification > ldap after upgrade 3.0 to 3.3

by Gemma Lesterhuis -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

That is something we are trying to do but somehow it does not want to continue. 

In reply to Gemma Lesterhuis

Re: Notification > ldap after upgrade 3.0 to 3.3

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Did you fix this - I just ran into the same issue..it was after I installed Event Reminders - could that have something to do with it?  

I finally just clicked out of the page and now have something even stranger - my ldap settings do not show as updated on the page but they are in the database.  Tried purging cache to no avail...

In reply to Emma Richardson

Re: Notification > ldap after upgrade 3.0 to 3.3

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I have discovered that this is related to custom profile fields (other settings on the page update correctly) and now they are no longer updating on the AD server which they were yesterday.  I have since uninstalled the Event Reminders plugin but still no joy.  Whatever you enter on the page does update the database but it is as though the ldap plugin is now longer able to read from the custom profile fields part of the config...very strange...

Inaki - any ideas?  I have three separate ldap plugins (cloned versions) - all exhibiting the same behavior..

In reply to Emma Richardson

Re: Notification > ldap after upgrade 3.0 to 3.3

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hi Emma,

I still don't know the root case for this (I'm still going through the code), but I've noticed that the profile fields names that appear in the new settings screen are all lower case (e.g., field_updatelocal_profile_field_state). On the other hand, the same setting in your database query is mixed case (i.e., field_updatelocal_profile_field_State.

If my understanding of the code flow is right, at some point we use array_key_exists() to check for the setting name, to see if it already exists as a configured setting. Given that array_key_exists() compares keys in a case-sensitive way, the upgrade code thinks you don't have the given setting already configured. And so it adds the setting to the new (unconfigured) settings list.

I still can't answer a couple of questions. First, why did it work before and now it doesn't? Second, why aren't the "new" settings stored correctly (i.e., lowercased) in the database once you click on "Save changes" on that screen?

I highly suspect (but can't confirm) that this issue is a bad interaction between the custom profile fields code (especially, allowing mixed-cased custom profiles shortnames) and the LDAP plugin (that expects all attribute mapping settings names to be lowercase. In fact, there have been several issues in the past (see e.g., MDL-49189 and MDL-57043, which is still open and afecting other places besides LDAP).

Emma, if you rename all your custom profile fields shortnames to lowercase (and change the settings names in the database accordingly), does the issue still persist?

Saludos.

Iñaki.

In reply to Iñaki Arenaza

Re: Notification > ldap after upgrade 3.0 to 3.3

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Good catch.  

That is the issue - however I had changed the profile field case prior to this and ldap is not recognizing the switch from upper case to lower. 

Thanks for finding the fix - going through the database now and correcting.  After I corrected the first one in the database, the field saved.  Once I have them all fixed, I will go ahead and check the updating on external server but I expect it to work fully.

In reply to Emma Richardson

Re: Notification > ldap after upgrade 3.0 to 3.3

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I just noticed one more thing - for me, this only occurred on my two clones (created with your patch) and not on the original, which I had not realized until I looked at the db entries individually.  Not sure with Gemma's though.

Just confirmed that external ldap server is now updating again after changing case in database.

In reply to Emma Richardson

Re: Notification > ldap after upgrade 3.0 to 3.3

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Humm, will try with an additional clone (see my other message about being unable to reproduce it).

Edit: nope, not even with the addional clone. ?!?!?!?!

Saludos.

Iñaki.

In reply to Emma Richardson

Re: Notification > ldap after upgrade 3.0 to 3.3

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Things get weirder. I've setup a clean install of Moodle 3.3.2+ (Build 20171021) and I can't reproduce the issue!!!

So either I'm doing something wrong, something else is needed to reproduce the issue (I'm following your steps to reproduce, from MDL-60581), or the issue only triggers in sites that were upgraded from versions prior to 3.3.

Given that I can't reproduce it locally, would you Emma or Gemma be willing to add a few debugging lines to your Moodle sites to help me debug this issue?

Saludos.

Iñaki.

In reply to Iñaki Arenaza

Re: Notification > ldap after upgrade 3.0 to 3.3

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

This is a live site but happy to help as long as it does not interfere with my users.  Gemma, did you change the shortname of the custom profile fields at some point - can you look in your database and see if the database entry matches the shortname exactly?  

Iñaki, I wonder if it only occurs after changing the shortname of the custom profile field?  In my case, I set it all up but it was not syncing so I then went in and changed the shortname of the profile field to all lowercase.  This got it working until the plugin install - is it possible that something in the database upgrade process reverted this to the original shortname of the profile field prior to the case change?

 

 

In reply to Emma Richardson

Re: Notification > ldap after upgrade 3.0 to 3.3

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Just upgraded a plugin to trigger the database update - no ldap settings page this time so whatever happened was fixed by adjusting the database entries.  I would put it down to a funky thing with my database if Gemma wasn't having the same issue.

In reply to Emma Richardson

Re: Notification > ldap after upgrade 3.0 to 3.3

by Gemma Lesterhuis -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Think we dit made changed not sure. 

Just weird it is an issue since the updates as well since we do not use ldap anymore. 

I can not Access the database myself. Except for pulling out data using configurable reports. Changes can only be to by the hosting party. 

I did find out we have a bunch of deleted users with ldap auth so i was thinking first to change that. In order to see if the notification stays.

I will check on the database about the lower/upper case. 

I have a test site with the same issue. So i could ask the hosting party to and the debugging rules. 

In reply to Gemma Lesterhuis

Re: Notification > ldap after upgrade 3.0 to 3.3

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I am not sure it is a case sensitive issue more than a change to the profile field shortname issue.  See if you can pull a configurable report on that table and see if the profile_field_"name" matches your actual profile field shortname exactly.  You will probably have to check with host to access database and fix, I suspect.

In reply to Emma Richardson

Re: Notification > ldap after upgrade 3.0 to 3.3

by Gemma Lesterhuis -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

it is case sensitive as in:

- On the siteadministration side the shortname is in lower capitals

- in the databse it is with upper capitals


If I change the shortname on siteadministation level in the same way it is in the database than I won't see the notification anymore. 

Though then the other authentication plug-ins start to send out a notification. 


Maybe that changed in 3.2 or 3.3? 

In reply to Gemma Lesterhuis

Re: Notification > ldap after upgrade 3.0 to 3.3

by Gemma Lesterhuis -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

okay it is indeed the naming of the custom profile fields in the database not being consistent with the naming in the plug-in. 


Since I cannot access the database and make changes. I looked in configurable reports how it is name in the Database. And the custom fields are in captials. When I changed the short names on siteadministration I did not have the notification. 


But... now CAS server (SSO), Extern Databank and Shibboleth give the same notification as I had before on Ldap 

So yes, it has to do with the capitals, and well.. I guess I have to ask to correct it in the Database. But I do think this is an overall issue. 


In reply to Gemma Lesterhuis

Re: Notification > ldap after upgrade 3.0 to 3.3

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Probably because they were all correctly pointing the lower case names and when you changed it, they now see them as new fields.  Can you update them correctly or are they having the same issue as ldap was before?

In reply to Emma Richardson

Re: Notification > ldap after upgrade 3.0 to 3.3

by Gemma Lesterhuis -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

same issue as with the LDAP. 

So I could not correct them. 

It seems that the table does not get updated when you make a change in the custom profile fields. It just stays with the first entered. 

And actually is strange because I am not even using any of those authentication methods. 

In reply to Iñaki Arenaza

Re: Notification > ldap after upgrade 3.0 to 3.3

by Gemma Lesterhuis -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Iñaki,


As with Emma, after changing the custom profile fields in the database to all lower capitals the notification disapeared. 


I am not sure on Emma but for me it was after the upgrade from 3.0 to 3.3. 
I had no issues with a clean install of 3.3.

So yes I do think it is only triggered in sites that were upgraded from versions prior to 3.3

And while thinking.. I had a upgrade from 3.1 to 3.3 with custom profile fields and did not had this issue. 

So maybe just prior 3.0?? 


Gemma



Average of ratings: Useful (1)
In reply to Gemma Lesterhuis

Re: Notification > ldap after upgrade 3.0 to 3.3

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hi Gemma & Emma,

I've tried to reproduce it by setting up a new 3.0 install, creating some custom profile fields and mapping them from LDAP settings. Then upgrading to 3.3 to trigger the update code. And finally installing and removing some plugins in the 3.3 install.

While I get the "new settings" screen on upgrade to 3.3, I don't get that screen any more, no matter what I try. So there must be a specific set of settings (and enviroment?) that makes the bug trigger. For what is worth, I'm using PHP 7.0.19 (from Debian Stretch), Apache 2.4.25 and Postgresql 9.6.4.

I you revert any of the changes you made in the database (say, for a single custom profile field), do you still trigger the bug?

Saludos.

Iñaki.

In reply to Iñaki Arenaza

Re: Notification > ldap after upgrade 3.0 to 3.3

by Gemma Lesterhuis -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Iñaki,


I am using PHP Version 7.0.15-0ubuntu0.16.04.4, Apache 20120211 and MySql Version 14.04 distro 5.5.57


I don't think the PHP or Apache versions would make a difference here, but the use of Postgresql and MySql could. 

If we revert the changes then we will still trigger the bug. 


Gemma

In reply to Gemma Lesterhuis

Re: Notification > ldap after upgrade 3.0 to 3.3

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

HI Emma,

thanks a lot for your feedback! I'll try the whole thing again, using MySQL this time.

Saludos.

Iñaki.

In reply to Iñaki Arenaza

Re: Notification > ldap after upgrade 3.0 to 3.3

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

In your testing did you start with Upper case letters in the profiles and then switch them to lower case?  I just went in and changed one of my custom profile fields to start with uppercase.  Went to notifications - was returned to the authentication settings loop again.

Changed custom profile field back to lowercase and immediately fixed (did not have to go into database this time).  I really am starting to think that this a text case issue.

In reply to Emma Richardson

Re: Notification > ldap after upgrade 3.0 to 3.3

by Gemma Lesterhuis -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Emma where are you correcting it in the database? 

As in which table.

In reply to Gemma Lesterhuis

Re: Notification > ldap after upgrade 3.0 to 3.3

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

mdl_config_plugins - search by auth_ldap or the profile field name.  

In reply to Emma Richardson

Re: Notification > ldap after upgrade 3.0 to 3.3

by Gemma Lesterhuis -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

No I have not fixed it yet. 

We also figured it had to do with custom profile fields. 

We have tried to delete them, that seemed to fix the issue on the test server. 
But the moment we place them back, it seems to bug out again. 


I don't have event reminders installed on the Moodle site. 
I am not sure if I had it in an earlier version but I don't think so. 


Guess I will have to make a tracker for this..



In reply to Gemma Lesterhuis

Re: Notification > ldap after upgrade 3.0 to 3.3

by Gemma Lesterhuis -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
In reply to Gemma Lesterhuis

Re: Notification > ldap after upgrade 3.0 to 3.3

by Michael Milette -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Gemma,

Thanks for the tracker link. It really helped. I've added some new information to the tracker issue and suggested a course of action to fix it. I suspect that this issue has existed since several years. I've come across posts dating back to 2015.

Based on my analysis, the issue only happens if you ever try to change the shortname of a profile field because the code, which enables you to change the profile field, doesn't reflect the change by updating the name field in the mdl_config_plugins table.

The easiest workaround is to rename the shortname back to its original value however this might affect some of your integration. Alternatively you can rename the values in the name fields of the mdl_config_plugins table to reflect the current shortnames.

Once you have it working again, don't rename any custom fields until this issue is resolved or be ready to apply the above mentioned workarounds.

in my case, it was triggered by upgrading to the 2018-05-31 release of Moodle 3.4.3 from a release just two weeks earlier. What did it was the fact that I renamed some custom fields in between. I was being prompted for 3 fields I had modified for each of the following authentication methods: CAS server (SSO), External database, LDAP server and Shibboleth.

Hope we can see a fix for this soon.

Michael

In reply to Gemma Lesterhuis

Re: Notification > ldap after upgrade 3.0 to 3.3

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Yes, I think I realized that it was not the plugin but the act of installing a plugin which pushed a database upgrade - the first since I had created the profile fields.  Frustrating because they were working prior to that!  I will vote for tracker.  I don't know if you can edit your tracker item but I would change heading to reflect the fact that Custom Profile Fields are not working in LDAP and I think this is probably more than a minor bug.

In reply to Emma Richardson

Re: Notification > ldap after upgrade 3.0 to 3.3

by Gemma Lesterhuis -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Changed the title smile hope it reflects the issue better. 

I think it is indeed more then a minor bug, I changed it to major. 
In the hope HQ will pick it up smile 

In reply to Gemma Lesterhuis

Re: Notification > ldap after upgrade 3.0 to 3.3

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I saw the changes - makes more sense.  Maybe we can get Iñaki to take a look?