From 1ff24dddfca8f6d4d15c8f799c0df06f50c1e34a Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 23 Nov 2016 11:16:13 -0500 Subject: [PATCH] Respect mailbox administration rights of user --- NEWS | 1 + SoObjects/Mailer/SOGoMailFolder.m | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/NEWS b/NEWS index 6ea17da10..e64060cba 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,7 @@ Bug fixes - [core] always send IMIP messages using UTF-8 - [web] fixed support for recurrent tasks - [web] improved validation of mail account delegators + - [web] allow edition of a mailbox rights when user can administer mailbox 2.3.17 (2016-10-20) ------------------- diff --git a/SoObjects/Mailer/SOGoMailFolder.m b/SoObjects/Mailer/SOGoMailFolder.m index dd83ff1a2..675275edd 100644 --- a/SoObjects/Mailer/SOGoMailFolder.m +++ b/SoObjects/Mailer/SOGoMailFolder.m @@ -1517,11 +1517,12 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data) path = [[self imap4Connection] imap4FolderNameForURL: [self imap4URL]]; if ([self _path: path - isInNamespaces: [mailAccount otherUsersFolderNamespaces]] - || [self _path: path - isInNamespaces: [mailAccount sharedFolderNamespaces]]) + isInNamespaces: [mailAccount otherUsersFolderNamespaces]] || + [self _path: path + isInNamespaces: [mailAccount sharedFolderNamespaces]]) [acls addObject: SOGoRole_ObjectViewer]; else + // Inside user's namespace, automatically owner [acls addObject: SoRole_Owner]; return acls; @@ -1534,23 +1535,22 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data) userLogin = [[context activeUser] login]; if ([uid isEqualToString: userLogin]) + // Login user wants her ACLs acls = [self _sharesACLs]; else + // Login user wants the ACLs of another user acls = [NSMutableArray array]; - if ([owner isEqualToString: userLogin]) - { - if (!mailboxACL) - [self _readMailboxACL]; + if (!mailboxACL) + [self _readMailboxACL]; - if ([mailboxACL isKindOfClass: [NSDictionary class]]) - { - userAcls = [mailboxACL objectForKey: uid]; - if (!([userAcls length] || [uid isEqualToString: defaultUserID])) - userAcls = [mailboxACL objectForKey: defaultUserID]; - if ([userAcls length]) - [acls addObjectsFromArray: [self _imapAclsToSOGoAcls: userAcls]]; - } + if ([mailboxACL isKindOfClass: [NSDictionary class]]) + { + userAcls = [mailboxACL objectForKey: uid]; + if (!([userAcls length] || [uid isEqualToString: defaultUserID])) + userAcls = [mailboxACL objectForKey: defaultUserID]; + if ([userAcls length]) + [acls addObjectsFromArray: [self _imapAclsToSOGoAcls: userAcls]]; } return acls;