From 784503bdbc8f0bd2b8f321b99acdafae6722c530 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Wed, 22 Feb 2017 11:00:01 -0500 Subject: [PATCH] (fix) minor fixes in tools --- Tools/SOGoToolCheckupUser.m | 10 +++++++--- Tools/SOGoToolManageACL.m | 15 +++++++++++---- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Tools/SOGoToolCheckupUser.m b/Tools/SOGoToolCheckupUser.m index 945b7cccc..b3d935be1 100644 --- a/Tools/SOGoToolCheckupUser.m +++ b/Tools/SOGoToolCheckupUser.m @@ -184,9 +184,13 @@ int max; max = [arguments count]; - if (max > 0 && max < 3) + if (max > 0) { - delete = (max == 2); + delete = [[arguments objectAtIndex: 0] isEqualToString: @"-d"]; + + if (delete && max > 1) + arguments = RETAIN([arguments subarrayWithRange: NSMakeRange(1, max-1)]); + rc = [self fetchUserIDs: arguments]; } else @@ -272,6 +276,7 @@ int count, max; NSString *basePath, *folder; + NSLog(@"Checking folders of user %@", uid); fm = [GCSFolderManager defaultFolderManager]; basePath = [NSString stringWithFormat: @"/Users/%@", uid]; folders = [fm listSubFoldersAtPath: basePath recursive: YES]; @@ -279,7 +284,6 @@ for (count = 0; count < max; count++) { folder = [NSString stringWithFormat: @"%@/%@", basePath, [folders objectAtIndex: count]]; - //NSLog (@"folder %d: %@", count, folder); [self checkupFolder: folder withFM: fm]; } diff --git a/Tools/SOGoToolManageACL.m b/Tools/SOGoToolManageACL.m index ab30baab0..6465ebd63 100644 --- a/Tools/SOGoToolManageACL.m +++ b/Tools/SOGoToolManageACL.m @@ -107,7 +107,7 @@ typedef enum " folder the folder - Calendar/ or Contacst/\n" " user the user to get/set rights for - 'ALL', '', 'anonymous' are supported\n" " rights rights to add\n\n" - "Example: sogo-tool get jdoe Calendar/personal\n\n" + "Example: sogo-tool manage-acl get jdoe Calendar/personal\n\n" "Note: You can add only one access right at the time. To set them all at once,\n" " invoke 'remove' first to remove them all.\n\n"); } @@ -199,7 +199,7 @@ typedef enum [allSQLUsers addObject: @""]; if ([[SOGoSystemDefaults sharedSystemDefaults] enablePublicAccess]) - [allSQLUsers addObject: @"anonymous"]; + [allSQLUsers addObject: @"anonymous"]; } else [allSQLUsers addObject: user]; @@ -217,8 +217,15 @@ typedef enum u = [allSQLUsers objectAtIndex: count]; - // We skip lookup for our 'system users' and the owner - if ([u isEqualToString: @"anonymous"] || [u isEqualToString: @""] || [u isEqualToString: owner]) + // We skip lookup for our 'system users' but keep them to set ACLs + if ([u isEqualToString: @"anonymous"] || [u isEqualToString: @""]) + { + [allUsers addObject: u]; + continue; + } + + // Skip the owner + if ([u isEqualToString: owner]) continue; infos = [lm contactInfosForUserWithUIDorEmail: u];