sabre-io / Baikal

Baïkal is a Calendar+Contacts server
https://sabre.io/baikal/
GNU General Public License v3.0
2.5k stars 290 forks source link

Upgrading instructions for calendar sharing #875

Open rschulzeLE opened 4 years ago

rschulzeLE commented 4 years ago

Hi all,

since Baikal is under development again I've watched it and tested it on a non-productive system. Calendar shares are an essential feature for me.

Since calendar sharing is activated for not too long I've installed Baikal 0.6.1 and have tried to figure out how to share calendars. I have also tried to share a calendar by entering a respective line into the calendarinstances database table. The calendar was then listed for both users, but the second user still had no access.

Unfortunately, I could not find any more specific instructions on how to share a calendar. Would it be possible for someone to briefly explain the necessary steps?

I would really like to switch back to Baikal, but without calendar sharing this is not possible in my setting.

Many thanks!

ByteHamster commented 4 years ago

Baikal does not have a UI for calendar sharing. The only method is to add the lines to the database.

I have also tried to share a calendar by entering a respective line into the calendarinstances database table. The calendar was then listed for both users, but the second user still had no access.

I am using this on my system just fine. What do you mean with no access? Does the user get existing calendar entries but can not write new ones?

rnwgnr commented 4 years ago

hm, i just installed from latest master and if i understand correctly there is a "UI" for calendar sharing. You need to login as user to your baikal dav frontend and browse to https://domain.com/dav.php/calendars/user/calendername/. Then theres the opportunity to share a calendar at the bottom of the page: image

You need to enter mail adress of the user the calender should be shared to which is registered in baikal including the mailto: prefix. This seems to work just fine, i see all calendars that have been shared to me and can add items of i'm allowed to.

mrzool commented 3 years ago

@guzzisti Am I understanding this correctly and there's still no way to provide read-only access to a third party without authentication? I'm trying to set up a "normal" read-only shared calendar via simple URL.

rnwgnr commented 3 years ago

I don't know. I just shared the way how i managed calendar sharing. My use case didn't involve unauthenticated access.

rschulzeLE commented 3 years ago

As far as I know, this isn't possible so far. I'm using a workaround to create such a feature: A special user that has access to the calendar I want to share publicly, and a simple php skript that authenticates with my baikal installation. This skript generates an ics file that can be subscribed without authentification.

You can find a simple step-by-step guide here: https://www.andre-ruehle.ch/baikal-kalender-server-und-google-calendar/

Notice: https://bugs.php.net/bug.php?id=70101

mrzool commented 3 years ago

Nice @rschulzeLE, thanks a lot for sharing that!

mrzool commented 3 years ago

@guzzisti May I ask you which URL do you use for subscribing after going through the process you describe?

rschulzeLE commented 3 years ago

After sharing a calendar as described above by @guzzisti, you will find the shared calendar in the Baikal admin interface. For both users, the specific calendar should be visible, but each user will have a different calendar URI. Just click on the info icon, there you will find the correct URI for the user who has been granted access to the calendar.

mrzool commented 3 years ago

Thanks again @rschulzeLE, I had missed that. Sadly this is not working in Calendar.app on macOS even with the right URL, I just get a permission error and no possibility to log in. If I enter the login data in the URL as you describe in your tutorial, I get a login window, and then an error message saying that the data downloaded isn't valid.

There was an error subscribing to the calendar: The data downloaded from https://domain.com/dav.php/calendars/user/becf6e0f-c8b6-4653-bbd0-b938ef15fa1f/ isn’t valid.

Really too bad that such an important feature is so ill-supported by Baikal...

rschulzeLE commented 3 years ago

I've already read some issues related with macOS. Since I'm a Linux and Windows User, I can't help with further experience... Sorry. But it indeed seems to be one of the points baikal needs improvement.

flowmymind commented 2 years ago

As far as I know, this isn't possible so far. I'm using a workaround to create such a feature: A special user that has access to the calendar I want to share publicly, and a simple php skript that authenticates with my baikal installation. This skript generates an ics file that can be subscribed without authentification.

You can find a simple step-by-step guide here: https://www.andre-ruehle.ch/baikal-kalender-server-und-google-calendar/

Notice: https://bugs.php.net/bug.php?id=70101

Unfortunately there is a password request when I click on your link. It would be amazing, if you share your step-by-step tutorial again. Thank you!

Goalfair commented 1 year ago

An option to truly share a calendar as ICS-feed "read only" without authentication would be appreciated.

Here is a workaround for sharing calendar publicly (make sure you use basic authentication in baikal)

  1. Login as admin in baikal
  2. Create a new user (mail-address can be fictional)
  3. Delete default calendar of this user
  4. Share the calendar with this user as "read-only", see this comment: https://github.com/sabre-io/Baikal/issues/875#issuecomment-598901532
  5. Open user/calendar options (Users and resources)
  6. Click the info button (i) and copy the URI

Add "?export" (sans quotation marks) at the very end of this URI to enable export of ICS. You may now pass the export-URI and the login credentials of the new user to anyone who wants to view the calendar.

Some applications support login credentials as part of the URI, which skips the authentication request. Modify the URI to look like this: http://username-here:userpassword-here@path-to-calendar/?export

For example if username = user1 and password = pass1 and URI of shared calendar = http://www.domain.com/baikal/html/dav.php/calendars/user1/12345/ then total path is http://user1:pass1@www.domain.com/baikal/html/dav.php/calendars/user1/12345/?export

marcelbrueckner commented 1 year ago

An option to truly share a calendar as ICS-feed "read only" without authentication would be appreciated.

While Baikal doesn't seem to support this, it should be simple enough to achieve this on the server running Baikal without much hassle. Just use curl to download an ICS export as explained above (with a designated user) into an publicly readable folder of your server. Use a cron job (e.g. every 5m) to keep that file up to date.

# BAIKAL_HOME is your Baikal install directory, e.g. /var/www/baikal
mkdir $BAIKAL_HOME/html/public
# In my setup, my domain's document root is $BAIKAL_HOME/html, thus I don't need to include the html subdirectory in my path. Adjust it towards your settings.
# I'm also using digest authentication instead of basic auth, thus need to use --digest with cURL
curl --digest -u username:password -o calendarname.ics https://your-baikal-url.com/dav.php/calendars/user/calendarname?export
# Adjust file permissions if necessary
chown www-data:www-data calendarname.ics
# Your calendar should be available without authentication at https://your-baikal-url.com/public/calendarname.ics
Goalfair commented 1 year ago

Thanks, however not all webhosters allow access to command line. I guess you could use PHP to execute curl or make it even simpler like this (works with basic auth):

<?php
$source = "https://username:password@your-baikal-url.com/dav.php/calendars/user/calendarname?export";
$destination = "calendarname.ics";
file_put_contents($destination, file_get_contents($source));
?>

For security reasons use the username/password of a dedicated baikal user, which has read-only access to the calendar - as mentioned above. Of course you can modify the "destination" to save the file in a different directory than the one where the php is executed in.