(fix) minor fixes in tools

pull/234/head
Ludovic Marcotte 2017-02-22 11:00:01 -05:00
parent 91b32faac2
commit 784503bdbc
2 changed files with 18 additions and 7 deletions

View File

@ -184,9 +184,13 @@
int max; int max;
max = [arguments count]; 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]; rc = [self fetchUserIDs: arguments];
} }
else else
@ -272,6 +276,7 @@
int count, max; int count, max;
NSString *basePath, *folder; NSString *basePath, *folder;
NSLog(@"Checking folders of user %@", uid);
fm = [GCSFolderManager defaultFolderManager]; fm = [GCSFolderManager defaultFolderManager];
basePath = [NSString stringWithFormat: @"/Users/%@", uid]; basePath = [NSString stringWithFormat: @"/Users/%@", uid];
folders = [fm listSubFoldersAtPath: basePath recursive: YES]; folders = [fm listSubFoldersAtPath: basePath recursive: YES];
@ -279,7 +284,6 @@
for (count = 0; count < max; count++) for (count = 0; count < max; count++)
{ {
folder = [NSString stringWithFormat: @"%@/%@", basePath, [folders objectAtIndex: count]]; folder = [NSString stringWithFormat: @"%@/%@", basePath, [folders objectAtIndex: count]];
//NSLog (@"folder %d: %@", count, folder);
[self checkupFolder: folder withFM: fm]; [self checkupFolder: folder withFM: fm];
} }

View File

@ -107,7 +107,7 @@ typedef enum
" folder the folder - Calendar/<ID> or Contacst/<ID>\n" " folder the folder - Calendar/<ID> or Contacst/<ID>\n"
" user the user to get/set rights for - 'ALL', '<default>', 'anonymous' are supported\n" " user the user to get/set rights for - 'ALL', '<default>', 'anonymous' are supported\n"
" rights rights to add\n\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" "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"); " invoke 'remove' first to remove them all.\n\n");
} }
@ -199,7 +199,7 @@ typedef enum
[allSQLUsers addObject: @"<default>"]; [allSQLUsers addObject: @"<default>"];
if ([[SOGoSystemDefaults sharedSystemDefaults] enablePublicAccess]) if ([[SOGoSystemDefaults sharedSystemDefaults] enablePublicAccess])
[allSQLUsers addObject: @"anonymous"]; [allSQLUsers addObject: @"anonymous"];
} }
else else
[allSQLUsers addObject: user]; [allSQLUsers addObject: user];
@ -217,8 +217,15 @@ typedef enum
u = [allSQLUsers objectAtIndex: count]; u = [allSQLUsers objectAtIndex: count];
// We skip lookup for our 'system users' and the owner // We skip lookup for our 'system users' but keep them to set ACLs
if ([u isEqualToString: @"anonymous"] || [u isEqualToString: @"<default>"] || [u isEqualToString: owner]) if ([u isEqualToString: @"anonymous"] || [u isEqualToString: @"<default>"])
{
[allUsers addObject: u];
continue;
}
// Skip the owner
if ([u isEqualToString: owner])
continue; continue;
infos = [lm contactInfosForUserWithUIDorEmail: u]; infos = [lm contactInfosForUserWithUIDorEmail: u];