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>
22 lines
684 B
PHP
22 lines
684 B
PHP
<?php
|
|
|
|
Kirby::plugin('adrienpayet/pdc-authorized-projects', [
|
|
'userMethods' => [
|
|
'currentProjects' => function() {
|
|
if ($this->role() == 'admin') {
|
|
return page('projects')->children()->listed();
|
|
}
|
|
return page('projects')->children()->listed()->filter(function($project) {
|
|
return $project->users()->toUsers()->has($this);
|
|
});
|
|
},
|
|
'archivedProjects' => function() {
|
|
if ($this->role() == 'admin') {
|
|
return page('projects')->children()->unlisted();
|
|
}
|
|
return page('projects')->children()->unlisted()->filter(function($project) {
|
|
return $project->users()->toUsers()->has($this);
|
|
});
|
|
},
|
|
]
|
|
]);
|