(1) Run two separate installations of MRBS, with the protected rooms in one installation and the rest in the other. For the protected installation set $auth['only_admin_can_book'].
(2) Use the ACL branch
(3) Modify getWritable() in mrbs_auth.inc
Campbell
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I change this code ? how I set a restriction on a room created ? for my press room for example ?
/* getWritable($creator, $user, $room) * * Determines if a user is able to modify an entry * * $creator - The creator of the entry * $user - Who wants to modify it * $room - The id of the room that the entry is in * * Returns: * 0 - The user does not have the required access * non-zero - The user has the required access */function getWritable($creator, $user, $room){ // Always allowed to modify your own stuff if(strcasecmp($creator, $user) == 0) { return 1; } // Otherwise you have to be a (booking) admin for this room if (auth_book_admin($user, $room)) { return 1; } // Unathorised access return 0;}
Last edit: Campbell Morrison 2019-06-05
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Insert the following code at the beginning of the function, replacing 42 by the id of your room (you can find the id by going to that room in the week view and there should be the id in the query string in the URL):
function getWritable($creator, $room){ $user = getUserName();// if ((3 == get_area($room)) && !auth_book_admin($user, $room)) { return 0; } // Always allowed to modify your own stuff if(strcasecmp($creator, $user) === 0) { return true; } // Otherwise you have to be a (booking) admin for this room if (is_book_admin($room)) { return true; } // Unathorised access return false;}
but when select area number 3 system shows "Whoops! Unfortunately MRBS has encountered a fatal error. Please consult your system administrator"
Last edit: Campbell Morrison 2019-06-06
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you are using MRBS 1.7.3 then the code should be
function getWritable($creator, $room){ $user = getUserName(); if ((3 == get_area($room)) && !auth_book_admin($user, $room)) { return false; } // Always allowed to modify your own stuff if(strcasecmp($creator, $user) === 0) { return true; } // Otherwise you have to be a (booking) admin for this room if (auth_book_admin($user, $room)) { return true; } // Unathorised access return false;}
(The is_book_admin() function has been replaced by auth_book_admin() which now takes two parameters. Also it should now be return falserather than return 0.)
Last edit: Campbell Morrison 2019-06-06
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
function getWritable($creator, $user, $room){ if ((3 == get_area($room)) && !auth_book_admin($user, $room)) { return false; } // Always allowed to modify your own stuff if(strcasecmp($creator, $user) === 0) { return true; } // Otherwise you have to be a (booking) admin for this room if (auth_book_admin($user, $room)) { return true; } // Unathorised access return false;}
[getWritable() now takes three parameters].
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm sorry if I'm wasting your time but i receive yet fatal error. Maybe because i use your nav_improvement version? does something change in this case?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, probably. Can you post your original code for getWritable() so that I can see which version you have, because there have been lots of changes even within that branch.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
function getWritable($creator, $room){ $user = getUserName(); // Always allowed to modify your own stuff if(strcasecmp($creator, $user) === 0) { return true; } // Otherwise you have to be a (booking) admin for this room if (is_book_admin($room)) { return true; } // Unathorised access return false;}
Last edit: Campbell Morrison 2019-06-06
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
function getWritable($creator, $room){ $user = getUserName(); if ((3 == get_area($room)) && !is_book_admin($room)) { return false; } // Always allowed to modify your own stuff if(strcasecmp($creator, $user) === 0) { return true; } // Otherwise you have to be a (booking) admin for this room if (is_book_admin($room)) { return true; } // Unathorised access return false;}
If that doesn't work then look in your PHP error log to see what the error is.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There are three ways you could do this:
(1) Run two separate installations of MRBS, with the protected rooms in one installation and the rest in the other. For the protected installation set $auth['only_admin_can_book'].
(2) Use the ACL branch
(3) Modify getWritable() in mrbs_auth.inc
Campbell
View and moderate all "support-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Support Requests"
I change this code ? how I set a restriction on a room created ? for my press room for example ?
Last edit: Campbell Morrison 2019-06-05
Insert the following code at the beginning of the function, replacing 42 by the id of your room (you can find the id by going to that room in the week view and there should be the id in the query string in the URL):
Campbell
How can i customize control on area instead of room?
Use the get_area() function, eg:
Substitute the id of your area for 7.
I changed getWritable function:
but when select area number 3 system shows "Whoops! Unfortunately MRBS has encountered a fatal error. Please consult your system administrator"
Last edit: Campbell Morrison 2019-06-06
If you are using MRBS 1.7.3 then the code should be
(The is_book_admin() function has been replaced by auth_book_admin() which now takes two parameters. Also it should now be
return false
rather thanreturn 0
.)Last edit: Campbell Morrison 2019-06-06
Sorry, forget the last post. New version coming up.
Here's the correct code for 1.7.3:
[getWritable() now takes three parameters].
I'm sorry if I'm wasting your time but i receive yet fatal error. Maybe because i use your nav_improvement version? does something change in this case?
Yes, probably. Can you post your original code for getWritable() so that I can see which version you have, because there have been lots of changes even within that branch.
This is original code
Last edit: Campbell Morrison 2019-06-06
Then you need
If that doesn't work then look in your PHP error log to see what the error is.
Great, it works!! thank you very much.