diff --git a/CHANGELOG.md b/CHANGELOG.md index d60565a..39e3362 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/app/Models/TemporalRoleUser.php b/app/Models/TemporalRoleUser.php index 1b742a9..b1c890e 100644 --- a/app/Models/TemporalRoleUser.php +++ b/app/Models/TemporalRoleUser.php @@ -47,7 +47,7 @@ class TemporalRoleUser extends MorphPivot 'role_id', 'model_type', 'model_id', - 'team_id', + 'tenant_id', 'valid_from', 'valid_until', 'auto_revoke', diff --git a/app/Models/User.php b/app/Models/User.php index 42a9ea9..74337aa 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -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; @@ -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.'); });