merge of '3bf253d3d887017200751e451da4fd1a31cc57ce'

and '77a1a396ead2722d4c170d71c3f90eb39e0a4eee'

Monotone-Parent: 3bf253d3d887017200751e451da4fd1a31cc57ce
Monotone-Parent: 77a1a396ead2722d4c170d71c3f90eb39e0a4eee
Monotone-Revision: e750571b424fd6eb63b5c1e2704f0f04635a6e51

Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2010-07-15T16:16:06
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Ludovic Marcotte
2010-07-15 16:16:06 +00:00
10 changed files with 107 additions and 108 deletions

View File

@@ -1,5 +1,22 @@
2010-07-15 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/SOGoUser.m (-personalCalendarFolderInContext:):
we now make use of -[SOGoParentFolder
lookupPersonalFolder:ignoringRights:] with @"personal" and YES as
arguments.
* SoObjects/Appointments/SOGoAppointmentFolder.m
(-lookupCalendarFolderForUID:): removed useless method, which can
be replaced with -[SOGoUser personalCalendarFolderInContext:].
* UI/Scheduler/UIxCalListingActions.m
(_aptFolder:withClientObject:): removed unused method.
* UI/WebServerResources/UIxAppointmentEditor.js
(onComposeToAllAttendees): take the status image DIV into account
when detecting the user fullnames.
(onComposeToUndecidedAttendees): same as above.
* Tests/Integration/test-davacl.py
(DAVCalendarPublicAclTest.testCollectionAccessNormalUser): print
the amount of received hrefs.
@@ -13,9 +30,12 @@
(_fetchPersonalFolders:withChannel:): we no longer check access
rights from here as this method is too low level and prevent other
mechanisms from working properly.
(-lookupName:inContext:acquire:): we now check the "AccessObject"
right from here before returning the found object. We also make
use of the new "ignoreRights" method (see below) to that end.
(-lookupPersonalFolder:ignoringRights:): new method enabling the
lookup of a user's personal folders only and offering the choice
of respecting (or not) the active user's permission before
returning it.
(-lookupName:inContext:acquire:): we now make use of the above
method when looking up personal folders ("personal" or not).
(-toManyRelationShipKeys): same as lookupName... above.
* SoObjects/SOGo/SOGoObject.m (-ignoreRights): new utility method

View File

@@ -123,7 +123,6 @@ typedef enum {
- (id) lookupHomeFolderForUID: (NSString *) _uid
inContext: (id) _ctx;
- (SOGoAppointmentFolder *) lookupCalendarFolderForUID: (NSString *) uid;
- (NSArray *) lookupCalendarFoldersForUID: (NSString *) theUID;
- (NSArray *) lookupCalendarFoldersForUIDs: (NSArray *) _uids
inContext: (id) _ctx;

View File

@@ -2644,36 +2644,6 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
return result;
}
//
// This method returns the personal calendar of a specific user.
//
- (SOGoAppointmentFolder *) lookupCalendarFolderForUID: (NSString *) uid
{
SOGoFolder *currentContainer;
SOGoAppointmentFolders *parent;
NSException *error;
currentContainer = [[container container] container];
currentContainer = [currentContainer lookupName: uid
inContext: context
acquire: NO];
parent = [currentContainer lookupName: @"Calendar" inContext: context
acquire: NO];
currentContainer = [parent lookupName: @"personal" inContext: context
acquire: NO];
if (!currentContainer)
{
error = [parent newFolderWithName: [parent defaultFolderName]
andNameInContainer: @"personal"];
if (!error)
currentContainer = [parent lookupName: @"personal"
inContext: context
acquire: NO];
}
return (SOGoAppointmentFolder *) currentContainer;
}
//
// This method returns an array containing all the calendar folders
// of a specific user, excluding her/his subscriptions.
@@ -2712,6 +2682,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
NSMutableArray *folders;
NSEnumerator *e;
NSString *uid, *ownerLogin;
SOGoUser *user;
id folder;
ownerLogin = [self ownerInContext: context];
@@ -2725,7 +2696,8 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
folder = self;
else
{
folder = [self lookupCalendarFolderForUID: uid];
user = [SOGoUser userWithLogin: uid];
folder = [user personalCalendarFolderInContext: context];
if (![folder isNotNull])
[self logWithFormat:@"Note: did not find folder for uid: '%@'", uid];
}

View File

@@ -58,7 +58,6 @@
@interface SOGoParentFolder (Private)
- (NSException *) initSubscribedSubFolders;
- (NSException *) _fetchPersonalFolders: (NSString *) sql
withChannel: (EOAdaptorChannel *) fc;
@@ -74,6 +73,33 @@ static SoSecurityManager *sm = nil;
sm = [SoSecurityManager sharedSecurityManager];
}
+ (SOGoWebDAVAclManager *) webdavAclManager
{
static SOGoWebDAVAclManager *aclManager = nil;
if (!aclManager)
{
aclManager = [[super webdavAclManager] copy];
[aclManager
registerDAVPermission: davElement (@"write", XMLNS_WEBDAV)
abstract: NO
withEquivalent: SoPerm_AddDocumentsImagesAndFiles
asChildOf: davElement (@"all", XMLNS_WEBDAV)];
[aclManager
registerDAVPermission: davElement (@"write-properties", XMLNS_WEBDAV)
abstract: YES
withEquivalent: SoPerm_AddDocumentsImagesAndFiles
asChildOf: davElement (@"write", XMLNS_WEBDAV)];
[aclManager
registerDAVPermission: davElement (@"write-content", XMLNS_WEBDAV)
abstract: YES
withEquivalent: SoPerm_AddDocumentsImagesAndFiles
asChildOf: davElement (@"write", XMLNS_WEBDAV)];
}
return aclManager;
}
- (id) init
{
if ((self = [super init]))
@@ -489,33 +515,6 @@ static SoSecurityManager *sm = nil;
return error;
}
+ (SOGoWebDAVAclManager *) webdavAclManager
{
static SOGoWebDAVAclManager *aclManager = nil;
if (!aclManager)
{
aclManager = [[super webdavAclManager] copy];
[aclManager
registerDAVPermission: davElement (@"write", XMLNS_WEBDAV)
abstract: NO
withEquivalent: SoPerm_AddDocumentsImagesAndFiles
asChildOf: davElement (@"all", XMLNS_WEBDAV)];
[aclManager
registerDAVPermission: davElement (@"write-properties", XMLNS_WEBDAV)
abstract: YES
withEquivalent: SoPerm_AddDocumentsImagesAndFiles
asChildOf: davElement (@"write", XMLNS_WEBDAV)];
[aclManager
registerDAVPermission: davElement (@"write-content", XMLNS_WEBDAV)
abstract: YES
withEquivalent: SoPerm_AddDocumentsImagesAndFiles
asChildOf: davElement (@"write", XMLNS_WEBDAV)];
}
return aclManager;
}
- (BOOL) hasProxyCalendarsWithWriteAccess: (BOOL) write
forUserWithLogin: (NSString *) userLogin
{

View File

@@ -163,7 +163,8 @@
if (!object)
{
// Create the event in the user's personal calendar.
folder = [container lookupCalendarFolderForUID: uid];
folder = [[SOGoUser userWithLogin: uid]
personalCalendarFolderInContext: context];
object = [SOGoAppointmentObject objectWithName: nameInContainer
inContainer: folder];
[object setIsNew: YES];
@@ -265,7 +266,8 @@
// Invitations are always written to the personal folder; it's not necessay
// to look into all folders of the user
folder = [container lookupCalendarFolderForUID: theUID];
folder = [[SOGoUser userWithLogin: theUID]
personalCalendarFolderInContext: context];
object = [folder lookupName: nameInContainer
inContext: context acquire: NO];
if (![object isKindOfClass: [NSException class]])

View File

@@ -54,6 +54,9 @@
- (NSException *) newFolderWithName: (NSString *) name
nameInContainer: (NSString **) newNameInContainer;
- (id) lookupPersonalFolder: (NSString *) name
ignoringRights: (BOOL) ignoreRights;
@end
#endif /* SOGOPARENTFOLDERS_H */

View File

@@ -392,23 +392,8 @@ static SoSecurityManager *sm = nil;
obj = [super lookupName: name inContext: lookupContext acquire: NO];
if (!obj)
{
// Lookup in personal folders
error = [self initSubFolders];
if (error)
{
[self errorWithFormat: @"a database error occured: %@", [error reason]];
obj = [NSException exceptionWithHTTPStatus: 503];
}
else
{
obj = [subFolders objectForKey: name];
if (obj && ![self ignoreRights]
&& [sm validatePermission: SOGoPerm_AccessObject
onObject: obj
inContext: context])
obj = nil;
}
obj = [self lookupPersonalFolder: name
ignoringRights: NO];
if (!obj)
{
// Lookup in subscribed folders
@@ -426,6 +411,31 @@ static SoSecurityManager *sm = nil;
return obj;
}
- (id) lookupPersonalFolder: (NSString *) name
ignoringRights: (BOOL) ignoreRights
{
NSException *error;
id obj;
error = [self initSubFolders];
if (error)
{
[self errorWithFormat: @"a database error occured: %@", [error reason]];
obj = [NSException exceptionWithHTTPStatus: 503];
}
else
{
obj = [subFolders objectForKey: name];
if (obj && !ignoreRights && ![self ignoreRights]
&& [sm validatePermission: SOGoPerm_AccessObject
onObject: obj
inContext: context])
obj = nil;
}
return obj;
}
- (NSArray *) subFolders
{
NSMutableArray *ma;

View File

@@ -599,9 +599,8 @@
- (SOGoAppointmentFolder *)
personalCalendarFolderInContext: (WOContext *) context
{
return [[self calendarsFolderInContext: context] lookupName: @"personal"
inContext: context
acquire: NO];
return [[self calendarsFolderInContext: context] lookupPersonalFolder: @"personal"
ignoringRights: YES];
}
// - (id) schedulingCalendarInContext: (id) _ctx

View File

@@ -234,25 +234,6 @@ static NSArray *tasksFields = nil;
}
}
- (SOGoAppointmentFolder *) _aptFolder: (NSString *) folder
withClientObject: (SOGoAppointmentFolder *) clientObject
{
SOGoAppointmentFolder *aptFolder;
NSArray *folderParts;
if ([folder isEqualToString: @"/"])
aptFolder = clientObject;
else
{
folderParts = [folder componentsSeparatedByString: @":"];
aptFolder
= [clientObject lookupCalendarFolderForUID:
[folderParts objectAtIndex: 0]];
}
return aptFolder;
}
- (void) _fixComponentTitle: (NSMutableDictionary *) component
withType: (NSString *) type
{

View File

@@ -115,8 +115,15 @@ function onComposeToAllAttendees()
var attendees = $$("DIV#attendeesMenu LI.attendee");
var addresses = new Array();
attendees.each(function(item) {
var address = item.firstChild.nodeValue.trim() + " <" + item.readAttribute("email") + ">";
addresses.push(address);
var textChild = null;
var childNodes = item.childNodes;
for (var i = 0; !textChild && i < childNodes.length; i++) {
if (childNodes[i].nodeType == 3) {
textChild = childNodes[i];
var address = textChild.nodeValue.trim() + " <" + item.readAttribute("email") + ">";
addresses.push(address);
}
}
});
if (window.opener)
window.opener.openMailTo(addresses.join(","));
@@ -130,8 +137,15 @@ function onComposeToUndecidedAttendees()
var attendees = $$("DIV#attendeesMenu LI.attendee.needs-action");
var addresses = new Array();
attendees.each(function(item) {
var address = item.firstChild.nodeValue.trim() + " <" + item.readAttribute("email") + ">";
addresses.push(address);
var textChild = null;
var childNodes = item.childNodes;
for (var i = 0; !textChild && i < childNodes.length; i++) {
if (childNodes[i].nodeType == 3) {
textChild = childNodes[i];
var address = textChild.nodeValue.trim() + " <" + item.readAttribute("email") + ">";
addresses.push(address);
}
}
});
if (window.opener)
window.opener.openMailTo(addresses.join(","));