CLASS is an optional field, don't set it to PUBLIC

As specified in RFC5545 the CLASS field is optional, and if it isn't present
is treated as PUBLIC. To allow a is-not-defined prop-filter to find
resources without CLASS set, we need to not store in the database. This
turns out to be okay, because to enforce privacy we always check to see if
it is PRIVATE or CONFIDENTIAL. We never check to see if it is PUBLIC.

Closes #284.
This commit is contained in:
Andrew Ruthven authored and Florian Schlichting committed 2023-03-12 20:05:48 +01:00
1 parent 4a380b12a2
commit 149ec3555f
8 files changed
+171 -21

No files matched your search

+1 -5
View File
@@ -180,11 +180,7 @@ class WritableCollection extends DAVResource {
$calitem_params[':dtstamp'] = $dtstamp;
$class = $first->GetPValue('CLASS');
/*
* It seems that some calendar clients don't set a class...
* RFC2445, 4.8.1.3: Default is PUBLIC
*/
if ( $this->IsPublicOnly() || !isset($class) || $class == '' ) {
if ( $this->IsPublicOnly() && isset($class)) {
$class = 'PUBLIC';
}
$calitem_params[':class'] = $class;