Monotone-Parent: 52e60bbc85e658b4d2dc0c8382ee87393d05c34d
Monotone-Revision: 5c634952da80242ab54712c3940880241c489739 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-05-03T18:49:19 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
7a619a6540
commit
e95056042c
10
ChangeLog
10
ChangeLog
|
@ -1,5 +1,15 @@
|
||||||
2007-05-03 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
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
|
* SoObjects/SOGo/AgenorUserManager.m ([AgenorUserManager
|
||||||
-getSystemEMailForUID:uid]): new method that returns the email
|
-getSystemEMailForUID:uid]): new method that returns the email
|
||||||
formed with the user's uid and the default mail domain.
|
formed with the user's uid and the default mail domain.
|
||||||
|
|
|
@ -29,8 +29,11 @@
|
||||||
@class NSString;
|
@class NSString;
|
||||||
|
|
||||||
@class iCalCalendar;
|
@class iCalCalendar;
|
||||||
|
@class iCalPerson;
|
||||||
@class iCalRepeatableEntityObject;
|
@class iCalRepeatableEntityObject;
|
||||||
|
|
||||||
|
@class SOGoUser;
|
||||||
|
|
||||||
@interface SOGoCalendarComponent : SOGoContentObject
|
@interface SOGoCalendarComponent : SOGoContentObject
|
||||||
{
|
{
|
||||||
iCalCalendar *calendar;
|
iCalCalendar *calendar;
|
||||||
|
@ -57,9 +60,8 @@
|
||||||
andNewObject: (iCalRepeatableEntityObject *) _newObject
|
andNewObject: (iCalRepeatableEntityObject *) _newObject
|
||||||
toAttendees: (NSArray *) _attendees;
|
toAttendees: (NSArray *) _attendees;
|
||||||
|
|
||||||
- (BOOL) isOrganizer: (NSString *) email
|
- (BOOL) isOrganizerOrOwner: (SOGoUser *) user;
|
||||||
orOwner: (NSString *) login;
|
- (iCalPerson *) participant: (SOGoUser *) user;
|
||||||
- (BOOL) isParticipant: (NSString *) email;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -201,8 +201,8 @@ static BOOL sendEMailNotifications = NO;
|
||||||
|
|
||||||
- (iCalRepeatableEntityObject *) component: (BOOL) create
|
- (iCalRepeatableEntityObject *) component: (BOOL) create
|
||||||
{
|
{
|
||||||
return (iCalRepeatableEntityObject *)
|
return
|
||||||
[[self calendar: create]
|
(iCalRepeatableEntityObject *) [[self calendar: create]
|
||||||
firstChildWithTag: [self componentTag]];
|
firstChildWithTag: [self componentTag]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,42 +443,7 @@ static BOOL sendEMailNotifications = NO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - (NSArray *) rolesOfUser: (NSString *) login
|
- (BOOL) isOrganizerOrOwner: (SOGoUser *) user
|
||||||
// {
|
|
||||||
// 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;
|
BOOL isOrganizerOrOwner;
|
||||||
iCalRepeatableEntityObject *component;
|
iCalRepeatableEntityObject *component;
|
||||||
|
@ -488,26 +453,44 @@ static BOOL sendEMailNotifications = NO;
|
||||||
organizerEmail = [[component organizer] rfc822Email];
|
organizerEmail = [[component organizer] rfc822Email];
|
||||||
if (component && [organizerEmail length] > 0)
|
if (component && [organizerEmail length] > 0)
|
||||||
isOrganizerOrOwner
|
isOrganizerOrOwner
|
||||||
= ([organizerEmail caseInsensitiveCompare: email] == NSOrderedSame);
|
= (([organizerEmail caseInsensitiveCompare: [user email]]
|
||||||
|
== NSOrderedSame)
|
||||||
|
|| ([organizerEmail caseInsensitiveCompare: [user systemEMail]]
|
||||||
|
== NSOrderedSame));
|
||||||
else
|
else
|
||||||
isOrganizerOrOwner
|
isOrganizerOrOwner
|
||||||
= [[container ownerInContext: context] isEqualToString: login];
|
= [[container ownerInContext: context] isEqualToString: [user login]];
|
||||||
|
|
||||||
return isOrganizerOrOwner;
|
return isOrganizerOrOwner;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) isParticipant: (NSString *) email
|
- (iCalPerson *) participant: (SOGoUser *) user
|
||||||
{
|
{
|
||||||
BOOL isParticipant;
|
iCalPerson *participant, *currentParticipant;
|
||||||
iCalRepeatableEntityObject *component;
|
iCalEntityObject *component;
|
||||||
|
NSString *email, *systemEmail, *currentEmail;
|
||||||
|
NSEnumerator *participants;
|
||||||
|
|
||||||
|
participant = nil;
|
||||||
component = [self component: NO];
|
component = [self component: NO];
|
||||||
if (component)
|
if (component)
|
||||||
isParticipant = [component isParticipant: email];
|
{
|
||||||
|
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
|
else
|
||||||
isParticipant = NO;
|
currentParticipant = [participants nextObject];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return isParticipant;
|
return participant;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *) aclsForUser: (NSString *) uid
|
- (NSArray *) aclsForUser: (NSString *) uid
|
||||||
|
|
Loading…
Reference in a new issue