+2007-02-16 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * SoObjects/SOGo/SOGoUser.m ([SOGoUser
+ -rolesForObject:objectinContext:context]): test for
+ "rolesOfUser:inContext:" in addition to "roleOfUser:...".
+
+ * SoObjects/Appointments/SOGoCalendarComponent.m
+ ([SOGoCalendarComponent -rolesOfUser:logininContext:context]):
+ returns the roles of the user on the container object if the event
+ is uncreated.
+
2007-02-15 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/MailPartViewers/UIxMailRenderingContext.m: returns the
DB_USER="sogo"
DB_PASS="sogo"
-DB_HOST="127.0.0.1"
+DB_HOST="192.168.0.4"
DB_PORT="5432"
DB_NAME="sogo"
TIMEZONE="Canada/Eastern"
= [self objectClassForResourceNamed: currentId];
deleteObject = [objectClass objectWithName: currentId
inContainer: self];
- if ([currentUser isEqualToString: [deleteObject ownerInContext: nil]])
- {
- [deleteObject delete];
- [deleteObject primaryDelete];
- }
+ [deleteObject delete];
+ [deleteObject primaryDelete];
}
}
}
@end /* SOGoAppointmentObject */
-
-
-
#import <SOGo/AgenorUserManager.h>
#import <SOGo/SOGoPermissions.h>
+#import <SOGo/SOGoUser.h>
#import "common.h"
}
}
-- (NSString *) roleOfUser: (NSString *) login
+- (NSArray *) rolesOfUser: (NSString *) login
inContext: (WOContext *) context
{
AgenorUserManager *um;
iCalRepeatableEntityObject *component;
- NSString *role, *email;
+ NSMutableArray *sogoRoles;
+ NSString *email;
+ SOGoUser *user;
+
+ sogoRoles = [NSMutableArray new];
+ [sogoRoles autorelease];
um = [AgenorUserManager sharedUserManager];
email = [um getEmailForUID: login];
component = [self component];
- if ([component isOrganizer: email])
- role = SOGoRole_Organizer;
- else if ([component isParticipant: email])
- role = SOGoRole_Participant;
- else if ([[[self container] ownerInContext: nil] isEqualToString: login])
- role = SoRole_Owner;
+ if (component)
+ {
+ if ([component isOrganizer: email])
+ [sogoRoles addObject: SOGoRole_Organizer];
+ else if ([component isParticipant: email])
+ [sogoRoles addObject: SOGoRole_Participant];
+ else if ([[container ownerInContext: nil] isEqualToString: login])
+ [sogoRoles addObject: SoRole_Owner];
+ }
else
- role = nil;
+ {
+ user = [[SOGoUser alloc] initWithLogin: login roles: nil];
+ [sogoRoles addObjectsFromArray: [user rolesForObject: container
+ inContext: context]];
+ [user release];
+ }
- return role;
+ return sogoRoles;
}
@end
"View" = ( "Owner", "Delegate", "Assistant" );
"FreeBusyLookup" = ( "Owner", "Delegate", "Assistant", "FreeBusy" );
"Add Documents, Images, and Files" = ( "Owner", "Delegate" );
+ "Access Contents Information" = ( "Owner", "Delegate", "Assistant" );
};
};
defaultRoles = {
"View" = ( "Owner", "Delegate", "Organizer", "Authenticated" );
"Change Images and Files" = ( "Owner", "Delegate", "Organizer" );
+ "Access Contents Information" = ( "Owner", "Delegate", "Assistant" );
};
};
SOGoTaskObject = {
defaultRoles = {
"View" = ( "Owner", "Delegate", "Organizer", "Authenticated" );
"Change Images and Files" = ( "Owner", "Delegate", "Organizer" );
+ "Access Contents Information" = ( "Owner", "Delegate", "Assistant" );
};
};
SOGoFreeBusyObject = {
SOGoContactGCSFolder = {
superclass = "SOGoFolder";
+ defaultRoles = {
+ "PUT" = ( "Owner", "Delegate" );
+ "Add Documents, Images, and Files" = ( "Owner", "Delegate" );
+ };
};
SOGoContactGCSEntry = {
superclass = "SOGoContentObject";
defaultRoles = {
"View" = ( "Owner", "Delegate", "Organizer", "Authenticated" );
+ "PUT" = ( "Owner", "Delegate" );
+ "Add Documents, Images, and Files" = ( "Owner", "Delegate" );
};
};
_type = [_type lowercaseString];
_subtype = [_subtype lowercaseString];
- if ([_type isEqualToString:@"text"]) {
- if ([_subtype isEqualToString:@"plain"]
- || [_subtype isEqualToString:@"html"])
- return YES;
-
- if ([_subtype isEqualToString:@"calendar"]) /* we also fetch calendars */
- return YES;
- }
-
- if ([_type isEqualToString:@"application"]) {
- if ([_subtype isEqualToString:@"pgp-signature"])
- return YES;
- if ([_subtype hasPrefix:@"x-vnd.kolab."])
- return YES;
- }
-
- return NO;
+ return (([_type isEqualToString:@"text"]
+ && ([_subtype isEqualToString:@"plain"]
+ || [_subtype isEqualToString:@"html"]
+ || [_subtype isEqualToString:@"calendar"]))
+ || ([_type isEqualToString:@"application"]
+ && ([_subtype isEqualToString:@"pgp-signature"]
+ || [_subtype hasPrefix:@"x-vnd.kolab."])));
}
- (void)addRequiredKeysOfStructure:(id)_info path:(NSString *)_p
In case b) or c) fails, we can't do anything because IMAP4 doesn't tell us
the ID used in the trash folder.
*/
- SOGoMailFolder *destFolder;
+ SOGoMailAccounts *destFolder;
NSEnumerator *folders;
NSString *currentFolderName, *reason;
NSException *error;
02111-1307, USA.
*/
-#include "SOGoContentObject.h"
-#include "SOGoFolder.h"
-#include "common.h"
-#include <GDLContentStore/GCSFolder.h>
+#import <GDLContentStore/GCSFolder.h>
+
+#import <SOGo/SOGoUser.h>
+
+#import "common.h"
+#import "SOGoFolder.h"
+#import "SOGoContentObject.h"
@interface SOGoContentObject(ETag)
- (NSArray *)parseETagList:(NSString *)_c;
return [_ctx response];
}
+/* security */
+- (NSArray *) rolesOfUser: (NSString *) login
+ inContext: (WOContext *) context
+{
+ NSMutableArray *sogoRoles;
+ SOGoUser *user;
+
+ sogoRoles = [NSMutableArray new];
+ [sogoRoles autorelease];
+
+ if (![container nameExistsInFolder: nameInContainer])
+ {
+ user = [[SOGoUser alloc] initWithLogin: login roles: nil];
+ [sogoRoles addObjectsFromArray: [user rolesForObject: container
+ inContext: context]];
+ [user release];
+ }
+
+ return sogoRoles;
+}
+
/* E-Tags */
- (id)davEntityTag {
- (GCSFolder *)ocsFolder;
/* lower level fetches */
+- (BOOL) nameExistsInFolder: (NSString *) objectName;
+
- (NSArray *)fetchContentObjectNames;
- (NSDictionary *)fetchContentStringsAndNamesOfAllObjects;
return [records valueForKey:@"c_name"];
}
+- (BOOL) nameExistsInFolder: (NSString *) objectName
+{
+ NSArray *fields, *records;
+ EOQualifier *qualifier;
+
+ qualifier
+ = [EOQualifier qualifierWithQualifierFormat:
+ [NSString stringWithFormat: @"c_name='%@'", objectName]];
+
+ fields = [NSArray arrayWithObject: @"c_name"];
+ records = [[self ocsFolder] fetchFields: fields
+ matchingQualifier: qualifier];
+ return (records
+ && ![records isKindOfClass:[NSException class]]
+ && [records count] > 0);
+}
+
- (NSDictionary *)fetchContentStringsAndNamesOfAllObjects {
NSDictionary *files;
#import <NGObjWeb/WOResponse.h>
#import <NGObjWeb/WOApplication.h>
#import <NGCards/NSDictionary+NGCards.h>
+
#import "common.h"
#import "NSArray+Utilities.h"
- (NSString *) roleOfUser: (NSString *) uid
inContext: (WOContext *) context;
+- (NSArray *) rolesOfUser: (NSString *) uid
+ inContext: (WOContext *) context;
@end
aclsFolder = [SOGoAclsFolder aclsFolder];
sogoRoles = [aclsFolder aclsForObject: (SOGoObject *) object
forUser: login];
- [rolesForObject addObjectsFromArray: sogoRoles];
+ if (sogoRoles)
+ [rolesForObject addObjectsFromArray: sogoRoles];
+ }
+ if ([object respondsToSelector: @selector (rolesOfUser:inContext:)])
+ {
+ sogoRoles = [object rolesOfUser: login inContext: context];
+ if (sogoRoles)
+ [rolesForObject addObjectsFromArray: sogoRoles];
}
if ([object respondsToSelector: @selector (roleOfUser:inContext:)])
{
pageName = "UIxContactsListView";
actionName = "addressBooksContacts";
};
+ PUT = {
+ protectedBy = "PUT";
+ actionName = "PUT";
+ };
};
};
pageName = "UIxContactView";
actionName = "vcard";
};
+ PUT = {
+ protectedBy = "PUT";
+ };
};
};
02111-1307, USA.
*/
-#include "UIxMailEditorAction.h"
+#import "UIxMailEditorAction.h"
@interface UIxMailReplyAction : UIxMailEditorAction
@end
-#include <SoObjects/Mailer/SOGoMailObject.h>
-#include <SoObjects/Mailer/SOGoDraftObject.h>
-#include <NGImap4/NGImap4EnvelopeAddress.h>
-#include <NGImap4/NGImap4Envelope.h>
-#include "common.h"
+#import <SoObjects/Mailer/SOGoMailObject.h>
+#import <SoObjects/Mailer/SOGoDraftObject.h>
+#import <NGImap4/NGImap4EnvelopeAddress.h>
+#import <NGImap4/NGImap4Envelope.h>
+#import "common.h"
@implementation UIxMailReplyAction
}
}
-- (NSString *)contentForReplyOnParts:(NSDictionary *)_prts keys:(NSArray *)_k {
+- (NSString *) contentForReplyOnParts: (NSDictionary *) _prts
+ keys: (NSArray *) _k
+{
static NSString *textPartSeparator = @"\n---\n";
NSMutableString *ms;
unsigned i, count;
ms = [NSMutableString stringWithCapacity:16000];
-
for (i = 0, count = [_k count]; i < count; i++) {
NSString *k, *v;
k = [_k objectAtIndex:i];
-
+
// TODO: this is DUP code to SOGoMailObject
if ([k isEqualToString:@"body[text]"])
k = @"";
}
- (NSString *)contentForReply {
- NSArray *keys;
- NSDictionary *parts;
-
- keys = [[self clientObject] plainTextContentFetchKeys];
+ NSArray *keys, *partInfos;
+ NSDictionary *parts, *infos;
+ SOGoMailObject *co;
+
+ co = [self clientObject];
+ keys = [co plainTextContentFetchKeys];
+ infos = [co fetchCoreInfos];
+ partInfos = [infos objectForKey: keys];
+ NSLog (@"infos: '%@'", infos);
+
if ([keys count] == 0)
return nil;
"View" = ( "Owner", "Delegate", "Assistant" );
"WebDAV Access" = ( "Owner", "Delegate", "Assistant" );
"Access Contents Information" = ( "Owner", "Assistant", "Delegate" );
- "ReadAcls" = ( "Owner", "Delegate", "Assistant" );
+ "ReadAcls" = ( "Owner", "Assistant", "Delegate" );
"SaveAcls" = ( "Owner" );
+ "Delete Objects" = ( "Owner", "Delegate" );
};
};
SOGoGroupsFolder = {
};
SOGoRootPage = {
};
+ SOGoFolder = {
+ methods = {
+ PUT = {
+ protectedBy = "Add Documents, Images, and Files";
+ };
+ };
+ };
SOGoUserFolder = {
methods = {
view = {
"Next hour" = "Next hour";
"closeThisWindowMessage" = "Thank you! You may now close this window.";
+"Multicolumn Day View" = "Multicolumn Day View";
"Next hour" = "Heure suivante";
"closeThisWindowMessage" = "Merci! Vous pouvez maintenant fermer cette fenĂȘtre.";
+"Multicolumn Day View" = "Multicolonne";
[stamp setTimeZone: utc];
s = [self iCalParticipantsAndResourcesStringFromQueryParameters];
- template = [NSString stringWithFormat:iCalStringTemplate,
+ template = [NSString stringWithFormat: iCalStringTemplate,
[[self clientObject] nameInContainer],
[stamp iCalFormattedDateTimeString],
[lStartDate iCalFormattedDateTimeString],
return iCalString;
}
-
- (NSArray *) availableCalendars
{
NSEnumerator *rawContacts;
day = currentDay;
var user = UserLogin;
- if (currentView == "multicolumndayview" && type == "event")
+ if (sender.parentNode.getAttribute("id") != "toolbar"
+ && currentView == "multicolumndayview" && type == "event")
user = sender.parentNode.parentNode.getAttribute("user");
var hour = sender.getAttribute("hour");
function onChangeCalendar(list) {
var form = document.forms.editform;
+ log ("before: " + form.getAttribute("action"));
var urlElems = form.getAttribute("action").split("/");
urlElems[urlElems.length-4]
= list.childNodesWithTag("option")[list.value].innerHTML;
form.setAttribute("action", urlElems.join("/"));
+ log ("after: " + form.getAttribute("action"));
}
function validateBrowseURL(input) {