+2008-02-22 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * SoObjects/SOGo/SOGoUserFolder.m ([SOGoUserFolder
+ -davUserQuery:queryContext]): new method for the "user-query"
+ inverse DAV method.
+
+ * SoObjects/SOGo/SOGoGCSFolder.m ([SOGoGCSFolder
+ -aclUsersForObjectAtPath:objectPathArray]): return unique uids.
+
+ * SoObjects/SOGo/SOGoFolder.m ([-davNamespaces]): removed method.
+
+ * SoObjects/SOGo/SOGoDAVRendererTypes.h (SoWebDAVValue): added
+ SOGoDAVDictionary webdav value class.
+
+ * SoObjects/SOGo/NSArray+Utilities.m ([NSArray -uniqueObjects]):
+ new method that returns unique occurences of the objects.
+
+ * SoObjects/Contacts/SOGoContactGCSFolder.m ([SOGoContactGCSFolder
+ -davNamespaces]): same as below.
+
+ * SoObjects/Appointments/SOGoAppointmentFolder.m
+ ([SOGoAppointmentFolder -davNamespaces]): take the parents
+ namespaces into account.
+
+ * SoObjects/SOGo/SOGoObject.m ([SOGoObject -addUserInAcls:uid]):
+ new method.
+ ([SOGoObject -removeUserFromAcls:uid]): new methods (see below).
+ ([SOGoObject -davNamespaces]): declare the
+ "urn:inverse:params:xml:ns:inverse-dav" namespace.
+ ([SOGoObject -davRecordForUser:user])
+ ([SOGoObject -davAclQuery:queryContext]): new methods to answer to
+ the "user-list", "roles", "set-roles", "add-user", "remove-user"
+ inverse DAV methods.
+
+ * UI/Common/UIxObjectActions.m ([UIxObjectActions -addUserInAclsAction])
+ ([UIxObjectActions -removeUserFromAclsAction]): moved the core of
+ those methods into SOGoObject and translate its result into an
+ appropriate HTTP status.
+
+2008-02-20 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * SoObjects/SOGo/SOGoGCSFolder.m ([SOGoGCSFolder -davInverseACL]):
+ first implementation of a DAV interface to SOGo roles. Returns the
+ result in JSON.
+
2008-02-14 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* GNUmakefile: migrated to GNUstep Make 2.
-Index: sope-gdl1/PostgreSQL/PostgreSQL72Channel.m
-===================================================================
---- sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (révision 1603)
-+++ sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (copie de travail)
-@@ -713,6 +713,39 @@
- return ms;
- }
-
-+/* GCSEOAdaptorChannel protocol */
-+static NSString *sqlFolderFormat = (@"CREATE TABLE %@ (\n" \
-+ @" c_name VARCHAR (256) NOT NULL,\n"
-+ @" c_content VARCHAR (100000) NOT NULL,\n"
-+ @" c_creationdate INT4 NOT NULL,\n"
-+ @" c_lastmodified INT4 NOT NULL,\n"
-+ @" c_version INT4 NOT NULL,\n"
-+ @" c_deleted INT4 NULL\n"
-+ @")");
-+static NSString *sqlFolderACLFormat = (@"CREATE TABLE %@ (\n" \
-+ @" c_uid VARCHAR (256) NOT NULL,\n"
-+ @" c_object VARCHAR (256) NOT NULL,\n"
-+ @" c_role VARCHAR (80) NOT NULL\n"
-+ @")");
-+
-+- (NSException *) createGCSFolderTableWithName: (NSString *) tableName
-+{
-+ NSString *sql;
-+
-+ sql = [NSString stringWithFormat: sqlFolderFormat, tableName];
-+
-+ return [self evaluateExpressionX: sql];
-+}
-+
-+- (NSException *) createGCSFolderACLTableWithName: (NSString *) tableName
-+{
-+ NSString *sql;
-+
-+ sql = [NSString stringWithFormat: sqlFolderACLFormat, tableName];
-+
-+ return [self evaluateExpressionX: sql];
-+}
-+
- @end /* PostgreSQL72Channel */
-
- @implementation PostgreSQL72Channel(PrimaryKeyGeneration)
-Index: sope-gdl1/Oracle8/OracleAdaptorChannel.m
-===================================================================
---- sope-gdl1/Oracle8/OracleAdaptorChannel.m (révision 1603)
-+++ sope-gdl1/Oracle8/OracleAdaptorChannel.m (copie de travail)
-@@ -30,6 +30,7 @@
-
- #import <NGExtensions/NSObject+Logs.h>
-
-+static BOOL debugOn = NO;
- //
- //
- //
-@@ -41,10 +42,19 @@
-
- @implementation OracleAdaptorChannel (Private)
-
--- (void) _cleanup
-++ (void) initialize
- {
-+ NSUserDefaults *ud;
-+
-+ ud = [NSUserDefaults standardUserDefaults];
-+ debugOn = [ud boolForKey: @"OracleAdaptorDebug"];
-+}
-+
-+- (void) _cleanup
-+{
- column_info *info;
- int c;
-+ sword result;
-
- [_resultSetProperties removeAllObjects];
-
-@@ -58,11 +68,29 @@
- // so we just free the value instead.
- if (info->value)
- {
-- if (OCIDescriptorFree((dvoid *)info->value, (ub4)OCI_DTYPE_LOB) != OCI_SUCCESS)
-+ if (info->type == SQLT_CLOB
-+ || info->type == SQLT_BLOB
-+ || info->type == SQLT_BFILEE
-+ || info->type == SQLT_CFILEE)
-+ {
-+ result = OCIDescriptorFree((dvoid *)info->value, (ub4) OCI_DTYPE_LOB);
-+ if (result != OCI_SUCCESS)
-+ {
-+ NSLog (@"value was not a LOB descriptor");
-+ abort();
-+ }
-+ }
-+ else
- free(info->value);
- info->value = NULL;
- }
-- free(info);
-+ else
-+ {
-+ NSLog (@"trying to free an already freed value!");
-+ abort();
-+ }
-+ free(info);
-+
- [_row_buffer removeObjectAtIndex: c];
- }
-
-@@ -231,6 +259,9 @@
-
- [self _cleanup];
-
-+ if (debugOn)
-+ [self logWithFormat: @"expression: %@", theExpression];
-+
- if (!theExpression || ![theExpression length])
- {
- [NSException raise: @"OracleInvalidExpressionException"
-@@ -302,7 +333,9 @@
- // We read the maximum width of a column
- info->max_width = 0;
- status = OCIAttrGet((dvoid*)param, (ub4)OCI_DTYPE_PARAM, (dvoid*)&(info->max_width), (ub4 *)0, (ub4)OCI_ATTR_DATA_SIZE, (OCIError *)_oci_err);
--
-+
-+ if (debugOn)
-+ NSLog(@"name: %s, type: %d", cname, info->type);
- attribute = [EOAttribute attributeWithOracleType: info->type name: cname length: clen width: info->max_width];
- [_resultSetProperties addObject: attribute];
-
Index: sope-mime/NGImap4/NGImap4Connection.m
===================================================================
---- sope-mime/NGImap4/NGImap4Connection.m (révision 1603)
+--- sope-mime/NGImap4/NGImap4Connection.m (révision 1605)
+++ sope-mime/NGImap4/NGImap4Connection.m (copie de travail)
@@ -381,7 +381,7 @@
[self errorWithFormat:@"Could not list mailbox hierarchy!"];
Index: sope-mime/NGImap4/NGImap4ResponseNormalizer.m
===================================================================
---- sope-mime/NGImap4/NGImap4ResponseNormalizer.m (révision 1603)
+--- sope-mime/NGImap4/NGImap4ResponseNormalizer.m (révision 1605)
+++ sope-mime/NGImap4/NGImap4ResponseNormalizer.m (copie de travail)
@@ -648,14 +648,13 @@
enumerator = [_flags objectEnumerator];
if (objs) free(objs);
Index: sope-mime/NGImap4/NGImap4ResponseParser.m
===================================================================
---- sope-mime/NGImap4/NGImap4ResponseParser.m (révision 1603)
+--- sope-mime/NGImap4/NGImap4ResponseParser.m (révision 1605)
+++ sope-mime/NGImap4/NGImap4ResponseParser.m (copie de travail)
@@ -84,6 +84,8 @@
static NSDictionary *_parseMultipartBody(NGImap4ResponseParser *self,
{
Index: sope-mime/NGMail/NGSmtpClient.m
===================================================================
---- sope-mime/NGMail/NGSmtpClient.m (révision 1603)
+--- sope-mime/NGMail/NGSmtpClient.m (révision 1605)
+++ sope-mime/NGMail/NGSmtpClient.m (copie de travail)
@@ -24,6 +24,82 @@
#include "NGSmtpReplyCodes.h"
reply = [self receiveReply];
Index: sope-mime/NGMail/NGMimeMessageGenerator.m
===================================================================
---- sope-mime/NGMail/NGMimeMessageGenerator.m (révision 1603)
+--- sope-mime/NGMail/NGMimeMessageGenerator.m (révision 1605)
+++ sope-mime/NGMail/NGMimeMessageGenerator.m (copie de travail)
@@ -86,37 +86,40 @@
char *des = NULL;
unsigned isoEndLen = 2;
Index: sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m
===================================================================
---- sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m (révision 1603)
+--- sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m (révision 1605)
+++ sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m (copie de travail)
@@ -19,88 +19,45 @@
02111-1307, USA.
#if 0
Index: sope-mime/NGMime/NGMimeHeaderFieldGeneratorSet.m
===================================================================
---- sope-mime/NGMime/NGMimeHeaderFieldGeneratorSet.m (révision 1603)
+--- sope-mime/NGMime/NGMimeHeaderFieldGeneratorSet.m (révision 1605)
+++ sope-mime/NGMime/NGMimeHeaderFieldGeneratorSet.m (copie de travail)
@@ -77,6 +77,7 @@
[rfc822Set setGenerator:gen forField:@"bcc"];
Index: sope-mime/NGMime/NGMimeBodyPart.m
===================================================================
---- sope-mime/NGMime/NGMimeBodyPart.m (révision 1603)
+--- sope-mime/NGMime/NGMimeBodyPart.m (révision 1605)
+++ sope-mime/NGMime/NGMimeBodyPart.m (copie de travail)
@@ -31,18 +31,6 @@
return 2;
- (NSString *)contentId {
Index: sope-mime/NGMime/GNUmakefile.preamble
===================================================================
---- sope-mime/NGMime/GNUmakefile.preamble (révision 1603)
+--- sope-mime/NGMime/GNUmakefile.preamble (révision 1605)
+++ sope-mime/NGMime/GNUmakefile.preamble (copie de travail)
@@ -5,6 +5,11 @@
-DLIBRARY_MINOR_VERSION=${MINOR_VERSION} \
-I../../sope-core/NGStreams/ \
Index: sope-mime/NGMime/NGMimeBodyParser.m
===================================================================
---- sope-mime/NGMime/NGMimeBodyParser.m (révision 1603)
+--- sope-mime/NGMime/NGMimeBodyParser.m (révision 1605)
+++ sope-mime/NGMime/NGMimeBodyParser.m (copie de travail)
@@ -67,7 +67,10 @@
if (_data == nil) return nil;
Index: sope-mime/NGMime/NGMimePartParser.h
===================================================================
---- sope-mime/NGMime/NGMimePartParser.h (révision 1603)
+--- sope-mime/NGMime/NGMimePartParser.h (révision 1605)
+++ sope-mime/NGMime/NGMimePartParser.h (copie de travail)
@@ -117,6 +117,7 @@
BOOL parserParseRawBodyDataOfPart:1;
@interface NSObject(NGMimePartParser)
Index: sope-mime/NGMime/NGMimePartParser.m
===================================================================
---- sope-mime/NGMime/NGMimePartParser.m (révision 1603)
+--- sope-mime/NGMime/NGMimePartParser.m (révision 1605)
+++ sope-mime/NGMime/NGMimePartParser.m (copie de travail)
@@ -227,7 +227,7 @@
}
: [NGMimeType mimeType:[ctype stringValue]];
Index: sope-mime/NGMime/NGMimeAddressHeaderFieldGenerator.m
===================================================================
---- sope-mime/NGMime/NGMimeAddressHeaderFieldGenerator.m (révision 1603)
+--- sope-mime/NGMime/NGMimeAddressHeaderFieldGenerator.m (révision 1605)
+++ sope-mime/NGMime/NGMimeAddressHeaderFieldGenerator.m (copie de travail)
@@ -130,8 +130,13 @@
bufLen = [data length];
Index: sope-mime/NGMime/NGMimeContentDispositionHeaderFieldGenerator.m
===================================================================
---- sope-mime/NGMime/NGMimeContentDispositionHeaderFieldGenerator.m (révision 1603)
+--- sope-mime/NGMime/NGMimeContentDispositionHeaderFieldGenerator.m (révision 1605)
+++ sope-mime/NGMime/NGMimeContentDispositionHeaderFieldGenerator.m (copie de travail)
@@ -49,80 +49,70 @@
}
return data;
}
+Index: sope-gdl1/PostgreSQL/PostgreSQL72Channel.m
+===================================================================
+--- sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (révision 1605)
++++ sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (copie de travail)
+@@ -713,6 +713,39 @@
+ return ms;
+ }
+
++/* GCSEOAdaptorChannel protocol */
++static NSString *sqlFolderFormat = (@"CREATE TABLE %@ (\n" \
++ @" c_name VARCHAR (256) NOT NULL,\n"
++ @" c_content VARCHAR (100000) NOT NULL,\n"
++ @" c_creationdate INT4 NOT NULL,\n"
++ @" c_lastmodified INT4 NOT NULL,\n"
++ @" c_version INT4 NOT NULL,\n"
++ @" c_deleted INT4 NULL\n"
++ @")");
++static NSString *sqlFolderACLFormat = (@"CREATE TABLE %@ (\n" \
++ @" c_uid VARCHAR (256) NOT NULL,\n"
++ @" c_object VARCHAR (256) NOT NULL,\n"
++ @" c_role VARCHAR (80) NOT NULL\n"
++ @")");
++
++- (NSException *) createGCSFolderTableWithName: (NSString *) tableName
++{
++ NSString *sql;
++
++ sql = [NSString stringWithFormat: sqlFolderFormat, tableName];
++
++ return [self evaluateExpressionX: sql];
++}
++
++- (NSException *) createGCSFolderACLTableWithName: (NSString *) tableName
++{
++ NSString *sql;
++
++ sql = [NSString stringWithFormat: sqlFolderACLFormat, tableName];
++
++ return [self evaluateExpressionX: sql];
++}
++
+ @end /* PostgreSQL72Channel */
+
+ @implementation PostgreSQL72Channel(PrimaryKeyGeneration)
+Index: sope-gdl1/Oracle8/OracleAdaptorChannel.m
+===================================================================
+--- sope-gdl1/Oracle8/OracleAdaptorChannel.m (révision 1605)
++++ sope-gdl1/Oracle8/OracleAdaptorChannel.m (copie de travail)
+@@ -30,6 +30,7 @@
+
+ #import <NGExtensions/NSObject+Logs.h>
+
++static BOOL debugOn = NO;
+ //
+ //
+ //
+@@ -41,10 +42,19 @@
+
+ @implementation OracleAdaptorChannel (Private)
+
+-- (void) _cleanup
+++ (void) initialize
+ {
++ NSUserDefaults *ud;
++
++ ud = [NSUserDefaults standardUserDefaults];
++ debugOn = [ud boolForKey: @"OracleAdaptorDebug"];
++}
++
++- (void) _cleanup
++{
+ column_info *info;
+ int c;
++ sword result;
+
+ [_resultSetProperties removeAllObjects];
+
+@@ -58,11 +68,29 @@
+ // so we just free the value instead.
+ if (info->value)
+ {
+- if (OCIDescriptorFree((dvoid *)info->value, (ub4)OCI_DTYPE_LOB) != OCI_SUCCESS)
++ if (info->type == SQLT_CLOB
++ || info->type == SQLT_BLOB
++ || info->type == SQLT_BFILEE
++ || info->type == SQLT_CFILEE)
++ {
++ result = OCIDescriptorFree((dvoid *)info->value, (ub4) OCI_DTYPE_LOB);
++ if (result != OCI_SUCCESS)
++ {
++ NSLog (@"value was not a LOB descriptor");
++ abort();
++ }
++ }
++ else
+ free(info->value);
+ info->value = NULL;
+ }
+- free(info);
++ else
++ {
++ NSLog (@"trying to free an already freed value!");
++ abort();
++ }
++ free(info);
++
+ [_row_buffer removeObjectAtIndex: c];
+ }
+
+@@ -231,6 +259,9 @@
+
+ [self _cleanup];
+
++ if (debugOn)
++ [self logWithFormat: @"expression: %@", theExpression];
++
+ if (!theExpression || ![theExpression length])
+ {
+ [NSException raise: @"OracleInvalidExpressionException"
+@@ -302,7 +333,9 @@
+ // We read the maximum width of a column
+ info->max_width = 0;
+ status = OCIAttrGet((dvoid*)param, (ub4)OCI_DTYPE_PARAM, (dvoid*)&(info->max_width), (ub4 *)0, (ub4)OCI_ATTR_DATA_SIZE, (OCIError *)_oci_err);
+-
++
++ if (debugOn)
++ NSLog(@"name: %s, type: %d", cname, info->type);
+ attribute = [EOAttribute attributeWithOracleType: info->type name: cname length: clen width: info->max_width];
+ [_resultSetProperties addObject: attribute];
+
+Index: sope-gdl1/Oracle8/OracleAdaptorChannelController.m
+===================================================================
+--- sope-gdl1/Oracle8/OracleAdaptorChannelController.m (révision 1605)
++++ sope-gdl1/Oracle8/OracleAdaptorChannelController.m (copie de travail)
+@@ -31,6 +31,8 @@
+ #import <Foundation/Foundation.h>
+ #import <GDLAccess/EOSQLExpression.h>
+
++static BOOL debugOn = NO;
++
+ //
+ //
+ //
+@@ -48,6 +50,14 @@
+ //
+ @implementation OracleAdaptorChannelController
+
+++ (void) initialize
++{
++ NSUserDefaults *ud;
++
++ ud = [NSUserDefaults standardUserDefaults];
++ debugOn = [ud boolForKey: @"OracleAdaptorDebug"];
++}
++
+ - (EODelegateResponse) adaptorChannel: (id) theChannel
+ willInsertRow: (NSMutableDictionary *) theRow
+ forEntity: (EOEntity *) theEntity
+@@ -56,7 +66,8 @@
+ NSArray *keys;
+ int i, c;
+
+- NSLog(@"willInsertRow: %@ %@", [theRow description], [theEntity description]);
++ if (debugOn)
++ NSLog(@"willInsertRow: %@ %@", [theRow description], [theEntity description]);
+
+ s = AUTORELEASE([[NSMutableString alloc] init]);
+
+@@ -101,7 +112,8 @@
+ NSArray *keys;
+ int i, c;
+
+- NSLog(@"willUpdatetRow: %@ %@", [theRow description], [theQualifier description]);
++ if (debugOn)
++ NSLog(@"willUpdateRow: %@ %@", [theRow description], [theQualifier description]);
+
+ s = AUTORELEASE([[NSMutableString alloc] init]);
+
Index: sope-core/NGExtensions/FdExt.subproj/NSString+Encoding.m
===================================================================
---- sope-core/NGExtensions/FdExt.subproj/NSString+Encoding.m (révision 1603)
+--- sope-core/NGExtensions/FdExt.subproj/NSString+Encoding.m (révision 1605)
+++ sope-core/NGExtensions/FdExt.subproj/NSString+Encoding.m (copie de travail)
@@ -140,8 +140,12 @@
static char *iconv_wrapper(id self, char *_src, unsigned _srcLen,
Index: sope-core/NGExtensions/EOExt.subproj/EOGlobalID+Ext.m
===================================================================
---- sope-core/NGExtensions/EOExt.subproj/EOGlobalID+Ext.m (révision 1603)
+--- sope-core/NGExtensions/EOExt.subproj/EOGlobalID+Ext.m (révision 1605)
+++ sope-core/NGExtensions/EOExt.subproj/EOGlobalID+Ext.m (copie de travail)
@@ -19,6 +19,7 @@
02111-1307, USA.
Index: sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.h
===================================================================
---- sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.h (révision 1603)
+--- sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.h (révision 1605)
+++ sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.h (copie de travail)
@@ -19,6 +19,8 @@
02111-1307, USA.
id<NSObject,SaxEntityResolver> entityResolver;
Index: sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.m
===================================================================
---- sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.m (révision 1603)
+--- sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.m (révision 1605)
+++ sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.m (copie de travail)
@@ -30,6 +30,12 @@
#include <libxml/HTMLparser.h>
- (void)tearDownParser {
Index: sope-appserver/mod_ngobjweb/config.c
===================================================================
---- sope-appserver/mod_ngobjweb/config.c (révision 1603)
+--- sope-appserver/mod_ngobjweb/config.c (révision 1605)
+++ sope-appserver/mod_ngobjweb/config.c (copie de travail)
@@ -21,7 +21,7 @@
static char *_makeString(char *buf, char *str, int max) {
if (buf == NULL)
+Index: sope-appserver/mod_ngobjweb/NGBufferedDescriptor.c
+===================================================================
+--- sope-appserver/mod_ngobjweb/NGBufferedDescriptor.c (révision 1605)
++++ sope-appserver/mod_ngobjweb/NGBufferedDescriptor.c (copie de travail)
+@@ -23,6 +23,7 @@
+ #include <unistd.h>
+ #include <string.h>
+ #include <stdio.h>
++#include "common.h"
+ #include "NGBufferedDescriptor.h"
+
+ // returns the number of bytes which where read from the buffer
Index: sope-appserver/mod_ngobjweb/GNUmakefile
===================================================================
---- sope-appserver/mod_ngobjweb/GNUmakefile (révision 1603)
+--- sope-appserver/mod_ngobjweb/GNUmakefile (révision 1605)
+++ sope-appserver/mod_ngobjweb/GNUmakefile (copie de travail)
@@ -81,7 +81,7 @@
LDFLAGS = $(APXS_LDFLAGS) $(APR_LDFLAGS) -shared -fPIC
-Index: sope-appserver/mod_ngobjweb/NGBufferedDescriptor.c
-===================================================================
---- sope-appserver/mod_ngobjweb/NGBufferedDescriptor.c (révision 1603)
-+++ sope-appserver/mod_ngobjweb/NGBufferedDescriptor.c (copie de travail)
-@@ -23,6 +23,7 @@
- #include <unistd.h>
- #include <string.h>
- #include <stdio.h>
-+#include "common.h"
- #include "NGBufferedDescriptor.h"
-
- // returns the number of bytes which where read from the buffer
Index: sope-appserver/mod_ngobjweb/handler.c
===================================================================
---- sope-appserver/mod_ngobjweb/handler.c (révision 1603)
+--- sope-appserver/mod_ngobjweb/handler.c (révision 1605)
+++ sope-appserver/mod_ngobjweb/handler.c (copie de travail)
@@ -267,7 +267,7 @@
const char *uri;
static void test(void) {
Index: sope-appserver/NGObjWeb/GNUmakefile.postamble
===================================================================
---- sope-appserver/NGObjWeb/GNUmakefile.postamble (révision 1603)
+--- sope-appserver/NGObjWeb/GNUmakefile.postamble (révision 1605)
+++ sope-appserver/NGObjWeb/GNUmakefile.postamble (copie de travail)
@@ -23,14 +23,20 @@
-endif
Index: sope-appserver/NGObjWeb/WOContext.m
===================================================================
---- sope-appserver/NGObjWeb/WOContext.m (révision 1603)
+--- sope-appserver/NGObjWeb/WOContext.m (révision 1605)
+++ sope-appserver/NGObjWeb/WOContext.m (copie de travail)
@@ -64,11 +64,13 @@
static BOOL testNSURLs = NO;
serverURL = [@"http://" stringByAppendingString:host];
Index: sope-appserver/NGObjWeb/DAVPropMap.plist
===================================================================
---- sope-appserver/NGObjWeb/DAVPropMap.plist (révision 1603)
+--- sope-appserver/NGObjWeb/DAVPropMap.plist (révision 1605)
+++ sope-appserver/NGObjWeb/DAVPropMap.plist (copie de travail)
-@@ -123,11 +123,14 @@
+@@ -123,11 +123,18 @@
/* CalDAV */
"{urn:ietf:params:xml:ns:caldav}calendar-home-set" = davCalendarHomeSet;
+ "{http://calendarserver.org/ns/}notifications-URL" =
davNotificationsURL;
"{com.apple.ical:}calendarcolor" = davCalendarColor;
++
++ /* Inverse DAV Extensions */
++ "{urn:ietf:params:xml:ns:inverse-dav:}acl" =
++ davInverseACL;
}
Index: sope-appserver/NGObjWeb/WebDAV/SaxDAVHandler.m
===================================================================
---- sope-appserver/NGObjWeb/WebDAV/SaxDAVHandler.m (révision 1603)
+--- sope-appserver/NGObjWeb/WebDAV/SaxDAVHandler.m (révision 1605)
+++ sope-appserver/NGObjWeb/WebDAV/SaxDAVHandler.m (copie de travail)
@@ -655,6 +655,7 @@
if (self->responses == nil)
case 'n':
Index: sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m
===================================================================
---- sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m (révision 1603)
+--- sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m (révision 1605)
+++ sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m (copie de travail)
@@ -216,6 +216,12 @@
assocCount++;
Index: sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m
===================================================================
---- sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m (révision 1603)
+--- sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m (révision 1605)
+++ sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m (copie de travail)
@@ -41,6 +41,7 @@
WOAssociation *string;
return NO;
Index: sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h
===================================================================
---- sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h (révision 1603)
+--- sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h (révision 1605)
+++ sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h (copie de travail)
@@ -41,7 +41,8 @@
WOAssociation *pageName;
/* 'ivar' associations */
Index: sope-appserver/NGObjWeb/SoObjects/SoObject.m
===================================================================
---- sope-appserver/NGObjWeb/SoObjects/SoObject.m (révision 1603)
+--- sope-appserver/NGObjWeb/SoObjects/SoObject.m (révision 1605)
+++ sope-appserver/NGObjWeb/SoObjects/SoObject.m (copie de travail)
@@ -39,22 +39,34 @@
static int debugLookup = -1;
Index: sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m
===================================================================
---- sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m (révision 1603)
+--- sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m (révision 1605)
+++ sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m (copie de travail)
@@ -31,6 +31,7 @@
#include <NGObjWeb/WOCookie.h>
- (NSArray *) davNamespaces
{
- return [NSArray arrayWithObject: @"urn:ietf:params:xml:ns:caldav"];
+ NSMutableArray *ns;
+
+ ns = [NSMutableArray arrayWithArray: [super davNamespaces]];
+ [ns addObjectUniquely: @"urn:ietf:params:xml:ns:caldav"];
+
+ return ns;
}
- (id) davCalendarQuery: (id) queryContext
- (NSArray *) davNamespaces
{
- return [NSArray arrayWithObject: @"urn:ietf:params:xml:ns:carddav"];
+ NSMutableArray *ns;
+
+ ns = [NSMutableArray arrayWithArray: [super davNamespaces]];
+ [ns addObjectUniquely: @"urn:ietf:params:xml:ns:carddav"];
+
+ return ns;
}
- (NSString *) groupDavResourceType
- (NSArray *) objectsForKey: (NSString *) key;
- (NSArray *) flattenedArray;
+- (NSArray *) uniqueObjects;
+
- (BOOL) containsCaseInsensitiveString: (NSString *) match;
#ifdef GNUSTEP_BASE_LIBRARY
return flattenedArray;
}
+- (NSArray *) uniqueObjects
+{
+ NSMutableArray *newArray;
+ NSEnumerator *objects;
+ id currentObject;
+
+ newArray = [NSMutableArray array];
+
+ objects = [self objectEnumerator];
+ while ((currentObject = [objects nextObject]))
+ [newArray addObjectUniquely: currentObject];
+
+ return newArray;
+}
+
- (void) makeObjectsPerform: (SEL) selector
withObject: (id) object1
withObject: (id) object2
#import <NGObjWeb/SoWebDAVValue.h>
@class NSArray;
+@class NSDictionary;
@class NSString;
@interface SOGoDAVSet : SoWebDAVValue
@end
+@interface SOGoDAVDictionary : SoWebDAVValue
+{
+ NSString *valueTag;
+ NSDictionary *values;
+}
+
++ (id) davDictionary: (NSDictionary *) newValues
+ taggedAs: (NSString *) newValueTag;
+
+- (void) setValueTag: (NSString *) newValueTag;
+- (void) setValues: (NSDictionary *) newValues;
+
+@end
+
#endif /* SOGODAVRENDERERTYPES_H */
- (void) dealloc
{
- if (valueTag)
- [valueTag release];
- if (values)
- [values release];
+ [valueTag release];
+ [values release];
[super dealloc];
}
resultString = [NSMutableString new];
[resultString autorelease];
- [resultString appendFormat: @"<%@>", setTag];
+// [resultString appendFormat: @"<%@>", setTag];
valueEnum = [values objectEnumerator];
- currentValue = [valueEnum nextObject];
- while (currentValue)
+ while ((currentValue = [valueEnum nextObject]))
{
if ([currentValue isKindOfClass: [SoWebDAVValue class]])
valueString
inContext: context
prefixes: prefixes];
else
- valueString = currentValue;
+ valueString = [[currentValue description] stringByEscapingXMLString];
- [resultString appendFormat: @"<%@>%@</%@>",
- valueTag, valueString, valueTag];
- currentValue = [valueEnum nextObject];
+ [resultString appendFormat: valueString];
+// [resultString appendFormat: @"<%@>%@</%@>",
+// valueTag, valueString, valueTag];
}
- [resultString appendFormat: @"</%@>", setTag];
+// [resultString appendFormat: @"</%@>", setTag];
NSLog(@"dav rendering for key '%@' and tag '%@':\n", _key, setTag,
resultString);
return resultString;
}
+- (NSString *) stringValue
+{
+ return [self stringForTag: valueTag rawName: valueTag
+ inContext: nil prefixes: nil];
+}
+
+@end
+
+@implementation SOGoDAVDictionary
+
++ (id) davDictionary: (NSDictionary *) newValues
+ taggedAs: (NSString *) newValueTag;
+{
+ SOGoDAVDictionary *davDictionary;
+
+ davDictionary = [self new];
+ [davDictionary setValueTag: newValueTag];
+ [davDictionary setValues: newValues];
+ [davDictionary autorelease];
+
+ return davDictionary;
+}
+
+- (id) init
+{
+ if ((self = [super init]))
+ {
+ valueTag = nil;
+ values = nil;
+ }
+
+ return self;
+}
+
+- (void) dealloc
+{
+ [valueTag release];
+ [values release];
+ [super dealloc];
+}
+
+- (void) setValueTag: (NSString *) newValueTag
+{
+ ASSIGN (valueTag, newValueTag);
+}
+
+- (void) setValues: (NSDictionary *) newValues
+{
+ ASSIGN (values, newValues);
+}
+
+- (NSString *) stringForTag: (NSString *) _key
+ rawName: (NSString *) setTag
+ inContext: (id) context
+ prefixes: (NSDictionary *) prefixes
+{
+ NSMutableString *resultString;
+ id currentValue;
+ NSEnumerator *objects;
+ NSString *currentKey, *valueString;
+
+ resultString = [NSMutableString string];
+
+ [resultString appendFormat: @"<%@>", valueTag];
+ objects = [[values allKeys] objectEnumerator];
+ while ((currentKey = [objects nextObject]))
+ {
+ currentValue = [values objectForKey: currentKey];
+ if ([currentValue isKindOfClass: [SoWebDAVValue class]])
+ valueString
+ = [currentValue stringForTag:
+ [NSString stringWithFormat: @"{DAV:}%@", valueTag]
+ rawName: [NSString stringWithFormat: @"D:%@", valueTag]
+ inContext: context
+ prefixes: prefixes];
+ else
+ valueString = [[currentValue description] stringByEscapingXMLString];
+
+ [resultString appendFormat: @"<%@>%@</%@>", currentKey, valueString, currentKey];
+ }
+ [resultString appendFormat: @"</%@>", valueTag];
+
+ return resultString;
+}
+
@end
- (NSComparisonResult) compare: (id) otherFolder;
/* dav */
-- (NSArray *) davNamespaces;
- (NSArray *) davResourceType;
/* outlook */
/* WebDAV */
-- (NSArray *) davNamespaces
-{
- return nil;
-}
-
- (BOOL) davIsCollection
{
return [self isFolderish];
{
return [NSArray arrayWithObjects: SoRole_Owner, SOGoRole_ObjectViewer,
SOGoRole_ObjectEditor, SOGoRole_ObjectCreator,
- SOGoRole_ObjectEraser, nil];
+ SOGoRole_ObjectEraser, nil];
}
- (NSArray *) aclsForUser: (NSString *) uid
-/*
- Copyright (C) 2004-2005 SKYRIX Software AG
-
- This file is part of OpenGroupware.org.
-
- OGo is free software; you can redistribute it and/or modify it under
- the terms of the GNU Lesser General Public License as published by the
- Free Software Foundation; either version 2, or (at your option) any
- later version.
-
- OGo is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with OGo; see the file COPYING. If not, write to the
- Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA.
-*/
+/* SOGoGCSFolder.m - this file is part of SOGo
+ *
+ * Copyright (C) 2004-2005 SKYRIX Software AG
+ * Copyright (C) 2006-2008 Inverse groupe conseil
+ *
+ * Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#import <NGObjWeb/SoWebDAVValue.h>
+#import "SOGoDAVRendererTypes.h"
#import <Foundation/NSArray.h>
#import <Foundation/NSDate.h>
#import <NGObjWeb/WOContext+SoObjects.h>
#import <NGObjWeb/WOApplication.h>
#import <NGObjWeb/WOResponse.h>
+#import <NGExtensions/NSString+misc.h>
#import <NGExtensions/NSNull+misc.h>
#import <NGExtensions/NSObject+Logs.h>
#import <EOControl/EOQualifier.h>
{
EOQualifier *qualifier;
NSString *qs;
- NSArray *records;
+ NSArray *records, *uids;
qs = [NSString stringWithFormat: @"c_object = '/%@'",
[objectPathArray componentsJoinedByString: @"/"]];
qualifier = [EOQualifier qualifierWithQualifierFormat: qs];
records = [[self ocsFolder] fetchAclMatchingQualifier: qualifier];
+ uids = [[records valueForKey: @"c_uid"] uniqueObjects];
- return [records valueForKey: @"c_uid"];
+ return uids;
}
- (NSArray *) _fetchAclsForUser: (NSString *) uid
if ([records count] > 0)
[acls addObjectsFromArray: [records valueForKey: @"c_role"]];
- return acls;
+ return [acls uniqueObjects];
}
- (void) _cacheRoles: (NSArray *) roles
- (NSArray *) subscriptionRoles;
+- (BOOL) addUserInAcls: (NSString *) uid;
+- (BOOL) removeUserFromAcls: (NSString *) uid;
+
- (NSArray *) aclUsers;
- (NSArray *) aclsForUser: (NSString *) uid;
- (void) setRoles: (NSArray *) roles
- (NSString *) httpURLForAdvisoryToUser: (NSString *) uid;
- (NSString *) resourceURLForAdvisoryToUser: (NSString *) uid;
+/* dav */
+- (NSArray *) davNamespaces;
+- (NSString *) davRecordForUser: (NSString *) user;
+
/* description */
- (void) appendAttributesToDescription:(NSMutableString *)_ms;
#import <NGObjWeb/NSException+HTTP.h>
#import <NGExtensions/NSObject+Logs.h>
#import <NGExtensions/NSString+misc.h>
+#import <DOM/DOMDocument.h>
+#import <DOM/DOMNode.h>
#import <DOM/DOMProtocols.h>
#import <NGCards/NSDictionary+NGCards.h>
#import <UI/SOGoUI/SOGoACLAdvisory.h>
-#import "SOGoPermissions.h"
-#import "SOGoUser.h"
-#import "SOGoDAVAuthenticator.h"
-#import "SOGoUserFolder.h"
-
-#import "SOGoDAVRendererTypes.h"
-
+#import "LDAPUserManager.h"
#import "NSArray+Utilities.h"
#import "NSCalendarDate+SOGo.h"
#import "NSDictionary+Utilities.h"
#import "NSString+Utilities.h"
-
#import "SOGoCache.h"
+#import "SOGoDAVAuthenticator.h"
+#import "SOGoDAVRendererTypes.h"
+#import "SOGoPermissions.h"
+#import "SOGoUser.h"
+#import "SOGoUserFolder.h"
+
#import "SOGoObject.h"
+static BOOL kontactGroupDAV = YES;
+static BOOL sendACLAdvisories = NO;
+
@interface SOGoObject(Content)
-- (NSString *)contentAsString;
+- (NSString *) contentAsString;
@end
@interface SoClassSecurityInfo (SOGoAcls)
@implementation SOGoObject
-static BOOL kontactGroupDAV = YES;
-
-+ (int)version {
- return 0;
-}
-
+ (void) initialize
{
- NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
+ NSUserDefaults *ud;
- kontactGroupDAV =
- [ud boolForKey:@"SOGoDisableKontact34GroupDAVHack"] ? NO : YES;
+ ud = [NSUserDefaults standardUserDefaults];
+ kontactGroupDAV = ![ud boolForKey:@"SOGoDisableKontact34GroupDAVHack"];
+ sendACLAdvisories = [ud boolForKey: @"SOGoACLsSendEMailNotifications"];
// SoClass security declarations
float f;
if (pid == 0)
- { /* break if we fork ;-) */
+ {
pid = getpid();
rndm = random();
}
return [container subscriptionRoles];
}
+- (BOOL) addUserInAcls: (NSString *) uid
+{
+ BOOL result;
+
+ if ([uid length]
+ && ![uid isEqualToString: [self ownerInContext: nil]]
+ && [[LDAPUserManager sharedUserManager]
+ contactInfosForUserWithUIDorEmail: uid])
+ {
+ [self setRoles: [self aclsForUser: uid]
+ forUser: uid];
+ if (sendACLAdvisories)
+ [self sendACLAdditionAdvisoryToUser: uid];
+ result = YES;
+ }
+ else
+ result = NO;
+
+ return result;
+}
+
+- (BOOL) removeUserFromAcls: (NSString *) uid
+{
+ BOOL result;
+
+ if ([uid length])
+ {
+ [self removeAclsForUsers: [NSArray arrayWithObject: uid]];
+ if (sendACLAdvisories)
+ [self sendACLRemovalAdvisoryToUser: uid];
+ result = YES;
+ }
+ else
+ result = NO;
+
+ return result;
+}
+
- (NSArray *) aclUsers
{
[self subclassResponsibility: _cmd];
return newClasses;
}
+/* dav acls */
+- (NSArray *) davNamespaces
+{
+ return [NSArray arrayWithObject:
+ @"urn:inverse:params:xml:ns:inverse-dav"];
+}
+
+- (NSString *) davRecordForUser: (NSString *) user
+{
+ NSMutableString *userRecord;
+ SOGoUser *sogoUser;
+ NSString *cn, *email;
+
+ userRecord = [NSMutableString string];
+
+ [userRecord appendFormat: @"<id>%@</id>",
+ [user stringByEscapingXMLString]];
+ sogoUser = [SOGoUser userWithLogin: user roles: nil];
+ cn = [sogoUser cn];
+ if (!cn)
+ cn = user;
+ [userRecord appendFormat: @"<displayName>%@</displayName>",
+ [cn stringByEscapingXMLString]];
+ email = [[sogoUser allEmails] objectAtIndex: 0];
+ if (email)
+ [userRecord appendFormat: @"<email>%@</email>",
+ [email stringByEscapingXMLString]];
+
+ return userRecord;
+}
+
+- (NSString *) _davAclUserListQuery
+{
+ NSMutableString *userList;
+ NSString *defaultUserID, *currentUserID;
+ NSEnumerator *users;
+
+ userList = [NSMutableString string];
+
+ defaultUserID = [self defaultUserID];
+ if ([defaultUserID length])
+ [userList appendFormat: @"<default-user><id>%@</id></default-user>",
+ [defaultUserID stringByEscapingXMLString]];
+ users = [[self aclUsers] objectEnumerator];
+ while ((currentUserID = [users nextObject]))
+ if (![currentUserID isEqualToString: defaultUserID])
+ [userList appendFormat: @"<user>%@</user>",
+ [self davRecordForUser: currentUserID]];
+
+ return userList;
+}
+
+- (NSString *) _davAclUserRoles: (NSString *) userName
+{
+ NSArray *roles;
+
+ roles = [[self aclsForUser: userName] stringsWithFormat: @"<%@/>"];
+
+ return [roles componentsJoinedByString: @""];
+}
+
+- (NSArray *) _davGetRolesFromRequest: (id <DOMNode>) node
+{
+ NSMutableArray *roles;
+ id <DOMNodeList> childNodes;
+ NSString *currentRole;
+ unsigned int count, max;
+
+ roles = [NSMutableArray array];
+ childNodes = [node childNodes];
+ max = [childNodes length];
+ for (count = 0; count < max; count++)
+ {
+ currentRole = [[childNodes objectAtIndex: count] nodeName];
+ [roles addObject: currentRole];
+ }
+
+ return roles;
+}
+
+- (NSString *) _davAclActionFromQuery: (id <DOMDocument>) document
+{
+ id <DOMNode> node, userAttr;
+ id <DOMNamedNodeMap> attrs;
+ NSString *nodeName, *result, *response, *user;
+
+ node = [[document documentElement] firstChild];
+ nodeName = [node nodeName];
+ if ([nodeName isEqualToString: @"user-list"])
+ result = [self _davAclUserListQuery];
+ else if ([nodeName isEqualToString: @"roles"])
+ {
+ attrs = [node attributes];
+ userAttr = [attrs namedItem: @"user"];
+ user = [userAttr nodeValue];
+ if ([user length])
+ result = [self _davAclUserRoles: user];
+ else
+ result = nil;
+ }
+ else if ([nodeName isEqualToString: @"set-roles"])
+ {
+ attrs = [node attributes];
+ userAttr = [attrs namedItem: @"user"];
+ user = [userAttr nodeValue];
+ if ([user length])
+ {
+ [self setRoles: [self _davGetRolesFromRequest: node]
+ forUser: user];
+ result = @"";
+ }
+ else
+ result = nil;
+ }
+ else if ([nodeName isEqualToString: @"add-user"])
+ {
+ attrs = [node attributes];
+ userAttr = [attrs namedItem: @"user"];
+ user = [userAttr nodeValue];
+ if ([self addUserInAcls: user])
+ result = @"";
+ else
+ result = nil;
+ }
+ else if ([nodeName isEqualToString: @"remove-user"])
+ {
+ attrs = [node attributes];
+ userAttr = [attrs namedItem: @"user"];
+ user = [userAttr nodeValue];
+ if ([self removeUserFromAcls: user])
+ result = @"";
+ else
+ result = nil;
+ }
+ else
+ result = nil;
+
+ if (result)
+ {
+ if ([result length])
+ response = [NSString stringWithFormat: @"<%@>%@</%@>",
+ nodeName, result, nodeName];
+ else
+ response = @"";
+ }
+ else
+ response = nil;
+
+ return response;
+}
+
+- (id) davAclQuery: (WOContext *) queryContext
+{
+ WOResponse *r;
+ id <DOMDocument> document;
+ NSString *content;
+
+ r = [queryContext response];
+ [r setContentEncoding: NSUTF8StringEncoding];
+ [r setHeader: @"text/xml; charset=\"utf-8\"" forKey: @"content-type"];
+ [r setHeader: @"no-cache" forKey: @"pragma"];
+ [r setHeader: @"no-cache" forKey: @"cache-control"];
+
+ document = [[context request] contentAsDOMDocument];
+ content = [self _davAclActionFromQuery: document];
+ if (content)
+ {
+ [r setStatus: 207];
+ if ([content length])
+ {
+ [r appendContentString: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n"];
+ [r appendContentString: content];
+ }
+ }
+ else
+ [r setStatus: 400];
+
+ return r;
+}
+
@end /* SOGoObject */
#import <Contacts/SOGoContactFolders.h>
#import <Mailer/SOGoMailAccounts.h>
+#import "NSArray+Utilities.h"
#import "NSDictionary+Utilities.h"
#import "LDAPUserManager.h"
#import "SOGoPermissions.h"
return self;
}
-- (NSArray *) davNamespaces
-{
- return [NSArray arrayWithObject: @"urn:inverse:params:xml:ns:inverse-dav"];
-}
-
- (NSDictionary *) _parseCollectionFilters: (id <DOMDocument>) parentNode
{
NSEnumerator *children;
NGDOMNode *node;
NSMutableDictionary *filter;
NSString *componentName;
-
+
filter = [NSMutableDictionary dictionaryWithCapacity: 2];
children = [[parentNode getElementsByTagName: @"prop-match"]
objectEnumerator];
}
}
-- (id) davCollectionQuery: (id) queryContext
+- (id) davCollectionQuery: (WOContext *) queryContext
{
WOResponse *r;
NSDictionary *filter;
return r;
}
+- (NSString *) _davFetchUsersMatching: (NSString *) user
+{
+ LDAPUserManager *um;
+ NSEnumerator *users;
+ NSMutableString *fetch;
+ NSDictionary *currentUser;
+ NSString *field;
+
+ fetch = [NSMutableString string];
+ um = [LDAPUserManager sharedUserManager];
+ users = [[um fetchContactsMatching: user] objectEnumerator];
+ while ((currentUser = [users nextObject]))
+ {
+ [fetch appendString: @"<user>"];
+ field = [currentUser objectForKey: @"c_uid"];
+ [fetch appendFormat: @"<id>%@</id>",
+ [field stringByEscapingXMLString]];
+ field = [currentUser objectForKey: @"cn"];
+ [fetch appendFormat: @"<displayName>%@</displayName>",
+ [field stringByEscapingXMLString]];
+ field = [currentUser objectForKey: @"c_email"];
+ [fetch appendFormat: @"<email>%@</email>",
+ [field stringByEscapingXMLString]];
+ [fetch appendString: @"</user>"];
+ }
+
+ return fetch;
+}
+
+- (NSString *) _davUsersFromQuery: (id <DOMDocument>) document
+{
+ id <DOMNode> node, userAttr;
+ id <DOMNamedNodeMap> attrs;
+ NSString *nodeName, *result, *response, *user;
+
+ node = [[document documentElement] firstChild];
+ nodeName = [node nodeName];
+ if ([nodeName isEqualToString: @"users"])
+ {
+ attrs = [node attributes];
+ userAttr = [attrs namedItem: @"match-name"];
+ user = [userAttr nodeValue];
+ if ([user length])
+ result = [self _davFetchUsersMatching: user];
+ else
+ result = nil;
+ }
+ else
+ result = nil;
+
+ if (result)
+ {
+ if ([result length])
+ response = [NSString stringWithFormat: @"<%@>%@</%@>",
+ nodeName, result, nodeName];
+ else
+ response = @"";
+ }
+ else
+ response = nil;
+
+ return response;
+}
+
+- (id) davUserQuery: (WOContext *) queryContext
+{
+ WOResponse *r;
+ id <DOMDocument> document;
+ NSString *content;
+
+ r = [queryContext response];
+ [r setContentEncoding: NSUTF8StringEncoding];
+ [r setHeader: @"text/xml; charset=\"utf-8\"" forKey: @"content-type"];
+ [r setHeader: @"no-cache" forKey: @"pragma"];
+ [r setHeader: @"no-cache" forKey: @"cache-control"];
+
+ document = [[context request] contentAsDOMDocument];
+ content = [self _davUsersFromQuery: document];
+ if (content)
+ {
+ [r setStatus: 207];
+ if ([content length])
+ {
+ [r appendContentString: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n"];
+ [r appendContentString: content];
+ }
+ }
+ else
+ [r setStatus: 400];
+
+ return r;
+}
+
// - (SOGoGroupsFolder *) lookupGroupsFolder
// {
// return [self lookupName: @"Groups" inContext: nil acquire: NO];
#import "UIxObjectActions.h"
-static BOOL sendACLAdvisories = NO;
-
@implementation UIxObjectActions
-+ (void) initialize
-{
- NSUserDefaults *ud;
-
- ud = [NSUserDefaults standardUserDefaults];
- sendACLAdvisories = [ud boolForKey: @"SOGoACLsSendEMailNotifications"];
-}
-
- (WOResponse *) addUserInAclsAction
{
WOResponse *response;
- WORequest *request;
NSString *uid;
unsigned int code;
- LDAPUserManager *um;
- SOGoObject *clientObject;
- code = 403;
- request = [context request];
- uid = [request formValueForKey: @"uid"];
- if ([uid length] > 0)
- {
- um = [LDAPUserManager sharedUserManager];
- if ([um contactInfosForUserWithUIDorEmail: uid])
- {
- clientObject = [self clientObject];
- [clientObject setRoles: [clientObject aclsForUser: uid]
- forUser: uid];
- if (sendACLAdvisories)
- [clientObject sendACLAdditionAdvisoryToUser: uid];
- code = 204;
- }
- }
+ uid = [[context request] formValueForKey: @"uid"];
+ if ([[self clientObject] addUserInAcls: uid])
+ code = 204;
+ else
+ code = 403;
response = [context response];
[response setStatus: code];
- (WOResponse *) removeUserFromAclsAction
{
WOResponse *response;
- WORequest *request;
NSString *uid;
unsigned int code;
- LDAPUserManager *um;
- SOGoObject *co;
- code = 403;
- request = [context request];
- uid = [request formValueForKey: @"uid"];
- if ([uid length] > 0)
- {
- um = [LDAPUserManager sharedUserManager];
- if ([um contactInfosForUserWithUIDorEmail: uid])
- {
- co = [self clientObject];
- [co removeAclsForUsers: [NSArray arrayWithObject: uid]];
- if (sendACLAdvisories)
- [co sendACLRemovalAdvisoryToUser: uid];
- code = 204;
- }
- }
+ uid = [[context request] formValueForKey: @"uid"];
+ if ([[self clientObject] removeUserFromAcls: uid])
+ code = 204;
+ else
+ code = 403;
response = [context response];
[response setStatus: code];
cfgwrite ""
cfgwrite "# GNUstep environment variables:";
+ cfgwrite "GNUSTEP_INSTALLATION_DOMAIN=LOCAL"
for i in `env | grep GNUSTEP_ | sort`; do
MAKE_ASSI="`echo $i | sed s/=/:=/`"
cfgwrite "${MAKE_ASSI}";