fix: show the whole timeline to staff who are also house managers
This commit is contained in:
1 parent
8f4c4d8267
commit
74080b0488
5 files changed
+134
-6
No files matched your search
@@ -33,8 +33,12 @@ class TimelineController extends AbstractController
|
||||
|
||||
$filterDto = $this->filterHandler->getFilterSettings();
|
||||
|
||||
// Only a house manager without a staff role is kept to their own houses. BusPro also lists
|
||||
// admins and managers as house managers; they see everything like any staff member.
|
||||
$houseManagerOnly = $this->isGranted('ROLE_HOUSE_MANAGER') && false === $this->isGranted('ROLE_ADMINISTRATIVE');
|
||||
|
||||
$hotelCodes = null;
|
||||
if ($this->isGranted('ROLE_HOUSE_MANAGER')) {
|
||||
if ($houseManagerOnly) {
|
||||
$filterDto->setHotels([]);
|
||||
$hotelCodes = $user->getHotelCodes();
|
||||
}
|
||||
@@ -50,6 +54,7 @@ class TimelineController extends AbstractController
|
||||
'houses' => $this->timelineService->preprocess($assignments, $period),
|
||||
'calendar' => $this->timelineService->getCalendar($period),
|
||||
'filterDto' => $filterDto,
|
||||
'houseManagerOnly' => $houseManagerOnly,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,8 @@ class TimelineFilterController extends AbstractController
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$formData = $this->filterHandler->getFilterSettings();
|
||||
if ($this->isGranted('ROLE_HOUSE_MANAGER')) {
|
||||
// a house manager without a staff role sees only their own houses, see TimelineController
|
||||
if ($this->isGranted('ROLE_HOUSE_MANAGER') && false === $this->isGranted('ROLE_ADMINISTRATIVE')) {
|
||||
$formData->setHotels([]);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,8 @@ class TimelineFilterType extends AbstractType
|
||||
])
|
||||
;
|
||||
|
||||
if (false === $this->security->isGranted('ROLE_HOUSE_MANAGER')) {
|
||||
// the house filter is for staff; a house manager without a staff role sees only their own houses
|
||||
if ($this->security->isGranted('ROLE_ADMINISTRATIVE') || false === $this->security->isGranted('ROLE_HOUSE_MANAGER')) {
|
||||
$builder
|
||||
->add('hotels', MultiselectType::class, [
|
||||
'label' => 'Haus/Destination',
|
||||
|
||||
Reference in new issue
Block a user