feat: inversion relation User→Projects, les projets pointent vers les utilisateurs
All checks were successful
Deploy Preprod / Build and Deploy to Preprod (push) Successful in 31s
All checks were successful
Deploy Preprod / Build and Deploy to Preprod (push) Successful in 31s
Le champ `users` est désormais sur le blueprint projet. Les blueprints pochet/client perdent leur champ `projects`. La logique PHP (user-projects, managers, controller, template, mark-all-read) lit project.users au lieu de user.projects. Script de migration inclus. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
075e511a6a
commit
ea90f512cf
10 changed files with 101 additions and 25 deletions
|
|
@ -222,12 +222,12 @@ class ProjectPage extends NotificationsPage {
|
|||
// }
|
||||
|
||||
public function managers() {
|
||||
return kirby()->users()->filter(function($user) {
|
||||
if ($user->role() != 'admin' && $user->projects()->isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $user->role() == 'admin' || $user->projects()->toPages()->has($this);
|
||||
if ($this->users()->isEmpty()) {
|
||||
return kirby()->users()->filterBy('role', 'admin');
|
||||
}
|
||||
$projectUsers = $this->users()->toUsers();
|
||||
return kirby()->users()->filter(function($user) use ($projectUsers) {
|
||||
return $user->role() == 'admin' || $projectUsers->has($user);
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue