mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-09-25 15:10:32 +00:00
Monotone-Parent: 991fa5d50c1c078407d84332831b1f0c32190152
Monotone-Revision: c37bbff8f7a0f029635c72cfa745ff24e2b2220c Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-01-04T14:37:07 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,3 +1,13 @@
|
|||||||
|
2007-01-04 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* SoObjects/Appointments/SOGoAppointmentFolder.m
|
||||||
|
([SOGoAppointmentFolder -lookupCalendarFolderForUID:uid]): method
|
||||||
|
moved from UI/Scheduler/UIxCalView:calendarFolderForUID:.
|
||||||
|
([SOGoAppointmentFolder
|
||||||
|
-lookupCalendarFoldersForUIDs:_uidsinContext:]): now use the new
|
||||||
|
lookupCalendarFolderForUID: method, which doesn't do security
|
||||||
|
checks.
|
||||||
|
|
||||||
2007-01-03 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2007-01-03 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
* UI/Common/UIxAclEditor.m ([UIxAclEditor -assistantsValue]): new
|
* UI/Common/UIxAclEditor.m ([UIxAclEditor -assistantsValue]): new
|
||||||
|
|||||||
@@ -87,6 +87,7 @@
|
|||||||
- (id) lookupHomeFolderForUID: (NSString *) _uid
|
- (id) lookupHomeFolderForUID: (NSString *) _uid
|
||||||
inContext: (id) _ctx;
|
inContext: (id) _ctx;
|
||||||
|
|
||||||
|
- (SOGoAppointmentFolder *) lookupCalendarFolderForUID: (NSString *) uid;
|
||||||
- (NSArray *) lookupCalendarFoldersForUIDs: (NSArray *) _uids
|
- (NSArray *) lookupCalendarFoldersForUIDs: (NSArray *) _uids
|
||||||
inContext: (id) _ctx;
|
inContext: (id) _ctx;
|
||||||
- (NSArray *) lookupFreeBusyObjectsForUIDs: (NSArray *) _uids
|
- (NSArray *) lookupFreeBusyObjectsForUIDs: (NSArray *) _uids
|
||||||
|
|||||||
@@ -903,6 +903,24 @@ static NSNumber *sharedYes = nil;
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (SOGoAppointmentFolder *) lookupCalendarFolderForUID: (NSString *) uid
|
||||||
|
{
|
||||||
|
SOGoFolder *upperContainer;
|
||||||
|
SOGoUserFolder *userFolder;
|
||||||
|
SOGoAppointmentFolder *calendarFolder;
|
||||||
|
|
||||||
|
upperContainer = [[self container] container];
|
||||||
|
userFolder = [SOGoUserFolder objectWithName: uid
|
||||||
|
inContainer: upperContainer];
|
||||||
|
calendarFolder = [SOGoAppointmentFolder objectWithName: @"Calendar"
|
||||||
|
inContainer: userFolder];
|
||||||
|
[calendarFolder
|
||||||
|
setOCSPath: [NSString stringWithFormat: @"/Users/%@/Calendar", uid]];
|
||||||
|
[calendarFolder setOwner: uid];
|
||||||
|
|
||||||
|
return calendarFolder;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSArray *) lookupCalendarFoldersForUIDs: (NSArray *) _uids
|
- (NSArray *) lookupCalendarFoldersForUIDs: (NSArray *) _uids
|
||||||
inContext: (id)_ctx
|
inContext: (id)_ctx
|
||||||
{
|
{
|
||||||
@@ -917,12 +935,7 @@ static NSNumber *sharedYes = nil;
|
|||||||
while ((uid = [e nextObject])) {
|
while ((uid = [e nextObject])) {
|
||||||
id folder;
|
id folder;
|
||||||
|
|
||||||
folder = [self lookupHomeFolderForUID:uid inContext:nil];
|
folder = [self lookupCalendarFolderForUID: uid];
|
||||||
if ([folder isNotNull]) {
|
|
||||||
folder = [folder lookupName:@"Calendar" inContext:nil acquire:NO];
|
|
||||||
if ([folder isKindOfClass:[NSException class]])
|
|
||||||
folder = nil;
|
|
||||||
}
|
|
||||||
if (![folder isNotNull])
|
if (![folder isNotNull])
|
||||||
[self logWithFormat:@"Note: did not find folder for uid: '%@'", uid];
|
[self logWithFormat:@"Note: did not find folder for uid: '%@'", uid];
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,10 @@
|
|||||||
#import <Foundation/NSUserDefaults.h>
|
#import <Foundation/NSUserDefaults.h>
|
||||||
#import <Foundation/NSValue.h>
|
#import <Foundation/NSValue.h>
|
||||||
|
|
||||||
|
#import <NGObjWeb/SoSecurityManager.h>
|
||||||
#import <NGObjWeb/WOResponse.h>
|
#import <NGObjWeb/WOResponse.h>
|
||||||
|
|
||||||
|
#import <SOGo/SOGoPermissions.h>
|
||||||
#import <SOGo/SOGoUser.h>
|
#import <SOGo/SOGoUser.h>
|
||||||
|
|
||||||
#import "UIxCalMainView.h"
|
#import "UIxCalMainView.h"
|
||||||
@@ -128,15 +130,49 @@ static NSMutableArray *yearMenuItems = nil;
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *) _rightsForUIDs: (NSString *) uids
|
||||||
|
{
|
||||||
|
NSEnumerator *ids;
|
||||||
|
NSString *uid;
|
||||||
|
NSMutableString *rights;
|
||||||
|
SOGoAppointmentFolder *refFolder, *currentFolder;
|
||||||
|
SoSecurityManager *securityManager;
|
||||||
|
BOOL result;
|
||||||
|
|
||||||
|
securityManager = [SoSecurityManager sharedSecurityManager];
|
||||||
|
refFolder = [self clientObject];
|
||||||
|
|
||||||
|
rights = [NSMutableString string];
|
||||||
|
if ([uids length] > 0)
|
||||||
|
{
|
||||||
|
ids = [[uids componentsSeparatedByString: @","] objectEnumerator];
|
||||||
|
uid = [ids nextObject];
|
||||||
|
while (uid)
|
||||||
|
{
|
||||||
|
currentFolder
|
||||||
|
= [refFolder
|
||||||
|
lookupCalendarFolderForUID: (([uid hasPrefix: @"-"])
|
||||||
|
? [uid substringFromIndex: 1]
|
||||||
|
: uid)];
|
||||||
|
result = (![securityManager validatePermission: SoPerm_AccessContentsInformation
|
||||||
|
onObject: currentFolder
|
||||||
|
inContext: context]);
|
||||||
|
if ([rights length] == 0)
|
||||||
|
[rights appendFormat: @"%d", result];
|
||||||
|
else
|
||||||
|
[rights appendFormat: @",%d", result];
|
||||||
|
uid = [ids nextObject];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rights;
|
||||||
|
}
|
||||||
|
|
||||||
- (id <WOActionResults>) checkRightsAction
|
- (id <WOActionResults>) checkRightsAction
|
||||||
{
|
{
|
||||||
WOResponse *response;
|
WOResponse *response;
|
||||||
NSUserDefaults *ud;
|
NSUserDefaults *ud;
|
||||||
NSString *uids, *uid;
|
NSString *uids, *rights;
|
||||||
NSMutableString *rights;
|
|
||||||
NSArray *ids;
|
|
||||||
unsigned int count, max;
|
|
||||||
BOOL result;
|
|
||||||
|
|
||||||
ud = [[context activeUser] userDefaults];
|
ud = [[context activeUser] userDefaults];
|
||||||
uids = [ud stringForKey: @"calendaruids"];
|
uids = [ud stringForKey: @"calendaruids"];
|
||||||
@@ -145,23 +181,8 @@ static NSMutableArray *yearMenuItems = nil;
|
|||||||
[response setStatus: 200];
|
[response setStatus: 200];
|
||||||
[response setHeader: @"text/plain; charset=\"utf-8\""
|
[response setHeader: @"text/plain; charset=\"utf-8\""
|
||||||
forKey: @"content-type"];
|
forKey: @"content-type"];
|
||||||
rights = [NSMutableString string];
|
|
||||||
if ([uids length] > 0)
|
rights = [self _rightsForUIDs: uids];
|
||||||
{
|
|
||||||
ids = [uids componentsSeparatedByString: @","];
|
|
||||||
max = [ids count];
|
|
||||||
for (count = 0; count < max; count++)
|
|
||||||
{
|
|
||||||
uid = [ids objectAtIndex: count];
|
|
||||||
if ([uid hasPrefix: @"-"])
|
|
||||||
uid = [uid substringFromIndex: 1];
|
|
||||||
result = ([self calendarFolderForUID: uid] != nil);
|
|
||||||
if (count == 0)
|
|
||||||
[rights appendFormat: @"%d", result];
|
|
||||||
else
|
|
||||||
[rights appendFormat: @",%d", result];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
[response appendContentString: rights];
|
[response appendContentString: rights];
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
|||||||
@@ -102,7 +102,6 @@
|
|||||||
/* calendarUIDs */
|
/* calendarUIDs */
|
||||||
|
|
||||||
- (NSString *)formattedCalendarUIDs;
|
- (NSString *)formattedCalendarUIDs;
|
||||||
- (SOGoAppointmentFolder *) calendarFolderForUID: (NSString *) uid;
|
|
||||||
|
|
||||||
/* CSS related */
|
/* CSS related */
|
||||||
|
|
||||||
|
|||||||
@@ -440,30 +440,6 @@ static BOOL shouldDisplayWeekend = NO;
|
|||||||
return [[self startDate] tomorrow];
|
return [[self startDate] tomorrow];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (SOGoAppointmentFolder *) calendarFolderForUID: (NSString *) uid
|
|
||||||
{
|
|
||||||
SOGoFolder *upperContainer;
|
|
||||||
SOGoUserFolder *userFolder;
|
|
||||||
SOGoAppointmentFolder *calendarFolder;
|
|
||||||
SoSecurityManager *securityManager;
|
|
||||||
|
|
||||||
upperContainer = [[[self clientObject] container] container];
|
|
||||||
userFolder = [SOGoUserFolder objectWithName: uid
|
|
||||||
inContainer: upperContainer];
|
|
||||||
calendarFolder = [SOGoAppointmentFolder objectWithName: @"Calendar"
|
|
||||||
inContainer: userFolder];
|
|
||||||
[calendarFolder
|
|
||||||
setOCSPath: [NSString stringWithFormat: @"/Users/%@/Calendar", uid]];
|
|
||||||
[calendarFolder setOwner: uid];
|
|
||||||
|
|
||||||
securityManager = [SoSecurityManager sharedSecurityManager];
|
|
||||||
|
|
||||||
return (([securityManager validatePermission: SoPerm_AccessContentsInformation
|
|
||||||
onObject: calendarFolder
|
|
||||||
inContext: context] == nil)
|
|
||||||
? calendarFolder : nil);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSArray *) activeCalendarFolders
|
- (NSArray *) activeCalendarFolders
|
||||||
{
|
{
|
||||||
NSUserDefaults *ud;
|
NSUserDefaults *ud;
|
||||||
@@ -471,6 +447,9 @@ static BOOL shouldDisplayWeekend = NO;
|
|||||||
SOGoAppointmentFolder *currentFolder;
|
SOGoAppointmentFolder *currentFolder;
|
||||||
NSMutableArray *folders;
|
NSMutableArray *folders;
|
||||||
NSString *currentUID;
|
NSString *currentUID;
|
||||||
|
SoSecurityManager *securityManager;
|
||||||
|
|
||||||
|
securityManager = [SoSecurityManager sharedSecurityManager];
|
||||||
|
|
||||||
folders = [NSMutableArray array];
|
folders = [NSMutableArray array];
|
||||||
ud = [[context activeUser] userDefaults];
|
ud = [[context activeUser] userDefaults];
|
||||||
@@ -481,8 +460,11 @@ static BOOL shouldDisplayWeekend = NO;
|
|||||||
{
|
{
|
||||||
if (![currentUID hasPrefix: @"-"])
|
if (![currentUID hasPrefix: @"-"])
|
||||||
{
|
{
|
||||||
currentFolder = [self calendarFolderForUID: currentUID];
|
currentFolder = [[self clientObject] lookupCalendarFolderForUID: currentUID];
|
||||||
if (currentFolder)
|
if (currentFolder
|
||||||
|
&& ![securityManager validatePermission: SoPerm_AccessContentsInformation
|
||||||
|
onObject: currentFolder
|
||||||
|
inContext: context])
|
||||||
[folders addObject: currentFolder];
|
[folders addObject: currentFolder];
|
||||||
}
|
}
|
||||||
currentUID = [calendarUIDs nextObject];
|
currentUID = [calendarUIDs nextObject];
|
||||||
|
|||||||
Reference in New Issue
Block a user