Open jberanek opened 4 years ago
You'll need to modify the function getWritable() in mtbs_auth.inc and change the section at the end from
// Always allowed to modify your own stuff
$user = getUserName();
if (strcasecmp($creator, $user) === 0)
{
return true;
}
// Otherwise you have to be a (booking) admin for this room
if (is_book_admin($rooms))
{
return true;
}
// Unauthorised access
return false;
to something like
$area_id = get_area($rooms);
if ($area_id == 1) // AREA A - change as appropriate
{
// Only admins can book rooms in Area A
return is_book_admin($rooms);
}
// Other areas (ie AREA B)
if (is_book_admin($rooms))
{
// Admins can book
return true;
}
$user = getUserName();
// Can't modify someone else's booking
if (strcasecmp($creator, $user) !== 0)
{
return false;
}
global $area_b_users;
// Otherwise you have to be one of the permitted users for the room
return in_array($user, $area_b_users[$rooms]);
and in your config file add
$area_b_users = array(
'2' => array('user1', 'user2', 'user3'),
'3' => array('user5'),
'6' => array('user8', 'user9')
);
This is obviously an example, where user1, user2 and user3 are allowed to book the room with id 2, etc.
Note that I haven't tested this.
Original comment by: campbell-m
Thank you so much. I am trying it. Have a nice day.
Original comment by: tranphat0690
Hi,
Thank you for the help.
Original comment by: tranphat0690
Hi,
Now I want a user to be able to book rooms of all areas. How do it. Please help me
Original comment by: tranphat0690
Add the lines
// 'specialuser' is allowed to modify their own stuff
$user = getUserName();
if ((utf8_strtolower($user) == 'specialuser') && (strcasecmp($creator, $user) === 0))
{
return true;
}
to the beginning of the function. 'specialuser' is the user that you want to be able to book a room in all areas.
Original comment by: campbell-m
Hello, I am using the latest version downloaded from the default branch. I want the configuration to consist of 2 areas: area A and area B. Area A includes rooms a1, a2, and a3. area B has rooms b1, b2, b3. I want to be in area A only an administrator can make a reservation. in area B I want rooms that are only accounts assigned to allow rooms. for example: room b1 only user b1 can book a room, room b2 only user b2 can book rooms, in addition the administrator can reserve the room. How do I do. please help memememememememememememememememememememememememememememememememe
Reported by: tranphat0690
Original Ticket: mrbs/support-requests/1957