mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-11 01:41:22 +00:00
oc-calendar: Add edit/delete own and Folder Contact/Owner sharing perm
By storing these custom MAPI roles in the ACL. The extension field 'X-SOGO-COMPONENT-CREATED-BY' is used to store the event creator when it is done from Outlook. It is the same field SOGo uses when an event is created from a shared folder in the webmail. The creator and the organizer/owner of the event can be different and it can be used from external sources by checking the organizer field. This matches the specification from [MS-OXOCAL] Section 1.1 which defines the organizer as the owner or creator of the event.
This commit is contained in:
@@ -1023,6 +1023,63 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
/* creator (only if created from Outlook/SOGo or organizer as fallback */
|
||||
- (NSString *) creator
|
||||
{
|
||||
iCalPerson *person;
|
||||
NSDictionary *contactInfos;
|
||||
NSString *creator = nil, *email;
|
||||
SOGoUserManager *mgr;
|
||||
|
||||
creator = [[event uniqueChildWithTag: @"x-sogo-component-created-by"]
|
||||
flattenedValuesForKey: @""];
|
||||
if ([creator length] == 0)
|
||||
{
|
||||
person = [event organizer];
|
||||
if (person)
|
||||
{
|
||||
email = [person rfc822Email];
|
||||
if ([email length] > 0)
|
||||
{
|
||||
mgr = [SOGoUserManager sharedUserManager];
|
||||
contactInfos = [mgr contactInfosForUserWithUIDorEmail: email];
|
||||
if (contactInfos)
|
||||
creator = [contactInfos objectForKey: @"sAMAccountName"];
|
||||
}
|
||||
}
|
||||
}
|
||||
return creator;
|
||||
}
|
||||
|
||||
/* owner is the organizer of the event, if none, try with the creator
|
||||
who has saved only from Outlook or SOGo */
|
||||
- (NSString *) owner
|
||||
{
|
||||
iCalPerson *person;
|
||||
NSDictionary *contactInfos;
|
||||
NSString *email, *owner = nil;
|
||||
SOGoUserManager *mgr;
|
||||
|
||||
person = [event organizer];
|
||||
if (person)
|
||||
{
|
||||
email = [person rfc822Email];
|
||||
if ([email length] > 0)
|
||||
{
|
||||
mgr = [SOGoUserManager sharedUserManager];
|
||||
contactInfos = [mgr contactInfosForUserWithUIDorEmail: email];
|
||||
if (contactInfos)
|
||||
owner = [contactInfos objectForKey: @"sAMAccountName"];
|
||||
}
|
||||
}
|
||||
|
||||
if (!owner)
|
||||
owner = [[event uniqueChildWithTag: @"x-sogo-component-created-by"]
|
||||
flattenedValuesForKey: @""];
|
||||
|
||||
return owner;
|
||||
}
|
||||
|
||||
/* sender representing */
|
||||
- (enum mapistore_error) getPidTagSentRepresentingEmailAddress: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
|
||||
Reference in New Issue
Block a user