From c6765d031cafd8e9f44f6b4b3e86d0175123a863 Mon Sep 17 00:00:00 2001 From: helge Date: Mon, 28 May 2007 14:04:25 +0000 Subject: [PATCH] added methods to delete ACLs git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1488 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-gdl1/GDLContentStore/ChangeLog | 5 +++ sope-gdl1/GDLContentStore/GCSFolder.h | 2 ++ sope-gdl1/GDLContentStore/GCSFolder.m | 50 +++++++++++++++++++++++++-- sope-gdl1/GDLContentStore/Version | 2 +- 4 files changed, 56 insertions(+), 3 deletions(-) diff --git a/sope-gdl1/GDLContentStore/ChangeLog b/sope-gdl1/GDLContentStore/ChangeLog index 5d6af503..6c8e9c56 100644 --- a/sope-gdl1/GDLContentStore/ChangeLog +++ b/sope-gdl1/GDLContentStore/ChangeLog @@ -1,3 +1,8 @@ +2007-03-21 Wolfgang Sourdeau + + * GCSFolder.[hm]: added methods to delete ACL records (OGo bug #1866) + (v4.7.44) + 2007-04-22 Helge Hess * GCSChannelManager.m: improved error log (v4.7.43) diff --git a/sope-gdl1/GDLContentStore/GCSFolder.h b/sope-gdl1/GDLContentStore/GCSFolder.h index e461666c..7209517e 100644 --- a/sope-gdl1/GDLContentStore/GCSFolder.h +++ b/sope-gdl1/GDLContentStore/GCSFolder.h @@ -120,6 +120,8 @@ fetchSpecification:(EOFetchSpecification *)_fs; - (NSArray *)fetchFields:(NSArray *)_flds matchingQualifier:(EOQualifier *)_q; - (NSArray *)fetchAclMatchingQualifier:(EOQualifier *)_q; +- (void)deleteAclMatchingQualifier:(EOQualifier *)_q; +- (void)deleteAclWithSpecification:(EOFetchSpecification *)_fs; @end diff --git a/sope-gdl1/GDLContentStore/GCSFolder.m b/sope-gdl1/GDLContentStore/GCSFolder.m index 5033c6db..39f813ff 100644 --- a/sope-gdl1/GDLContentStore/GCSFolder.m +++ b/sope-gdl1/GDLContentStore/GCSFolder.m @@ -899,8 +899,7 @@ static GCSStringFormatter *stringFormatter = nil; return [self fetchFields:_flds fetchSpecification:fs]; } -- (NSArray *)fetchAclWithSpecification:(EOFetchSpecification *)_fs -{ +- (NSArray *)fetchAclWithSpecification:(EOFetchSpecification *)_fs { EOQualifier *qualifier; NSArray *sortOrderings; EOAdaptorChannel *channel; @@ -982,6 +981,53 @@ static GCSStringFormatter *stringFormatter = nil; return [self fetchAclWithSpecification:fs]; } +- (void) deleteAclMatchingQualifier:(EOQualifier *)_q { + EOFetchSpecification *fs; + + if (_q != nil) { + fs = [EOFetchSpecification fetchSpecificationWithEntityName: + [self folderName] + qualifier:_q + sortOrderings:nil]; + [self deleteAclWithSpecification:fs]; + } +} + +- (void)deleteAclWithSpecification:(EOFetchSpecification *)_fs +{ + EOQualifier *qualifier; + EOAdaptorChannel *channel; + NSException *error; + NSMutableString *sql; + + qualifier = [_fs qualifier]; + if (qualifier != nil) { + sql = [NSMutableString stringWithCapacity:256]; + [sql appendString:@"DELETE FROM "]; + [sql appendString:[self aclTableName]]; + [sql appendString:@" WHERE "]; + [sql appendString:[self generateSQLForQualifier:qualifier]]; + } + + /* open channel */ + + if ((channel = [self acquireAclChannel]) == nil) { + [self errorWithFormat:@"could not open acl channel!"]; + return; + } + + /* run SQL */ + + if ((error = [channel evaluateExpressionX:sql]) != nil) { + [self errorWithFormat:@"%s: cannot execute acl-fetch SQL '%@': %@", + __PRETTY_FUNCTION__, sql, error]; + [self releaseChannel:channel]; + return; + } + + [self releaseChannel:channel]; +} + /* description */ - (NSString *)description { diff --git a/sope-gdl1/GDLContentStore/Version b/sope-gdl1/GDLContentStore/Version index 2f980b4f..f1c7bbbc 100644 --- a/sope-gdl1/GDLContentStore/Version +++ b/sope-gdl1/GDLContentStore/Version @@ -2,7 +2,7 @@ MAJOR_VERSION:=4 MINOR_VERSION:=7 -SUBMINOR_VERSION:=43 +SUBMINOR_VERSION:=44 # v4.5.29 requires libNGExtensions v4.5.161 # v4.5.26 does not require libNGiCal anymore -- 2.39.5