Skip to content

Add roleIdColumn config for UUID-based role systems#163

Merged
dereuromark merged 3 commits intomasterfrom
feature/role-id-column-config
Mar 18, 2026
Merged

Add roleIdColumn config for UUID-based role systems#163
dereuromark merged 3 commits intomasterfrom
feature/role-id-column-config

Conversation

@dereuromark
Copy link
Copy Markdown
Owner

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 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:

'TinyAuth' => [
    'roleColumn' => 'Role.uuid',
    'roleIdColumn' => 'uuid',
    'aliasColumn' => 'slug',
]

Changes

  • Added roleIdColumn config option to Config.php (defaults to 'id')
  • Updated AclTrait::_getRolesFromDb() to use the configurable column
  • Updated docblock return type to array<int|string> to support UUIDs
  • Added documentation in Authorization.md

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-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 18, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.68%. Comparing base (edc7ad9) to head (31d4e5b).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dereuromark dereuromark merged commit 2cf447c into master Mar 18, 2026
16 checks passed
@dereuromark dereuromark deleted the feature/role-id-column-config branch March 18, 2026 02:52
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