-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Any way to automate the ICS export? #3742
Comments
You should be able to do this by running report.php from a cron job. See the file help_report.html. However I haven't tested this for a while, so if I get time I might try and give it a go over the weekend. |
Thanks for looking into this! If this could work by sending a GET request to report.php it would be even better, as many calendar systems allow to pull an ICS file from some other source at certain intervals. When I try to send a request via HTTP, I am redirected to the login page.
|
Yes, a cron job of the sort
seems to work, but I agree that a REST API would be better. See also Issue #3636 . |
Got the cronjob working, thanks! Regarding REST - it would be better IMO if MRBS could simply provide a normal HTTP URL for downloading the current .ics file. With that, most normal calendar clients could directly download it. Thunderbird, for example, allows you to use a "https://yourserver/download.php" URL as source for a new calendar, together with a poll frequency (e.g. 30 minutes). See https://support.mozilla.org/en-US/kb/creating-new-calendars#w_on-the-network-connect-to-your-online-calendars for an example. And then you have all the bookings directly in your personal calendar app! This almost works already with MRBS - only the authentication is getting in the way. As suggested, an option to check for an area and/or room to allow unauthenticated read-only access in iCal format would be great. |
Yes, as you say it's almost there. Is an unauthenticated GET request OK? Or would it help if you had to put a key in as a query parameter (with valid keys perhaps stored in the config file)? |
A secret/key/token that needs to be included as query parameter would work well but an unauthenticated GET request for one or more specific rooms (and/or areas) would be good enough; it would need to come with a config option to control which ones to open up that way. We would not like the entire system to be readable via unauthenticated GET. Thanks a lot for considering this! |
Presumably if an area is marked as "open" then all rooms in that area are open. But if an area is closed, then only rooms in that area that are specifically marked as "open" are open? An initial implementation could use the config file, but later the room and area tables could be used to store the openness (and the edit_room and edit_area pages to modify it). At the moment the report parameters are "areamatch" and "roommatch" which match text strings for area and room names. There's no reason why those couldn't remain, but would you also want to be able to give arrays of area and room ids in the query string? |
Sounds very reasonable to me.
config file is totally fine
I would probably not. Instead I would rather use multiple URLs, each with a different string, for different areas/rooms. That way, I would get multiple calendars in my calendar client, with multiple colors etc. What would be good to have is the ability to export only certain types of bookings. |
I've now got a version for testing in this branch. I haven't yet implemented a key/token. The new config settings are: // Set this to true to allow unauthenticated GET requests to report.php
$report_unauthenticated_get_enabled = false;
// If unauthenticated GET requests are allowed then only bookings in rooms
// or areas that are open will be shown.
$report_open_areas = []; // An array of integer area ids
$report_open_rooms = []; // An array of integer room ids To use it you'll need to use All feedback welcome. |
I've now added support for keys in 9d2aae9. |
You should be able to do this using the |
Just wondering if you got a chance to test this, before I merge it back into the main branch? |
It is great there is the iCalendar .ics export, thank you!
Now we would like to automate the iCalendar .ics export, either through a cURL request or directly on the backend, in order to run it every 30 minutes to automatically add them to other calendaring systems.
One way to do so would be to be able to configure certain rooms/areas to be 'public' such that an unauthenticated POST request to report.php could be allowed to get the data.
Another way would be some kind of cronjob on the server that would produce such an .ics file, directly from the database?
The text was updated successfully, but these errors were encountered: