fix(calendar): use the calendar owner when generating freebusy information
parent
a78f06e909
commit
6af0058657
|
@ -1476,8 +1476,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
#warning we do not take the participation status into account
|
#warning we do not take the participation status into account
|
||||||
while ((currentRecord = [ma nextObject]))
|
while ((currentRecord = [ma nextObject]))
|
||||||
{
|
{
|
||||||
accessClass
|
accessClass = [[currentRecord objectForKey: @"c_classification"] intValue];
|
||||||
= [[currentRecord objectForKey: @"c_classification"] intValue];
|
|
||||||
role = roles[accessClass];
|
role = roles[accessClass];
|
||||||
if (!role)
|
if (!role)
|
||||||
{
|
{
|
||||||
|
@ -1506,13 +1505,17 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
EOQualifier *qualifier;
|
EOQualifier *qualifier;
|
||||||
GCSFolder *folder;
|
GCSFolder *folder;
|
||||||
NSMutableArray *fields, *ma;
|
NSMutableArray *fields, *ma;
|
||||||
|
NSMutableDictionary *currentRecord;
|
||||||
NSArray *records;
|
NSArray *records;
|
||||||
|
NSEnumerator *matchingRecords;
|
||||||
NSMutableArray *baseWhere;
|
NSMutableArray *baseWhere;
|
||||||
NSString *where, *dateSqlString, *privacySQLString, *currentLogin;
|
NSString *where, *dateSqlString, *privacySQLString, *currentLogin;
|
||||||
NSCalendarDate *endDate;
|
NSCalendarDate *endDate;
|
||||||
NGCalendarDateRange *r;
|
NGCalendarDateRange *r;
|
||||||
BOOL rememberRecords, canCycle;
|
BOOL rememberRecords, canCycle;
|
||||||
|
SOGoUser *ownerUser;
|
||||||
|
|
||||||
|
ownerUser = [SOGoUser userWithLogin: owner roles: nil];
|
||||||
rememberRecords = [self _checkIfWeCanRememberRecords: _fields];
|
rememberRecords = [self _checkIfWeCanRememberRecords: _fields];
|
||||||
canCycle = [_component isEqualToString: @"vevent"] || [_component isEqualToString: @"vtodo"];
|
canCycle = [_component isEqualToString: @"vevent"] || [_component isEqualToString: @"vtodo"];
|
||||||
// if (rememberRecords)
|
// if (rememberRecords)
|
||||||
|
@ -1670,11 +1673,21 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
}
|
}
|
||||||
|
|
||||||
currentLogin = [[context activeUser] login];
|
currentLogin = [[context activeUser] login];
|
||||||
if (![currentLogin isEqualToString: owner]
|
if (![currentLogin isEqualToString: owner])
|
||||||
&& !_includeProtectedInformation)
|
{
|
||||||
[self _fixupProtectedInformation: [ma objectEnumerator]
|
|
||||||
inFields: _fields
|
if (!_includeProtectedInformation)
|
||||||
forUser: currentLogin];
|
[self _fixupProtectedInformation: [ma objectEnumerator]
|
||||||
|
inFields: _fields
|
||||||
|
forUser: currentLogin];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add owner to each record. It will be used when generating freebusy.
|
||||||
|
matchingRecords = [ma objectEnumerator];
|
||||||
|
while ((currentRecord = [matchingRecords nextObject]))
|
||||||
|
{
|
||||||
|
[currentRecord setObject: ownerUser forKey: @"owner"];
|
||||||
|
}
|
||||||
|
|
||||||
if (rememberRecords)
|
if (rememberRecords)
|
||||||
[self _rememberRecords: ma];
|
[self _rememberRecords: ma];
|
||||||
|
|
|
@ -157,6 +157,7 @@
|
||||||
for (recordCount = 0; recordCount < recordMax; recordCount++)
|
for (recordCount = 0; recordCount < recordMax; recordCount++)
|
||||||
{
|
{
|
||||||
record = [records objectAtIndex: recordCount];
|
record = [records objectAtIndex: recordCount];
|
||||||
|
user = [record objectForKey: @"owner"];
|
||||||
if ([[record objectForKey: @"c_isopaque"] boolValue])
|
if ([[record objectForKey: @"c_isopaque"] boolValue])
|
||||||
{
|
{
|
||||||
type = 0;
|
type = 0;
|
||||||
|
@ -181,9 +182,13 @@
|
||||||
// We now fetch the c_partstates array and get the participation
|
// We now fetch the c_partstates array and get the participation
|
||||||
// status of the user for the event
|
// status of the user for the event
|
||||||
partstates = [[record objectForKey: @"c_partstates"] componentsSeparatedByString: @"\n"];
|
partstates = [[record objectForKey: @"c_partstates"] componentsSeparatedByString: @"\n"];
|
||||||
|
|
||||||
if (i < [partstates count])
|
if (i < [partstates count])
|
||||||
{
|
{
|
||||||
|
// 0: needs action (considered busy)
|
||||||
|
// 1: accepted (busy)
|
||||||
|
// 2: declined (free)
|
||||||
|
// 3: tentative (free)
|
||||||
|
// 4: delegated (free)
|
||||||
type = ([[partstates objectAtIndex: i] intValue] < 2 ? 1 : 0);
|
type = ([[partstates objectAtIndex: i] intValue] < 2 ? 1 : 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue