microsoft / o365-moodle

Office 365 and Azure Active Directory plugins for Moodle
GNU General Public License v3.0
181 stars 136 forks source link

User Creation Restriction - Regular Expressions not working #2297

Open ginjaninja1 opened 1 year ago

ginjaninja1 commented 1 year ago

Moodle 4.1.1+ Build 20230126 plugin version 2021051711

I would like to only create/import users where "Job Title" NEQ "Volunteer" (?!Volunteer) negative lookahead does not work.

I have tried the positive Staff that imports Staff ok I have tried the positive OR Staff|Trustee That doesnt work...

Could anyone advise on what i might be missing theres something about the plugin's expectation for regular expression syntax which im not understanding despite working in regex101 I havent bothered to try and only match Not Volunteer AND Not Blank https://regex101.com/r/2Dkrtw/2

ginjaninja1 commented 1 year ago

So our MSP enabled the setting "Perform a full sync each run" and we stopped testing with previously synced/imported accounts then moodle deleted accounts, and started testing with freshly created azure accounts....the syncing now is working with (?!Volunteer)...going to try the more complex ((?!Volunteer).*)(^(?!\s*$).+)

ginjaninja1 commented 1 year ago

(?!Volunteer)(^(?!\s*$).+) seems to work....the "Perform a full sync each run" seemed to be a crucial setting in making the regex work..(messing around with existing accounts was not an issue in the end), hope it saves someone else some time.