mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-14 17:58:51 +00:00
Monotone-Parent: 685b8a195b97f8362a148f9b01fb3fadb4eeccf0
Monotone-Revision: c8a00b4000a967d747332ed76e3501e958d17cfb Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-03-07T21:27:19 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
10
ChangeLog
10
ChangeLog
@@ -1,5 +1,15 @@
|
||||
2007-03-07 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/Appointments/SOGoAppointmentFolder.m
|
||||
([SOGoAppointmentFolder
|
||||
-appendObject:objectwithBaseURL:baseURLtoREPORTResponse:r]): make
|
||||
sure the cards are now handled as instances of
|
||||
SOGoCalendarComponent instead of SOGoContentObject so that their
|
||||
content string is taking the privacy classifiction into account.
|
||||
([SOGoAppointmentFolder -_privacySqlString]): new method that
|
||||
generates a query to determine what information can be given and
|
||||
if the card itself has to be shown.
|
||||
|
||||
* UI/Scheduler/UIxComponent+Agenor.m ([UIxComponent
|
||||
-getICalPersonsFromValue:selectorValue]): removed useless
|
||||
"isAccessRestricted" method.
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#import <SOGo/AgenorUserManager.h>
|
||||
#import <SOGo/SOGoPermissions.h>
|
||||
#import <SOGo/NSString+Utilities.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
|
||||
#import "common.h"
|
||||
|
||||
@@ -135,13 +136,18 @@ static NSNumber *sharedYes = nil;
|
||||
withBaseURL: (NSString *) baseURL
|
||||
toREPORTResponse: (WOResponse *) r
|
||||
{
|
||||
SOGoContentObject *ocsObject;
|
||||
SOGoCalendarComponent *component;
|
||||
Class componentClass;
|
||||
NSString *c_name, *etagLine, *calString;
|
||||
|
||||
c_name = [object objectForKey: @"c_name"];
|
||||
|
||||
ocsObject = [SOGoContentObject objectWithName: c_name
|
||||
inContainer: self];
|
||||
if ([[object objectForKey: @"component"] isEqualToString: @"vevent"])
|
||||
componentClass = [SOGoAppointmentObject class];
|
||||
else
|
||||
componentClass = [SOGoTaskObject class];
|
||||
|
||||
component = [componentClass objectWithName: c_name inContainer: self];
|
||||
|
||||
[r appendContentString: @" <D:response>\r\n"];
|
||||
[r appendContentString: @" <D:href>"];
|
||||
@@ -154,13 +160,13 @@ static NSNumber *sharedYes = nil;
|
||||
[r appendContentString: @" <D:propstat>\r\n"];
|
||||
[r appendContentString: @" <D:prop>\r\n"];
|
||||
etagLine = [NSString stringWithFormat: @" <D:getetag>%@</D:getetag>\r\n",
|
||||
[ocsObject davEntityTag]];
|
||||
[component davEntityTag]];
|
||||
[r appendContentString: etagLine];
|
||||
[r appendContentString: @" </D:prop>\r\n"];
|
||||
[r appendContentString: @" <D:status>HTTP/1.1 200 OK</D:status>\r\n"];
|
||||
[r appendContentString: @" </D:propstat>\r\n"];
|
||||
[r appendContentString: @" <C:calendar-data>"];
|
||||
calString = [[ocsObject contentAsString] stringByEscapingXMLString];
|
||||
calString = [[component contentAsString] stringByEscapingXMLString];
|
||||
[r appendContentString: calString];
|
||||
[r appendContentString: @"</C:calendar-data>\r\n"];
|
||||
[r appendContentString: @" </D:response>\r\n"];
|
||||
@@ -658,10 +664,37 @@ static NSNumber *sharedYes = nil;
|
||||
end = (unsigned int) [_endDate timeIntervalSince1970];
|
||||
|
||||
return [NSString stringWithFormat:
|
||||
@" AND (startdate <= %d) AND (enddate >= %d)",
|
||||
@" AND (startdate <= %u) AND (enddate >= %u)",
|
||||
end, start];
|
||||
}
|
||||
|
||||
- (NSString *) _privacySqlString
|
||||
{
|
||||
NSString *privacySqlString, *owner, *currentUser, *email;
|
||||
WOContext *context;
|
||||
SOGoUser *activeUser;
|
||||
|
||||
context = [[WOApplication application] context];
|
||||
activeUser = [context activeUser];
|
||||
currentUser = [activeUser login];
|
||||
owner = [self ownerInContext: context];
|
||||
|
||||
if ([currentUser isEqualToString: owner])
|
||||
privacySqlString = @"";
|
||||
else
|
||||
{
|
||||
email = [activeUser email];
|
||||
privacySqlString
|
||||
= [NSString stringWithFormat:
|
||||
@"(classification != %d or (orgmail = '%@')"
|
||||
@" or ((partmails caseInsensitiveLike '%@%%'"
|
||||
@" or partmails caseInsensitiveLike '%%\\n%@%%')))",
|
||||
iCalAccessPrivate, email, email, email];
|
||||
}
|
||||
|
||||
return privacySqlString;
|
||||
}
|
||||
|
||||
- (NSArray *) fetchFields: (NSArray *) _fields
|
||||
fromFolder: (GCSFolder *) _folder
|
||||
from: (NSCalendarDate *) _startDate
|
||||
@@ -671,7 +704,7 @@ static NSNumber *sharedYes = nil;
|
||||
EOQualifier *qualifier;
|
||||
NSMutableArray *fields, *ma = nil;
|
||||
NSArray *records;
|
||||
NSString *sql, *dateSqlString, *componentSqlString; /* , *owner; */
|
||||
NSString *sql, *dateSqlString, *componentSqlString, *privacySqlString; /* , *owner; */
|
||||
NGCalendarDateRange *r;
|
||||
|
||||
if (_folder == nil) {
|
||||
@@ -693,6 +726,7 @@ static NSNumber *sharedYes = nil;
|
||||
}
|
||||
|
||||
componentSqlString = [self _sqlStringForComponent: _component];
|
||||
privacySqlString = [self _privacySqlString];
|
||||
|
||||
/* prepare mandatory fields */
|
||||
|
||||
@@ -704,8 +738,8 @@ static NSNumber *sharedYes = nil;
|
||||
if (logger)
|
||||
[self debugWithFormat:@"should fetch (%@=>%@) ...", _startDate, _endDate];
|
||||
|
||||
sql = [NSString stringWithFormat: @"(iscycle = 0)%@%@",
|
||||
dateSqlString, componentSqlString];
|
||||
sql = [NSString stringWithFormat: @"(iscycle = 0)%@%@%@",
|
||||
dateSqlString, componentSqlString, privacySqlString];
|
||||
|
||||
/* fetch non-recurrent apts first */
|
||||
qualifier = [EOQualifier qualifierWithQualifierFormat: sql];
|
||||
@@ -722,8 +756,8 @@ static NSNumber *sharedYes = nil;
|
||||
}
|
||||
|
||||
/* fetch recurrent apts now */
|
||||
sql = [NSString stringWithFormat: @"(iscycle = 1)%@%@",
|
||||
dateSqlString, componentSqlString];
|
||||
sql = [NSString stringWithFormat: @"(iscycle = 1)%@%@%@",
|
||||
dateSqlString, componentSqlString, privacySqlString];
|
||||
qualifier = [EOQualifier qualifierWithQualifierFormat: sql];
|
||||
|
||||
[fields addObject: @"cycleinfo"];
|
||||
|
||||
Reference in New Issue
Block a user