From 8b3034a5f2a93fde600b5f0502889b1bdc2c7854 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 24 Apr 2007 22:45:38 +0000 Subject: [PATCH] Monotone-Parent: ba0063d228f496f6d43be55b3d6aeb33e2ba34e1 Monotone-Revision: 9f7fe2aea256613b84bdc296bef103767495048d Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-04-24T22:45:38 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 7 +++++++ SoObjects/SOGo/SOGoContentObject.m | 8 +------- SoObjects/SOGo/SOGoFolder.m | 30 +++++++++++++++++++----------- SoObjects/SOGo/SOGoObject.h | 4 ++-- SoObjects/SOGo/SOGoObject.m | 4 ++-- 5 files changed, 31 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index ca1b5dcd0..2b4ce4d1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2007-04-24 Wolfgang Sourdeau + * SoObjects/SOGo/SOGoFolder.m ([SOGoFolder + -setRoles:rolesforUser:uidforObjectAtPath:objectPathArray]): the + "roles" parameter is now an NSArray instead of a string. Therefore + we loop throughout the array to populate the table. All the + relevant records are removed prior to the addition of the new + rights. + * SoObjects/Mailer/SOGoMailBaseObject.m ([SOGoMailBaseObject -aclsForUser:uid]): new override that returns nil until we add support for IMAP acls. diff --git a/SoObjects/SOGo/SOGoContentObject.m b/SoObjects/SOGo/SOGoContentObject.m index 06a7857b3..a2d197cfa 100644 --- a/SoObjects/SOGo/SOGoContentObject.m +++ b/SoObjects/SOGo/SOGoContentObject.m @@ -307,12 +307,6 @@ /* acls */ -- (NSString *) defaultAclRoles -{ -#warning this should be changed to something useful - return @"tourist"; -} - - (NSArray *) acls { return [container aclsForObjectAtPath: [self pathArrayToSoObject]]; @@ -324,7 +318,7 @@ forObjectAtPath: [self pathArrayToSoObject]]; } -- (void) setRoles: (NSString *) roles +- (void) setRoles: (NSArray *) roles forUser: (NSString *) uid { return [container setRoles: roles diff --git a/SoObjects/SOGo/SOGoFolder.m b/SoObjects/SOGo/SOGoFolder.m index 5700260e1..f0dc1118e 100644 --- a/SoObjects/SOGo/SOGoFolder.m +++ b/SoObjects/SOGo/SOGoFolder.m @@ -284,33 +284,41 @@ } } -- (void) setRoles: (NSString *) roles +- (void) setRoles: (NSArray *) roles forUser: (NSString *) uid forObjectAtPath: (NSArray *) objectPathArray { EOAdaptorChannel *channel; GCSFolder *folder; - NSString *SQL; + NSEnumerator *userRoles; + NSString *SQL, *currentRole; [self removeAclsForUsers: [NSArray arrayWithObject: uid] forObjectAtPath: objectPathArray]; folder = [self ocsFolder]; channel = [folder acquireAclChannel]; - SQL = [NSString stringWithFormat: @"INSERT INTO %@" - @" (c_object, c_uid, c_role)" - @" VALUES ('/%@', '%@', '%@')", [folder aclTableName], - [objectPathArray componentsJoinedByString: @"/"], - uid, roles]; - [channel evaluateExpressionX: SQL]; + + userRoles = [roles objectEnumerator]; + currentRole = [userRoles nextObject]; + while (currentRole) + { + SQL = [NSString stringWithFormat: @"INSERT INTO %@" + @" (c_object, c_uid, c_role)" + @" VALUES ('/%@', '%@', '%@')", [folder aclTableName], + [objectPathArray componentsJoinedByString: @"/"], + uid, currentRole]; + [channel evaluateExpressionX: SQL]; + currentRole = [userRoles nextObject]; + } [folder releaseChannel: channel]; } /* acls */ -- (NSString *) defaultAclRoles +- (NSArray *) defaultAclRoles { #warning this should be changed to something useful - return @"tourist"; + return nil; } - (NSArray *) acls @@ -324,7 +332,7 @@ forObjectAtPath: [self pathArrayToSoObject]]; } -- (void) setRoles: (NSString *) roles +- (void) setRoles: (NSArray *) roles forUser: (NSString *) uid { return [self setRoles: roles diff --git a/SoObjects/SOGo/SOGoObject.h b/SoObjects/SOGo/SOGoObject.h index 00d257bde..9d3f7a4fe 100644 --- a/SoObjects/SOGo/SOGoObject.h +++ b/SoObjects/SOGo/SOGoObject.h @@ -88,10 +88,10 @@ /* acls */ -- (NSString *) defaultAclRoles; +- (NSArray *) defaultAclRoles; - (NSArray *) acls; - (NSArray *) aclsForUser: (NSString *) uid; -- (void) setRoles: (NSString *) roles +- (void) setRoles: (NSArray *) roles forUser: (NSString *) uid; - (void) removeAclsForUsers: (NSArray *) users; diff --git a/SoObjects/SOGo/SOGoObject.m b/SoObjects/SOGo/SOGoObject.m index 2688f7659..a652f69b4 100644 --- a/SoObjects/SOGo/SOGoObject.m +++ b/SoObjects/SOGo/SOGoObject.m @@ -706,14 +706,14 @@ static BOOL kontactGroupDAV = YES; return nil; } -- (NSString *) defaultAclRoles +- (NSArray *) defaultAclRoles { [self subclassResponsibility: _cmd]; return nil; } -- (void) setRoles: (NSString *) roles +- (void) setRoles: (NSArray *) roles forUser: (NSString *) uid { [self subclassResponsibility: _cmd];