Room Admin can't edit room bookings
Brought to you by:
jberanek
I've set $mail_settings['room_admin_on_bookings'] = true; on the config file
Room admins are receiving booking notification emails but they're not able to edit bookings others have made in their room.
We previously had some cutsom code in mrbs_auth.inc to allow room admins to edit all bookings for their rooms. I've tried copying it accross to the version we're now using (reports as 1.9.2 but was latest dev version from a couple of weeks ago).
How do I allow Room admins to edit all bookings for their room?
Yes, the room_admins are badly named. They just receive notification emails. If you want them to have admin rights for their room then you need to edit the function is_book_admin() in mrbs_auth.inc and change line 436 from
return (isset($mrbs_user) && ($mrbs_user->level >= 2));
to
I haven't tested this though.
Thanks Campbell. That fixed it.
Is that code likely to work with later versions? i.e Should I keep it to paste in after the next upgrade of MRBS?
Cheers,
Greg.
Yes, you'll need to hang on to that code and apply it to later versions. In due course you won't need it though as we'll be rolling out the ability to create "roles" and "groups" and assign roles to groups and users. So you'll be able to give users and groups admin abilities for a room or an area.
I tested it but it seems is ot working. I see for reservation created under room admin pending status and room admin has no action like system admin.
Adding picture
Leos
Which release of MRBS are you running?
MRBS 1.9.4
Leos
Have they otherwise got admin rights for the room? In other words can they delete another person's booking for that room?
Yes, they are defined as the admin of the room in room setup. I did test to create with admin1 of room1 booking in room2, but admin2 of room2 has no pending approval and he can not delete test booking in room2 created by admin1. We are local auth. via email address
Modified file attached
Have the email addresses of your room_admins got upper case characters in them?
Yes, I used some upper case in email address fro better reading. Do you recomend use only lower cases?
No, upper case is fine. But it explains why it's not working: there's a bug in the code above. To fix it replace
return (in_array(utf8_strtolower($mrbs_user->email), $room_admins));
by
return (in_arrayi($mrbs_user->email, $room_admins));
I set lower case to emails and log with lowercase email but no change . admin1 of room1 which was used to book room1 and room2 see pending approval but has no action for room1. admin2 do not see any pending approval
Here's a version mrbs_auth.inc with some debugging in which will send its output to the browser. Can you let me know what it says when the room admin should be able to have admin powers? You may want to PM me to avoid broadcasting confidential email addresses.
Last edit: Campbell Morrison 2021-11-23
Hi,
replacement which is mentioned above fixed it. Thank you. It seems that I overlooked it because I wrote my last message in identical time like your advice. It works now with upper cases perfectly.
Thank you again
Leos