mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-30 23:55:34 +00:00
Revert merge from inverse
https://github.com/Zentyal/sogo/pull/150 Because the login on web with the use of outlook is broken after including the DomainLessLogin feature
This commit is contained in:
+19
-28
@@ -1,6 +1,9 @@
|
||||
/* SOGoToolBackup.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2009-2015 Inverse inc.
|
||||
* Copyright (C) 2009-2011 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
* Francis Lachapelle <flachapelle@inverse.ca>
|
||||
*
|
||||
* 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
|
||||
@@ -39,7 +42,6 @@
|
||||
#import <SOGo/SOGoUserDefaults.h>
|
||||
#import <SOGo/SOGoUserProfile.h>
|
||||
#import <SOGo/SOGoUserSettings.h>
|
||||
#import <SOGo/SOGoSystemDefaults.h>
|
||||
#import <Contacts/NSDictionary+LDIF.h>
|
||||
|
||||
#import "SOGoTool.h"
|
||||
@@ -53,7 +55,7 @@
|
||||
@interface SOGoToolBackup : SOGoTool
|
||||
{
|
||||
NSString *directory;
|
||||
NSArray *usersToBackup;
|
||||
NSArray *userIDs;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -81,7 +83,7 @@
|
||||
if ((self = [super init]))
|
||||
{
|
||||
directory = nil;
|
||||
usersToBackup = nil;
|
||||
userIDs = nil;
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -90,7 +92,7 @@
|
||||
- (void) dealloc
|
||||
{
|
||||
[directory release];
|
||||
[usersToBackup release];
|
||||
[userIDs release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@@ -141,7 +143,6 @@
|
||||
|
||||
lm = [SOGoUserManager sharedUserManager];
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
|
||||
max = [users count];
|
||||
user = [users objectAtIndex: 0];
|
||||
@@ -197,11 +198,11 @@
|
||||
NSLog (@"user '%@' unknown", user);
|
||||
}
|
||||
[allUsers autorelease];
|
||||
|
||||
ASSIGN (usersToBackup, allUsers);
|
||||
|
||||
ASSIGN (userIDs, [allUsers objectsForKey: @"c_uid" notFoundMarker: nil]);
|
||||
DESTROY(pool);
|
||||
|
||||
return ([usersToBackup count] > 0);
|
||||
return ([userIDs count] > 0);
|
||||
}
|
||||
|
||||
- (BOOL) parseArguments
|
||||
@@ -409,29 +410,19 @@
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL) exportUser: (NSDictionary *) theUser
|
||||
- (BOOL) exportUser: (NSString *) uid
|
||||
{
|
||||
NSString *exportPath, *gcsUID, *ldapUID;
|
||||
NSMutableDictionary *userRecord;
|
||||
SOGoSystemDefaults *sd;
|
||||
|
||||
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
||||
NSString *exportPath;
|
||||
|
||||
userRecord = [NSMutableDictionary dictionary];
|
||||
exportPath = [directory stringByAppendingPathComponent: uid];
|
||||
|
||||
ldapUID = [theUser objectForKey: @"c_uid"];
|
||||
exportPath = [directory stringByAppendingPathComponent: ldapUID];
|
||||
|
||||
gcsUID = [theUser objectForKey: @"c_uid"];
|
||||
|
||||
if ([sd enableDomainBasedUID] && [gcsUID rangeOfString: @"@"].location == NSNotFound)
|
||||
gcsUID = [NSString stringWithFormat: @"%@@%@", gcsUID, [theUser objectForKey: @"c_domain"]];
|
||||
|
||||
|
||||
return ([self extractUserFolders: gcsUID
|
||||
return ([self extractUserFolders: uid
|
||||
intoRecord: userRecord]
|
||||
&& [self extractUserLDIFRecord: ldapUID
|
||||
&& [self extractUserLDIFRecord: uid
|
||||
intoRecord: userRecord]
|
||||
&& [self extractUserPreferences: gcsUID
|
||||
&& [self extractUserPreferences: uid
|
||||
intoRecord: userRecord]
|
||||
&& [userRecord writeToFile: exportPath
|
||||
atomically: NO]);
|
||||
@@ -447,10 +438,10 @@
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
max = [usersToBackup count];
|
||||
max = [userIDs count];
|
||||
for (count = 0; rc && count < max; count++)
|
||||
{
|
||||
rc = [self exportUser: [usersToBackup objectAtIndex: count]];
|
||||
rc = [self exportUser: [userIDs objectAtIndex: count]];
|
||||
if ((count % 10) == 0)
|
||||
[pool emptyPool];
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ typedef enum SOGoToolRestoreMode {
|
||||
{
|
||||
NSString *directory;
|
||||
NSString *userID;
|
||||
NSString *filename;
|
||||
NSString *restoreFolder;
|
||||
BOOL destructive; /* destructive mode not handled */
|
||||
SOGoToolRestoreMode restoreMode;
|
||||
|
||||
+9
-21
@@ -1,6 +1,6 @@
|
||||
/* SOGoToolRestore.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2009-2015 Inverse inc.
|
||||
* Copyright (C) 2009-2014 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
|
||||
@@ -73,7 +73,6 @@
|
||||
{
|
||||
directory = nil;
|
||||
userID = nil;
|
||||
filename = nil;
|
||||
restoreFolder = nil;
|
||||
destructive = NO;
|
||||
}
|
||||
@@ -85,7 +84,6 @@
|
||||
{
|
||||
[directory release];
|
||||
[userID release];
|
||||
[filename release];
|
||||
[restoreFolder release];
|
||||
[super dealloc];
|
||||
}
|
||||
@@ -154,35 +152,25 @@
|
||||
|
||||
- (BOOL) fetchUserID: (NSString *) identifier
|
||||
{
|
||||
SOGoSystemDefaults *sd;
|
||||
BOOL rc;
|
||||
SOGoUserManager *lm;
|
||||
NSDictionary *infos;
|
||||
SOGoSystemDefaults *sd;
|
||||
NSString *uid = nil;
|
||||
|
||||
BOOL rc;
|
||||
|
||||
lm = [SOGoUserManager sharedUserManager];
|
||||
infos = [lm contactInfosForUserWithUIDorEmail: identifier];
|
||||
uid = nil;
|
||||
|
||||
if (infos)
|
||||
{
|
||||
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
||||
uid = [infos objectForKey: @"c_uid"];
|
||||
|
||||
if ([sd enableDomainBasedUID] && [uid rangeOfString: @"@"].location == NSNotFound)
|
||||
if ([sd enableDomainBasedUID])
|
||||
uid = [NSString stringWithFormat: @"%@@%@",
|
||||
[infos objectForKey: @"c_uid"],
|
||||
[infos objectForKey: @"c_domain"]];
|
||||
|
||||
if ([[infos objectForKey: @"DomainLessLogin"] boolValue])
|
||||
ASSIGN(filename, [infos objectForKey: @"c_uid"]);
|
||||
[infos objectForKey: @"c_uid"],
|
||||
[infos objectForKey: @"c_domain"]];
|
||||
else
|
||||
ASSIGN(filename, uid);
|
||||
uid = [infos objectForKey: @"c_uid"];
|
||||
}
|
||||
|
||||
ASSIGN (userID, uid);
|
||||
|
||||
if (userID)
|
||||
rc = YES;
|
||||
else
|
||||
@@ -620,7 +608,7 @@
|
||||
NSString *importPath;
|
||||
BOOL rc;
|
||||
|
||||
importPath = [directory stringByAppendingPathComponent: filename];
|
||||
importPath = [directory stringByAppendingPathComponent: userID];
|
||||
userRecord = [NSDictionary dictionaryWithContentsOfFile: importPath];
|
||||
if (userRecord)
|
||||
{
|
||||
@@ -638,7 +626,7 @@
|
||||
else
|
||||
{
|
||||
rc = NO;
|
||||
NSLog(@"user backup (%@) file could not be loaded", importPath);
|
||||
NSLog (@"user backup file could not be loaded");
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
||||
+3
-1
@@ -1,6 +1,8 @@
|
||||
/* sogo-tool.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2009-2015 Inverse inc.
|
||||
* Copyright (C) 2009 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
* 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
|
||||
|
||||
Reference in New Issue
Block a user