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

New refreshusers.py helper to assure htaccess is current #181

Open
wants to merge 4 commits into
base: edge
Choose a base branch
from

Conversation

jonasbardino
Copy link
Contributor

@jonasbardino jonasbardino commented Jan 24, 2025

New refreshusers.py helper to assure that one or more user accounts with external auth provider login are in fact able to open their files in the Files web page without just hitting an Apache auth error. In practice the helper script looks up user accounts and checks that the corresponding .htaccess file for each account is in sync with the user database contents for that user. In particular that the short_id field commonly doubling as Apache REMOTE_USER is in fact included as a valid require user "XYZ" clause in the .htaccess file of the user.
Matching users where that is not already the case will get all their automatic account files including .htaccess refreshed.
Site operators can supply expire range and ID pattern filters like for certain other scripts to target specific users only.

The code is fully functional and tested in practice, so it can be merged, but it would be nice to we now include unit tests to help verify general correctness.

external auth provider login are in fact able to open their files in the Files
web page without just hitting an Apache auth error.
In practice the helper script looks up user accounts and checks that the
corresponding .htaccess file for each account is in sync with the user database
contents for that user. In particular that the short_id field commonly doubling
as Apache REMOTE_USER is in fact included as a valid 'require user XYZ' clause
in the .htaccess file of the user.
Matching users where that is not already the case will get all their automatic
account files including .htaccess refreshed.
Site operators can supply expire range and ID pattern filters like for certain
other scripts to target specific users only.
@jonasbardino jonasbardino added enhancement New feature or request follow-up pending Pending tasks to follow-up on after close labels Jan 24, 2025
@jonasbardino jonasbardino added this to the OpenID Connect Support milestone Jan 24, 2025
@jonasbardino jonasbardino requested a review from a team January 24, 2025 14:40
@jonasbardino jonasbardino self-assigned this Jan 24, 2025
…taccess

function for common runs.
Explicitly only run unit tests for py2 when on main/edge as the embedded
refresh call with create_user relies on a py2-only str.encode('string_escape')
construct that will fail on py3. Can probably be enabled on next/experimental.
@jonasbardino jonasbardino added unit test and removed follow-up pending Pending tasks to follow-up on after close labels Jan 24, 2025
… will

cause problems in the require user line.
Fix detection of neither extoid nor extoidc auth.
self.assertHtaccessRequireUserClause(DUMMY_HTACCESS_PATH,
DUMMY_REQUIRE_USER)

@unittest.skipUnless(PY2, "Python 2 only")

Choose a reason for hiding this comment

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

I don't think it's a good idea to add new tests that target Python 2 given we're trying quite hard to get rid of it - more important is that these tests work on Python 3. What is preventing them working on that or, preferably, both?

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

Successfully merging this pull request may close these issues.

2 participants