Owncloud : batch set calendar events to "CONFIDENTIAL"
Par Mathieu le lundi 9 novembre 2015, 13:11 - Hacks - Lien permanent
You are sharing your owncloud calendar with others. Good.
You don’t want others to see the details of your events, you only want to share the fact that your are “not available”, so you set the event to “CONFIDENTIAL”.
By default, Owncloud sets the events to “PUBLIC” (visible by anyone who have read access).
How to change all the default public events to “CONFIDENTIAL” ? Here is how.
The iCal standard used by Owncloud sets three event types :
- PUBLIC : the event is fully visible by anyone.
- CONFIDENTIAL : the event is fully visible to owner, but only shows time segment for those who have a read access to the calendar.
- PRIVATE : the event is only visible to owner and fully hidden to others (no time segment).
Owncloud stores the events in its database in iCal format, setting the value “CLASS” to the privacy level if needed, and nothing if not specified.
So, let’s change all the default events to CONFIDENTIAL :
UPDATE clndr_objects SET calendardata = REPLACE(calendardata, 'END:VEVENT', 'CLASS:CONFIDENTIAL END:VEVENT') WHERE objecttype='VEVENT' AND calendardata NOT LIKE '%CLASS:CONFIDENTIAL%' AND calendardata NOT LIKE '%CLASS:PRIVATE%' AND calendardata NOT LIKE '%CLASS:PUBLIC%';
Note that the new line after “CONFIDENTIAL” is mandatory and should not trigger the query until you type the ” ; ” and press enter.
Note that it will change the events for all users.
Backup your database before executing the query.