Skip to content

enforce qualified user group#519

Merged
simonLeary42 merged 2 commits intomainfrom
disqualify
Jan 16, 2026
Merged

enforce qualified user group#519
simonLeary42 merged 2 commits intomainfrom
disqualify

Conversation

@simonLeary42
Copy link
Member

@simonLeary42 simonLeary42 commented Jan 12, 2026

Any user who is not a PI or is not a member of at least one PI group should be disqualified and denied access to services.

  • Added hooks to update a user's qualified status in all situations where it may change
  • Added worker script to check all PI groups and update the qualified status of all users simultaneously

Added tests:

  • user leaves group voluntarily in groups.php
  • user becomes a PI
  • user is removed from group by PI in pi.php
  • user is removed from group by admin in pi-mgmt.php
  • user is added/removed to/from group by admin by manually editing LDAP entries
    • qualified status updated when new worker script runs
    • qualified status updated the next time the user logs in

#520 allows PI groups to be disbanded and reinstated, and includes more tests that users are qualified and disqualified accordingly, but those tests are currently commented out because they rely on functionality implemented in this PR.

@simonLeary42 simonLeary42 force-pushed the disqualify branch 4 times, most recently from 8d22861 to 3e18688 Compare January 12, 2026 20:36
@simonLeary42 simonLeary42 changed the title disqualify users enforce qualified user group Jan 12, 2026
@simonLeary42 simonLeary42 force-pushed the disqualify branch 3 times, most recently from d97cf44 to 7031c55 Compare January 13, 2026 13:12
@simonLeary42 simonLeary42 mentioned this pull request Jan 13, 2026
23 tasks
@simonLeary42 simonLeary42 force-pushed the disqualify branch 3 times, most recently from 62516b9 to bd341de Compare January 14, 2026 15:08
@simonLeary42 simonLeary42 requested a review from Copilot January 14, 2026 15:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request implements automated enforcement of the "qualified user" status based on PI group membership. The PR ensures that users are automatically qualified when they join a PI group and disqualified when they leave all PI groups.

Changes:

  • Added a worker script to sync the qualified users group with PI group memberships
  • Updated user qualification logic to automatically check group membership when users join/leave groups
  • Improved email templates and documentation terminology to use "disqualified" consistently

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
workers/update-qualified-users-group.php New worker script to synchronize qualified user group membership based on PI group memberships
test/functional/WorkerUpdateQualifiedUsersGroupTest.php Tests for the new worker script verifying qualification and disqualification logic
test/functional/PiRemoveUserTest.php Extended tests to verify qualified status changes when users are removed from PI groups by both PIs and admins
test/functional/PIBecomeApproveTest.php Added assertion to verify users are disqualified when their PI group is deleted
test/functional/LeaveGroupTest.php New tests verifying users are disqualified when leaving groups and on login after manual LDAP changes
test/Template.php Template file for data provider pattern tests
resources/lib/UnityUser.php Added updateIsQualified() method to centralize qualification status updates
resources/lib/UnityGroup.php Updated group approval/removal methods to use new updateIsQualified() method
resources/lib/PosixGroup.php Added overwriteMemberUIDs() method for bulk member updates
resources/init.php Added automatic qualification check on user login to handle manual LDAP changes
resources/mail/*.php Updated email templates to use "disqualified" terminology consistently
test/phpunit-bootstrap.php Updated ensurePIGroupDoesNotExist() to properly disqualify removed members
tools/docker-dev/identity/bootstrap.ldif Removed ghost users and other non-qualified users from the qualified users group
phpstan.neon Added exclusions for Template.php and new test methods using dynamic invocation
LDAP.md Clarified terminology definitions for qualified/unqualified and native/non-native users

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@simonLeary42 simonLeary42 force-pushed the disqualify branch 4 times, most recently from fe14506 to 6aacf0e Compare January 14, 2026 18:13
@simonLeary42 simonLeary42 marked this pull request as ready for review January 14, 2026 18:23
Copy link
Contributor

Choose a reason for hiding this comment

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

Why remove seemingly random accounts from this list?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, are these supposed to be the "unqualified" or whatever other status?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, those accounts were removed by the update-qualified-users-group.php worker

@simonLeary42 simonLeary42 force-pushed the disqualify branch 2 times, most recently from 03cc64e to ef4065e Compare January 15, 2026 16:09
@simonLeary42 simonLeary42 merged commit 5c77755 into main Jan 16, 2026
3 checks passed
@simonLeary42 simonLeary42 deleted the disqualify branch January 16, 2026 15:08
@simonLeary42
Copy link
Member Author

#348

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.

2 participants