-
Notifications
You must be signed in to change notification settings - Fork 11
optimize IDNumber selection, avoid conflicts, remove site vars, rewrite custom mapping, add tests #286
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
Conversation
634686d to
2d2072c
Compare
There was a problem hiding this 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 PR refactors the UID/GID allocation system to eliminate conflicts by checking IDs across the entire LDAP tree instead of specific OUs, and removes the SQL-based site variables system in favor of configuration-based offset values.
- Replaces SQL
sitevarstable with configuration-based offset values for different ID ranges - Optimizes LDAP queries to check for ID conflicts tree-wide instead of per-OU
- Removes iterative ID checking in favor of single LDAP query with array operations
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tools/docker-dev/sql/bootstrap.sql | Removes sitevars table creation and related indexes |
| resources/lib/UnitySQL.php | Removes getSiteVar and updateSiteVar methods and table constant |
| resources/lib/UnityLDAP.php | Refactors ID allocation with tree-wide conflict checking and configuration offsets |
| resources/lib/UnityGroup.php | Updates PI group creation to use new LDAP method signature |
| resources/init.php | Adds new offset parameters to UnityLDAP constructor |
| defaults/config.ini.default | Adds offset configuration values for different ID ranges |
| README.md | Documents migration steps from version 1.2 to 1.3 |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
9ed28b1 to
afcd23f
Compare
afcd23f to
bba872f
Compare
ccadb28 to
7d7653c
Compare
|
closes #121 |
45e5098 to
2096454
Compare
bryank-cs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of optional changes, otherwise looks ok.
01c80f8 to
d2d38fc
Compare
…te custom mapping, add tests
71130e7 to
52914cd
Compare
IDNumInUseis extremely wasteful: it queries LDAP for the entireusers,pi_groups, andgroupssubtrees (all attributes) every single iteration while it increments IDNumbers until it finds a free onegetNext{PIGID,ORGGID,UIDGID}Numberquery LDAP one time for just theuidNumberandgidNumberattributes, and use that data for all iterationsIDNumInUsecreated the need for the site vars, they are no longer neededIDNumInUsedid not consider custom mapped IDs or IDNumbers outside theusers,pi_groups, andgroupssubtrees, this is fixedgetNext{PIGID,ORGGID,UIDGID}Numberto avoid giving out custom mapped IDs, the CSV parsing logic fromgetUnassignedIDhas been moved to its own functiongetCustomIDMappingsgetUnassignedIDhas been removed and re-implemented ingetNextUIDGIDNumber$netid = strtok($uid, "_")getNextUIDNumberis nowgetNextUIDGIDNumbergetNextPiGIDNumber->getNextPIGIDNumber(consistent capitalization)ldap.custom_user_mappings_dir, set$_SERVER["HTTP_HOST"]to"phpunit"during unit tests, created a config override calledphpunit, created a user mapping directorytest/custom_user_mapping/, and changedldap.custom_user_mappings_dirtotest/custom_user_mappingin thephpunitconfig override.supercedes #248, #253