diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2017-07-17 23:08:15 +0200 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2017-07-17 23:08:15 +0200 |
commit | 317c91a22f736342c52ed643c94d510a100f7fdb (patch) | |
tree | 73c066f0124684b13473320d734e806b310c5043 /includes/controller | |
parent | a2b9edc6a301745a299c8c29cdbbbc795961c9f0 (diff) |
Reapplied "Merge pull request #319 from jwacalex/gh_317_unable_to_edit_hidden_room_in_admin"
Diffstat (limited to 'includes/controller')
-rw-r--r-- | includes/controller/rooms_controller.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/includes/controller/rooms_controller.php b/includes/controller/rooms_controller.php index 3f5ff387..3082a28d 100644 --- a/includes/controller/rooms_controller.php +++ b/includes/controller/rooms_controller.php @@ -19,7 +19,11 @@ function room_controller() redirect(page_link_to()); } - $room = load_room(); + $room = load_room(false); + if ($room['show'] != 'Y' && !in_array('admin_rooms', $privileges)) { + redirect(page_link_to()); + } + $all_shifts = Shifts_by_room($room); $days = []; foreach ($all_shifts as $shift) { @@ -99,15 +103,16 @@ function room_edit_link($room) /** * Loads room by request param room_id * + * @param bool $onlyVisible * @return array */ -function load_room() +function load_room($onlyVisible = true) { if (!test_request_int('room_id')) { redirect(page_link_to()); } - $room = Room($_REQUEST['room_id']); + $room = Room($_REQUEST['room_id'], $onlyVisible); if ($room == null) { redirect(page_link_to()); } |