From: wolfgang Date: Mon, 25 Feb 2008 22:02:29 +0000 (+0000) Subject: git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1380 d1b88da0-ebda-0310... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88e816e985d0fc8d3e6a28965a00e160f5d07a21;p=scalable-opengroupware.org git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1380 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/ChangeLog b/ChangeLog index 9a67f429..7742fdb8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-02-25 Wolfgang Sourdeau + + * SoObjects/SOGo/SOGoGCSFolder.m ([SOGoGCSFolder + -davSubscribe:queryContext]): implemented subscribing users other + that the current one, if the user doing the operation is a superuser. + ([SOGoGCSFolder -davUnsubscribe:queryContext]): same as above for + unsubscription. + 2008-02-22 Wolfgang Sourdeau * SoObjects/SOGo/SOGoUserFolder.m ([SOGoUserFolder diff --git a/NEWS b/NEWS index c06cfa8c..415ca7fb 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +0.9.0-2008xxxx (1.0 rc6) +- retrieving the freebusy DAV object was causing SOGo to crash +- converted to use the gnustep-make 2 build framework +- added custom DAV methods for managing user permissions from the SOGo Integrator + 0.9.0-20080208 (1.0 rc5) ------------------------ - improved validation in the custom recurrence window diff --git a/SoObjects/SOGo/SOGoDAVRendererTypes.m b/SoObjects/SOGo/SOGoDAVRendererTypes.m index cdbb00b2..5d74a9c5 100644 --- a/SoObjects/SOGo/SOGoDAVRendererTypes.m +++ b/SoObjects/SOGo/SOGoDAVRendererTypes.m @@ -1,6 +1,6 @@ /* SOGoDAVRendererTypes.m - this file is part of SOGo * - * Copyright (C) 2006 Inverse groupe conseil + * Copyright (C) 2006, 2008 Inverse groupe conseil * * Author: Wolfgang Sourdeau * @@ -24,6 +24,8 @@ #import #import +#import + #import "SOGoDAVRendererTypes.h" @implementation SOGoDAVSet diff --git a/SoObjects/SOGo/SOGoGCSFolder.m b/SoObjects/SOGo/SOGoGCSFolder.m index 3ff9e041..38a0c90d 100644 --- a/SoObjects/SOGo/SOGoGCSFolder.m +++ b/SoObjects/SOGo/SOGoGCSFolder.m @@ -41,6 +41,7 @@ #import #import #import +#import #import #import #import @@ -408,25 +409,22 @@ static BOOL sendFolderAdvisories = NO; #warning this code should be cleaned up #warning this code is a dup of UIxFolderActions,\ - we should remove the methods there instead -- (WOResponse *) _subscribe: (BOOL) reallyDo - inContext: (WOContext *) localContext + we should remove the methods there +- (void) _subscribeUser: (SOGoUser *) subscribingUser + reallyDo: (BOOL) reallyDo + inResponse: (WOResponse *) response { - WOResponse *response; NSMutableArray *folderSubscription; NSString *subscriptionPointer, *baseFolder, *folder; - SOGoUser *activeUser; NSUserDefaults *ud; NSArray *realFolderPath; NSMutableDictionary *moduleSettings; - activeUser = [localContext activeUser]; - ud = [activeUser userSettings]; + ud = [subscribingUser userSettings]; baseFolder = [container nameInContainer]; moduleSettings = [ud objectForKey: baseFolder]; - response = [localContext response]; - if ([owner isEqualToString: [activeUser login]]) + if ([owner isEqualToString: [subscribingUser login]]) { [response setStatus: 403]; [response appendContentString: @@ -461,18 +459,68 @@ static BOOL sendFolderAdvisories = NO; [response setStatus: 204]; } +} + +- (WOResponse *) _subscribe: (BOOL) reallyDo + inTheNameOf: (NSString *) delegatedUser + inContext: (WOContext *) localContext +{ + WOResponse *response; + SOGoUser *currentUser, *subscriptionUser; + BOOL validRequest; + + response = [localContext response]; + currentUser = [localContext activeUser]; + + if ([delegatedUser length]) + { + validRequest = ([currentUser isSuperUser]); + subscriptionUser = [SOGoUser userWithLogin: delegatedUser roles: nil]; + } + else + { + validRequest = YES; + subscriptionUser = currentUser; + } + + if (validRequest) + [self _subscribeUser: subscriptionUser + reallyDo: reallyDo + inResponse: response]; + else + { + [response setStatus: 403]; + [response appendContentString: + @"You cannot subscribe another user to any folder" + @" unless you are a super-user."]; + } return response; } -- (id ) davSubscribe: (WOContext *) localContext +- (NSString *) _parseDAVDelegatedUser: (WOContext *) queryContext +{ + id document; + id attrs; + + document = [[queryContext request] contentAsDOMDocument]; + attrs = [[document documentElement] attributes]; + + return [[attrs namedItem: @"user"] nodeValue]; +} + +- (id ) davSubscribe: (WOContext *) queryContext { - return [self _subscribe: YES inContext: localContext]; + return [self _subscribe: YES + inTheNameOf: [self _parseDAVDelegatedUser: queryContext] + inContext: queryContext]; } -- (id ) davUnsubscribe: (WOContext *) localContext +- (id ) davUnsubscribe: (WOContext *) queryContext { - return [self _subscribe: NO inContext: localContext]; + return [self _subscribe: NO + inTheNameOf: [self _parseDAVDelegatedUser: queryContext] + inContext: queryContext]; } - (NSException *) davSetProperties: (NSDictionary *) setProps