Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- **RBAC Phase 1 Post-Merge Fixes** - Addressed Copilot review comments from PR #112
- `TemporalRoleUser`: Changed `$fillable` array from `'team_id'` to `'tenant_id'` (matches Spatie Permission config)
- `User::roles()`: Added type hint `Builder $query` to where callback for improved type safety and IDE support

### Added

- **RBAC Phase 1: Temporal Role Foundation** - Time-based role assignments with automatic expiration
Expand Down
2 changes: 1 addition & 1 deletion app/Models/TemporalRoleUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class TemporalRoleUser extends MorphPivot
'role_id',
'model_type',
'model_id',
'team_id',
'tenant_id',
'valid_from',
'valid_until',
'auto_revoke',
Expand Down
3 changes: 2 additions & 1 deletion app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace App\Models;

// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Illuminate\Foundation\Auth\User as Authenticatable;
Expand Down Expand Up @@ -89,7 +90,7 @@ public function roles(): MorphToMany
'created_at',
'updated_at',
])
->where(function ($query) {
->where(function (Builder $query) {
// Only return currently active roles using shared filtering logic
TemporalRoleUser::applyActiveFilter($query, 'model_has_roles.');
});
Expand Down