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

allow case sensitive regex matches for the MAGPIE_USER_NAME_EXTRA_REGEX setting #594

Merged

Conversation

mishaschwartz
Copy link
Collaborator

@mishaschwartz mishaschwartz commented Oct 25, 2023

Ensures that the settings/environment variable MAGPIE_USER_NAME_EXTRA_REGEX is case sensitive.

Previously, the check was case insensitive meaning that it could not be used to restrict usernames based on case.
For example, setting this value to ^[a-z]+$ would have permit the username "someuser" as well as "Someuser".

Now, the same regular expression will not match "Someuser" since case sensitivity in enforced.

Copy link
Collaborator

@fmigneault fmigneault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

param_compare=re.compile(...) can be passed directly with any desired flags.
No need for the regex_flags parameter.

I like the idea of re.X being the default however, and not assume re.I by default.
All current regex used [A-Za-z] explicitly anyway, so they should still work with only re.X.

tests/test_magpie_api.py Outdated Show resolved Hide resolved
tests/interfaces.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@fmigneault fmigneault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just waiting on tests to complete validation.

@mishaschwartz
Copy link
Collaborator Author

@fmigneault The tests are failing because data.ceda.ac.uk is unresponsive right now: https://github.com/Ouranosinc/Magpie/actions/runs/6655721960/job/18098444930?pr=594

@fmigneault
Copy link
Collaborator

Validated that CEDA has planned down server until November 7.
Validated that tests and other checks than links run successfully.

@fmigneault fmigneault merged commit 5a96689 into Ouranosinc:master Oct 27, 2023
9 of 17 checks passed
@mishaschwartz mishaschwartz deleted the allow-case-sensitive-regex-matches branch October 27, 2023 17:05
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

Successfully merging this pull request may close these issues.

None yet

2 participants