Add roleIdColumn config for UUID-based role systems#163
Merged
dereuromark merged 3 commits intomasterfrom Mar 18, 2026
Merged
Conversation
When using UUIDs as role identifiers instead of integer IDs, the
hardcoded 'id' column in _getRolesFromDb() prevented proper role
lookups from the database.
This adds a new 'roleIdColumn' config option (defaults to 'id') that
allows specifying the column used as the role identifier when reading
roles from the database table.
Example for UUID-based systems:
```php
'TinyAuth' => [
'roleColumn' => 'Role.uuid',
'roleIdColumn' => 'uuid',
'aliasColumn' => 'slug',
]
```
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #163 +/- ##
============================================
+ Coverage 67.66% 67.68% +0.02%
- Complexity 620 621 +1
============================================
Files 29 29
Lines 1599 1600 +1
============================================
+ Hits 1082 1083 +1
Misses 517 517 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When using UUIDs as role identifiers instead of integer IDs, the hardcoded
'id'column in_getRolesFromDb()prevented proper role lookups from the database.This adds a new
roleIdColumnconfig option (defaults to'id') that allows specifying the column used as the role identifier when reading roles from the database table.Example
For UUID-based systems:
Changes
roleIdColumnconfig option toConfig.php(defaults to'id')AclTrait::_getRolesFromDb()to use the configurable columnarray<int|string>to support UUIDsAuthorization.md