first fix for #317. hidden rooms can be seen with admin_rooms priviledge
This commit is contained in:
parent
7bbfe69583
commit
b6d394e982
|
@ -17,7 +17,13 @@ function room_controller() {
|
|||
redirect(page_link_to());
|
||||
}
|
||||
|
||||
|
||||
$room = load_room();
|
||||
|
||||
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) {
|
||||
|
|
|
@ -46,7 +46,7 @@ function Room_create($name, $from_frab, $public) {
|
|||
* @param $room_id RID
|
||||
*/
|
||||
function Room($room_id) {
|
||||
$room_source = sql_select("SELECT * FROM `Room` WHERE `RID`='" . sql_escape($room_id) . "' AND `show` = 'Y'");
|
||||
$room_source = sql_select("SELECT * FROM `Room` WHERE `RID`='" . sql_escape($room_id) . "'");
|
||||
|
||||
if ($room_source === false) {
|
||||
return false;
|
||||
|
|
|
@ -155,7 +155,9 @@ function make_room_navigation($menu) {
|
|||
return $menu;
|
||||
}
|
||||
|
||||
$rooms = Rooms();
|
||||
//get a list of all rooms
|
||||
$rooms = Rooms(true);
|
||||
|
||||
$room_menu = [];
|
||||
if (in_array('admin_rooms', $privileges)) {
|
||||
$room_menu[] = toolbar_item_link(page_link_to('admin_rooms'), 'list', _("Manage rooms"));
|
||||
|
@ -164,8 +166,12 @@ function make_room_navigation($menu) {
|
|||
$room_menu[] = toolbar_item_divider();
|
||||
}
|
||||
foreach ($rooms as $room) {
|
||||
if($room['show'] == 'Y' || // room is public
|
||||
($room['show'] != 'Y' && in_array('admin_rooms', $privileges)) // room is not public, but user can admin_rooms
|
||||
) {
|
||||
$room_menu[] = toolbar_item_link(room_link($room), 'map-marker', $room['Name']);
|
||||
}
|
||||
}
|
||||
if (count($room_menu > 0)) {
|
||||
$menu[] = toolbar_dropdown('map-marker', _("Rooms"), $room_menu);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue