Monotone-Parent: 52e60bbc85e658b4d2dc0c8382ee87393d05c34d
Monotone-Revision: 5c634952da80242ab54712c3940880241c489739 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-05-03T18:49:19 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
7a619a6540
commit
e95056042c
10
ChangeLog
10
ChangeLog
|
@ -1,5 +1,15 @@
|
|||
2007-05-03 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/Appointments/SOGoCalendarComponent.m
|
||||
([SOGoCalendarComponent -isOrganizerOrOwner:user]): new method
|
||||
replacing "isOrganizer:orOwner:" by taking only one instance of
|
||||
SOGoUser as parameter.
|
||||
([SOGoCalendarComponent -participant:user]): new method replacing
|
||||
the previous "isParticipant" boolean method by returning the first
|
||||
participant matching the user passed as parameter. This method is
|
||||
used so that both the regular email address and the "system email
|
||||
address" of the user are matched against the participants emails.
|
||||
|
||||
* SoObjects/SOGo/AgenorUserManager.m ([AgenorUserManager
|
||||
-getSystemEMailForUID:uid]): new method that returns the email
|
||||
formed with the user's uid and the default mail domain.
|
||||
|
|
|
@ -29,8 +29,11 @@
|
|||
@class NSString;
|
||||
|
||||
@class iCalCalendar;
|
||||
@class iCalPerson;
|
||||
@class iCalRepeatableEntityObject;
|
||||
|
||||
@class SOGoUser;
|
||||
|
||||
@interface SOGoCalendarComponent : SOGoContentObject
|
||||
{
|
||||
iCalCalendar *calendar;
|
||||
|
@ -57,9 +60,8 @@
|
|||
andNewObject: (iCalRepeatableEntityObject *) _newObject
|
||||
toAttendees: (NSArray *) _attendees;
|
||||
|
||||
- (BOOL) isOrganizer: (NSString *) email
|
||||
orOwner: (NSString *) login;
|
||||
- (BOOL) isParticipant: (NSString *) email;
|
||||
- (BOOL) isOrganizerOrOwner: (SOGoUser *) user;
|
||||
- (iCalPerson *) participant: (SOGoUser *) user;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -201,9 +201,9 @@ static BOOL sendEMailNotifications = NO;
|
|||
|
||||
- (iCalRepeatableEntityObject *) component: (BOOL) create
|
||||
{
|
||||
return (iCalRepeatableEntityObject *)
|
||||
[[self calendar: create]
|
||||
firstChildWithTag: [self componentTag]];
|
||||
return
|
||||
(iCalRepeatableEntityObject *) [[self calendar: create]
|
||||
firstChildWithTag: [self componentTag]];
|
||||
}
|
||||
|
||||
- (BOOL) isNew
|
||||
|
@ -443,42 +443,7 @@ static BOOL sendEMailNotifications = NO;
|
|||
}
|
||||
}
|
||||
|
||||
// - (NSArray *) rolesOfUser: (NSString *) login
|
||||
// {
|
||||
// AgenorUserManager *um;
|
||||
// iCalRepeatableEntityObject *component;
|
||||
// NSMutableArray *sogoRoles;
|
||||
// NSString *email;
|
||||
// SOGoUser *user;
|
||||
|
||||
// sogoRoles = [NSMutableArray new];
|
||||
// [sogoRoles autorelease];
|
||||
|
||||
// um = [AgenorUserManager sharedUserManager];
|
||||
// email = [um getEmailForUID: login];
|
||||
|
||||
// component = [self component: NO];
|
||||
// if (component)
|
||||
// {
|
||||
// if ([component isOrganizer: email])
|
||||
// [sogoRoles addObject: SOGoCalendarRole_Organizer];
|
||||
// else if ([component isParticipant: email])
|
||||
// [sogoRoles addObject: SOGoCalendarRole_Participant];
|
||||
// else if ([[container ownerInContext: context] isEqualToString: login])
|
||||
// [sogoRoles addObject: SoRole_Owner];
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// user = [SOGoUser userWithLogin: login andRoles: nil];
|
||||
// [sogoRoles addObjectsFromArray: [user rolesForObject: container
|
||||
// inContext: context]];
|
||||
// }
|
||||
|
||||
// return sogoRoles;
|
||||
// }
|
||||
|
||||
- (BOOL) isOrganizer: (NSString *) email
|
||||
orOwner: (NSString *) login
|
||||
- (BOOL) isOrganizerOrOwner: (SOGoUser *) user
|
||||
{
|
||||
BOOL isOrganizerOrOwner;
|
||||
iCalRepeatableEntityObject *component;
|
||||
|
@ -488,26 +453,44 @@ static BOOL sendEMailNotifications = NO;
|
|||
organizerEmail = [[component organizer] rfc822Email];
|
||||
if (component && [organizerEmail length] > 0)
|
||||
isOrganizerOrOwner
|
||||
= ([organizerEmail caseInsensitiveCompare: email] == NSOrderedSame);
|
||||
= (([organizerEmail caseInsensitiveCompare: [user email]]
|
||||
== NSOrderedSame)
|
||||
|| ([organizerEmail caseInsensitiveCompare: [user systemEMail]]
|
||||
== NSOrderedSame));
|
||||
else
|
||||
isOrganizerOrOwner
|
||||
= [[container ownerInContext: context] isEqualToString: login];
|
||||
= [[container ownerInContext: context] isEqualToString: [user login]];
|
||||
|
||||
return isOrganizerOrOwner;
|
||||
}
|
||||
|
||||
- (BOOL) isParticipant: (NSString *) email
|
||||
- (iCalPerson *) participant: (SOGoUser *) user
|
||||
{
|
||||
BOOL isParticipant;
|
||||
iCalRepeatableEntityObject *component;
|
||||
iCalPerson *participant, *currentParticipant;
|
||||
iCalEntityObject *component;
|
||||
NSString *email, *systemEmail, *currentEmail;
|
||||
NSEnumerator *participants;
|
||||
|
||||
participant = nil;
|
||||
component = [self component: NO];
|
||||
if (component)
|
||||
isParticipant = [component isParticipant: email];
|
||||
else
|
||||
isParticipant = NO;
|
||||
{
|
||||
email = [[user email] lowercaseString];
|
||||
systemEmail = [[user systemEMail] lowercaseString];
|
||||
participants = [[component participants] objectEnumerator];
|
||||
currentParticipant = [participants nextObject];
|
||||
while (currentParticipant && !participant)
|
||||
{
|
||||
currentEmail = [[currentParticipant rfc822Email] lowercaseString];
|
||||
if ([currentEmail isEqualToString: email]
|
||||
|| [currentEmail isEqualToString: systemEmail])
|
||||
participant = currentParticipant;
|
||||
else
|
||||
currentParticipant = [participants nextObject];
|
||||
}
|
||||
}
|
||||
|
||||
return isParticipant;
|
||||
return participant;
|
||||
}
|
||||
|
||||
- (NSArray *) aclsForUser: (NSString *) uid
|
||||
|
|
Loading…
Reference in New Issue