From 836fdb172203f545209b65198c4158b934021f36 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Wed, 23 Nov 2016 16:30:41 -0500 Subject: [PATCH] (feat) added photo support for LDAP-based address books --- Documentation/SOGoInstallationGuide.asciidoc | 1 + NEWS | 3 +++ SOPE/NGCards/NGVCardPhoto.h | 4 +-- SOPE/NGCards/NGVCardPhoto.m | 4 +-- SoObjects/Contacts/NGVCard+SOGo.m | 5 ++++ SoObjects/Contacts/NSDictionary+LDIF.h | 4 +-- SoObjects/Contacts/NSDictionary+LDIF.m | 4 +-- SoObjects/Contacts/NSString+LDIF.h | 4 +-- SoObjects/Contacts/NSString+LDIF.m | 4 +-- SoObjects/Contacts/SOGoContactEntryPhoto.h | 4 +-- SoObjects/Contacts/SOGoContactEntryPhoto.m | 4 +-- SoObjects/Contacts/SOGoContactGCSEntry.h | 2 +- SoObjects/Contacts/SOGoContactGCSEntry.m | 4 +-- SoObjects/Contacts/SOGoContactGCSList.h | 4 +-- SoObjects/Contacts/SOGoContactLDIFEntry.h | 3 +-- SoObjects/Contacts/SOGoContactLDIFEntry.m | 26 ++++++++++++++++++-- SoObjects/Contacts/SOGoUserFolder+Contacts.h | 4 +-- SoObjects/SOGo/LDAPSource.m | 4 +-- 18 files changed, 48 insertions(+), 40 deletions(-) diff --git a/Documentation/SOGoInstallationGuide.asciidoc b/Documentation/SOGoInstallationGuide.asciidoc index 210b1c114..bd626c881 100644 --- a/Documentation/SOGoInstallationGuide.asciidoc +++ b/Documentation/SOGoInstallationGuide.asciidoc @@ -1232,6 +1232,7 @@ mapping = { 2+h|Other |Birthday |birthyear-birthmonth-birthday |Note |description +|Photo |photo |=== Authenticating using C.A.S. diff --git a/NEWS b/NEWS index 94e889632..9decd989a 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ 3.2.3 (2016-12-DD) ------------------ +New features + - [core] added photo support for LDAP-based address books + Enhancements - [web] updated CKEditor to version 4.6.0 diff --git a/SOPE/NGCards/NGVCardPhoto.h b/SOPE/NGCards/NGVCardPhoto.h index 0b586cb52..c085626a8 100644 --- a/SOPE/NGCards/NGVCardPhoto.h +++ b/SOPE/NGCards/NGVCardPhoto.h @@ -1,8 +1,6 @@ /* NGVCardPhoto.h - this file is part of NGCards * - * Copyright (C) 2010 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2010-2016 Inverse inc. * * NGCards is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the diff --git a/SOPE/NGCards/NGVCardPhoto.m b/SOPE/NGCards/NGVCardPhoto.m index fcd15aabe..aebe37d5b 100644 --- a/SOPE/NGCards/NGVCardPhoto.m +++ b/SOPE/NGCards/NGVCardPhoto.m @@ -1,8 +1,6 @@ /* NGVCardPhoto.m - this file is part of NGCards * - * Copyright (C) 2010 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2010-2016 Inverse inc. * * NGCards is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the diff --git a/SoObjects/Contacts/NGVCard+SOGo.m b/SoObjects/Contacts/NGVCard+SOGo.m index ec8c38bc9..e41d116c7 100644 --- a/SoObjects/Contacts/NGVCard+SOGo.m +++ b/SoObjects/Contacts/NGVCard+SOGo.m @@ -21,6 +21,7 @@ #import +#import #import #import @@ -358,6 +359,10 @@ convention: else [self setCategories: [o componentsSeparatedByString: @","]]; + // Photo + if ([ldifRecord objectForKey: @"photo"]) + [self setPhoto: [[ldifRecord objectForKey: @"photo"] stringByEncodingBase64]]; + [self cleanupEmptyChildren]; } diff --git a/SoObjects/Contacts/NSDictionary+LDIF.h b/SoObjects/Contacts/NSDictionary+LDIF.h index 1fcae50dc..bc2930d69 100644 --- a/SoObjects/Contacts/NSDictionary+LDIF.h +++ b/SoObjects/Contacts/NSDictionary+LDIF.h @@ -1,8 +1,6 @@ /* NSDictionary+LDIF.h - this file is part of SOGo * - * Copyright (C) 2011 Inverse inc - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2011-2016 Inverse inc * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/SoObjects/Contacts/NSDictionary+LDIF.m b/SoObjects/Contacts/NSDictionary+LDIF.m index 3e94c6aaf..660f1bdf9 100644 --- a/SoObjects/Contacts/NSDictionary+LDIF.m +++ b/SoObjects/Contacts/NSDictionary+LDIF.m @@ -1,8 +1,6 @@ /* NSDictionary+LDIF.m - this file is part of SOGo * - * Copyright (C) 2011-2012 Inverse inc - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2011-2016 Inverse inc * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/SoObjects/Contacts/NSString+LDIF.h b/SoObjects/Contacts/NSString+LDIF.h index e93797242..8a84d10a2 100644 --- a/SoObjects/Contacts/NSString+LDIF.h +++ b/SoObjects/Contacts/NSString+LDIF.h @@ -1,8 +1,6 @@ /* NSString+LDIF.h - this file is part of SOGo * - * Copyright (C) 2011 Inverse inc - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2011-2016 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/SoObjects/Contacts/NSString+LDIF.m b/SoObjects/Contacts/NSString+LDIF.m index 91593a446..bbd784f94 100644 --- a/SoObjects/Contacts/NSString+LDIF.m +++ b/SoObjects/Contacts/NSString+LDIF.m @@ -1,8 +1,6 @@ /* NSString+LDIF.m - this file is part of SOGo * - * Copyright (C) 2011 Inverse inc - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2011-2016 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/SoObjects/Contacts/SOGoContactEntryPhoto.h b/SoObjects/Contacts/SOGoContactEntryPhoto.h index 6c44d0757..a6cfa9308 100644 --- a/SoObjects/Contacts/SOGoContactEntryPhoto.h +++ b/SoObjects/Contacts/SOGoContactEntryPhoto.h @@ -1,8 +1,6 @@ /* SOGoContactEntryPhoto.h - this file is part of SOGo * - * Copyright (C) 2010 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2010-2016 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/SoObjects/Contacts/SOGoContactEntryPhoto.m b/SoObjects/Contacts/SOGoContactEntryPhoto.m index 153c5ca66..078257c05 100644 --- a/SoObjects/Contacts/SOGoContactEntryPhoto.m +++ b/SoObjects/Contacts/SOGoContactEntryPhoto.m @@ -1,8 +1,6 @@ /* SOGoContactEntryPhoto.m - this file is part of SOGo * - * Copyright (C) 2010 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2010-2016 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/SoObjects/Contacts/SOGoContactGCSEntry.h b/SoObjects/Contacts/SOGoContactGCSEntry.h index 20fb4961f..40cee1af1 100644 --- a/SoObjects/Contacts/SOGoContactGCSEntry.h +++ b/SoObjects/Contacts/SOGoContactGCSEntry.h @@ -1,6 +1,6 @@ /* SOGoContactGCSEntry.h - this file is part of SOGo * - * Copyright (C) 2006-2014 Inverse inc. + * Copyright (C) 2006-2016 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/SoObjects/Contacts/SOGoContactGCSEntry.m b/SoObjects/Contacts/SOGoContactGCSEntry.m index 8b9b5bd1b..40a18474f 100644 --- a/SoObjects/Contacts/SOGoContactGCSEntry.m +++ b/SoObjects/Contacts/SOGoContactGCSEntry.m @@ -1,6 +1,6 @@ -/* SOGoContactGCSEntry.h - this file is part of SOGo +/* SOGoContactGCSEntry.m - this file is part of SOGo * - * Copyright (C) 2006-2014 Inverse inc. + * Copyright (C) 2006-2016 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/SoObjects/Contacts/SOGoContactGCSList.h b/SoObjects/Contacts/SOGoContactGCSList.h index 89068a528..8b1fdb15a 100644 --- a/SoObjects/Contacts/SOGoContactGCSList.h +++ b/SoObjects/Contacts/SOGoContactGCSList.h @@ -1,8 +1,6 @@ /* SOGoContactGCSList.h - this file is part of SOGo * - * Copyright (C) 2008 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2008-2016 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/SoObjects/Contacts/SOGoContactLDIFEntry.h b/SoObjects/Contacts/SOGoContactLDIFEntry.h index a1db9cfcb..581bf85c2 100644 --- a/SoObjects/Contacts/SOGoContactLDIFEntry.h +++ b/SoObjects/Contacts/SOGoContactLDIFEntry.h @@ -1,7 +1,6 @@ /* SOGoContactLDIFEntry.h - this file is part of SOGo - * Copyright (C) 2006-2011 Inverse inc. * - * Author: Wolfgang Sourdeau + * Copyright (C) 2006-2016 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/SoObjects/Contacts/SOGoContactLDIFEntry.m b/SoObjects/Contacts/SOGoContactLDIFEntry.m index 1b51be3f3..c11d09566 100644 --- a/SoObjects/Contacts/SOGoContactLDIFEntry.m +++ b/SoObjects/Contacts/SOGoContactLDIFEntry.m @@ -1,6 +1,6 @@ /* SOGoContactLDIFEntry.m - this file is part of SOGo * - * Copyright (C) 2006-2014 Inverse inc. + * Copyright (C) 2006-2016 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,6 +26,7 @@ #import #import "NGVCard+SOGo.h" +#import "SOGoContactEntryPhoto.h" #import "SOGoContactGCSEntry.h" #import "SOGoContactLDIFEntry.h" #import "SOGoContactSourceFolder.h" @@ -141,7 +142,7 @@ - (BOOL) hasPhoto { - return NO; + return ([ldifEntry objectForKey: @"photo"] != nil); } - (NSString *) davEntityTag @@ -227,4 +228,25 @@ return [newContact saveComponent: newCard]; } +- (id) lookupName: (NSString *) lookupName + inContext: (id) localContext + acquire: (BOOL) acquire +{ + id obj; + + if ([lookupName isEqualToString: @"photo"]) + { + if ([self hasPhoto]) + obj = [SOGoContactEntryPhoto objectWithName: lookupName + inContainer: self]; + else + obj = nil; + } + else + obj = [super lookupName: lookupName inContext: localContext + acquire: acquire]; + + return obj; +} + @end diff --git a/SoObjects/Contacts/SOGoUserFolder+Contacts.h b/SoObjects/Contacts/SOGoUserFolder+Contacts.h index 89f1ca0a3..cc78cd60c 100644 --- a/SoObjects/Contacts/SOGoUserFolder+Contacts.h +++ b/SoObjects/Contacts/SOGoUserFolder+Contacts.h @@ -1,8 +1,6 @@ /* SOGoUserFolder+Appointments.h - this file is part of SOGo * - * Copyright (C) 2009 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2009-2016 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/SoObjects/SOGo/LDAPSource.m b/SoObjects/SOGo/LDAPSource.m index 50a834ac8..769d2ff2e 100644 --- a/SoObjects/SOGo/LDAPSource.m +++ b/SoObjects/SOGo/LDAPSource.m @@ -1211,7 +1211,6 @@ groupObjectClasses: (NSArray *) newGroupObjectClasses { ldapConnection = [self _ldapConnection]; qualifier = [self _qualifierForFilter: match]; - // attributes = [self _searchAttributes]; attributes = [NSArray arrayWithObject: @"*"]; if ([_scope caseInsensitiveCompare: @"BASE"] == NSOrderedSame) @@ -1237,10 +1236,9 @@ groupObjectClasses: (NSArray *) newGroupObjectClasses - (NGLdapEntry *) _lookupLDAPEntry: (EOQualifier *) qualifier { NGLdapConnection *ldapConnection; - NSArray *attributes; NSEnumerator *entries; + NSArray *attributes; - // attributes = [self _searchAttributes]; ldapConnection = [self _ldapConnection]; attributes = [NSArray arrayWithObject: @"*"];