From 7cc20c5f42e87e19f7b626044c2841bc494c719d Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 27 Nov 2007 17:19:24 +0000 Subject: [PATCH 1/6] Monotone-Parent: d8549ba070887e4694d144719b284413458362d9 Monotone-Revision: 0742b132865bb64da2c2aa1944247147ae906d38 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-11-27T17:19:24 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 ++++++ SoObjects/Appointments/SOGoFreeBusyObject.m | 4 ++-- UI/MainUI/SOGoUserHomePage.m | 5 +---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index d5e0e74d9..15b9d7677 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-11-27 Wolfgang Sourdeau + + * SoObjects/Appointments/SOGoFreeBusyObject.m ([SOGoFreeBusyObject + -fetchFreeBusyInfosFrom:_startDateto:_endDate]): specify context + when looking up the Calendar folder. + 2007-11-26 Wolfgang Sourdeau * UI/Scheduler/UIxTaskEditor.m ([UIxTaskEditor -todo]): same as below. diff --git a/SoObjects/Appointments/SOGoFreeBusyObject.m b/SoObjects/Appointments/SOGoFreeBusyObject.m index 80390a733..4aa053f35 100644 --- a/SoObjects/Appointments/SOGoFreeBusyObject.m +++ b/SoObjects/Appointments/SOGoFreeBusyObject.m @@ -80,8 +80,8 @@ // SoSecurityManager *sm; NSArray *infos; - calFolder = [[container lookupName: @"Calendar" inContext: nil acquire: NO] - lookupName: @"personal" inContext: nil acquire: NO]; + calFolder = [[container lookupName: @"Calendar" inContext: context acquire: NO] + lookupName: @"personal" inContext: context acquire: NO]; // sm = [SoSecurityManager sharedSecurityManager]; // if (![sm validatePermission: SOGoPerm_FreeBusyLookup // onObject: calFolder diff --git a/UI/MainUI/SOGoUserHomePage.m b/UI/MainUI/SOGoUserHomePage.m index 8134af2c0..c5f56913e 100644 --- a/UI/MainUI/SOGoUserHomePage.m +++ b/UI/MainUI/SOGoUserHomePage.m @@ -95,8 +95,7 @@ static NSString *defaultModule = nil; NSNumber *status; NSCalendarDate *currentDate; - record = [records nextObject]; - while (record) + while ((record = [records nextObject])) { status = [record objectForKey: @"c_status"]; @@ -117,8 +116,6 @@ static NSString *defaultModule = nil; for (count = startInterval; count < endInterval; count++) [items replaceObjectAtIndex: count withObject: status]; - - record = [records nextObject]; } } From 1837e724252a990191f68990cdefdab62c01f09b Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 27 Nov 2007 21:00:06 +0000 Subject: [PATCH 2/6] Monotone-Parent: 0742b132865bb64da2c2aa1944247147ae906d38 Monotone-Revision: 4ec7b248cac042317cf5d80e06d1372dddd83171 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-11-27T21:00:06 Monotone-Branch: ca.inverse.sogo --- UI/WebServerResources/UIxContactsUserFolders.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UI/WebServerResources/UIxContactsUserFolders.js b/UI/WebServerResources/UIxContactsUserFolders.js index 62faa6c68..1855cc45e 100644 --- a/UI/WebServerResources/UIxContactsUserFolders.js +++ b/UI/WebServerResources/UIxContactsUserFolders.js @@ -36,8 +36,8 @@ function addLineToTree(tree, parent, line) { icon += 'calendar-folder-16x16.png'; var folderId = userInfos[0] + ":" + folderInfos[1]; var name = folderInfos[0]; // name has the format "Folername (Firstname Lastname )" - var pos = name.indexOf(' (') - if (pos !== -1) + var pos = name.lastIndexOf(' (') + if (pos != -1) name = name.substring(0, pos); // strip the part with fullname and email tree.add(parent + i, parent, name, 0, '#', folderId, folderInfos[2] + '-folder', '', '', icon, icon); From 733267f6c55416c85ce62f4a5cda789fbf751a7c Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 27 Nov 2007 21:02:33 +0000 Subject: [PATCH 3/6] Monotone-Parent: 4ec7b248cac042317cf5d80e06d1372dddd83171 Monotone-Revision: c69f7f8d6e6f9e8f9e94f61cae6ed7a39e26e747 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-11-27T21:02:33 Monotone-Branch: ca.inverse.sogo --- UI/Contacts/UIxContactFoldersView.m | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/UI/Contacts/UIxContactFoldersView.m b/UI/Contacts/UIxContactFoldersView.m index a4f7b1a44..9d1f87a1a 100644 --- a/UI/Contacts/UIxContactFoldersView.m +++ b/UI/Contacts/UIxContactFoldersView.m @@ -199,8 +199,7 @@ [folders autorelease]; subfolders = [[parentFolder subFolders] objectEnumerator]; - currentFolder = [subfolders nextObject]; - while (currentFolder) + while ((currentFolder = [subfolders nextObject])) { if (![securityManager validatePermission: SOGoPerm_AccessObject onObject: currentFolder inContext: context]) @@ -217,7 +216,6 @@ forKey: @"type"]; [folders addObject: currentDictionary]; } - currentFolder = [subfolders nextObject]; } return folders; From 84b93929c2779abbb537e97fa34a1a1abcbd60de Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 27 Nov 2007 21:06:11 +0000 Subject: [PATCH 4/6] Monotone-Parent: c69f7f8d6e6f9e8f9e94f61cae6ed7a39e26e747 Monotone-Revision: b3c4fef061776cff263262f03c363766fa58d479 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-11-27T21:06:11 Monotone-Branch: ca.inverse.sogo --- SoObjects/Mailer/SOGoMailFolder.m | 11 +-- SoObjects/Mailer/product.plist | 2 +- SoObjects/SOGo/SOGoContentObject.m | 12 +-- SoObjects/SOGo/SOGoGCSFolder.m | 2 - SoObjects/SOGo/SOGoPermissions.m | 1 - UI/Common/UIxFolderActions.m | 53 ++++++----- UI/Common/product.plist | 2 +- UI/Contacts/UIxContactsUserRightsEditor.m | 18 ---- UI/MailerUI/UIxMailUserRightsEditor.m | 18 ---- UI/MainUI/product.plist | 27 ++++-- .../UIxContactsUserRightsEditor.wox | 15 +-- UI/WebServerResources/ContactsUI.js | 92 +++++++++++-------- 12 files changed, 119 insertions(+), 134 deletions(-) diff --git a/SoObjects/Mailer/SOGoMailFolder.m b/SoObjects/Mailer/SOGoMailFolder.m index 96be31613..a0cff9ecf 100644 --- a/SoObjects/Mailer/SOGoMailFolder.m +++ b/SoObjects/Mailer/SOGoMailFolder.m @@ -454,10 +454,8 @@ static NSString *defaultUserID = @"anyone"; switch ([imapAcls characterAtIndex: count]) { case 'l': - [SOGoAcls addObjectUniquely: SOGoRole_ObjectViewer]; - break; case 'r': - [SOGoAcls addObjectUniquely: SOGoRole_ObjectReader]; + [SOGoAcls addObjectUniquely: SOGoRole_ObjectViewer]; break; case 's': [SOGoAcls addObjectUniquely: SOGoMailRole_SeenKeeper]; @@ -505,9 +503,10 @@ static NSString *defaultUserID = @"anyone"; while (currentAcl) { if ([currentAcl isEqualToString: SOGoRole_ObjectViewer]) - character = 'l'; - else if ([currentAcl isEqualToString: SOGoRole_ObjectReader]) - character = 'r'; + { + [imapAcls appendFormat: @"lr"]; + character = 0; + } else if ([currentAcl isEqualToString: SOGoMailRole_SeenKeeper]) character = 's'; else if ([currentAcl isEqualToString: SOGoMailRole_Writer]) diff --git a/SoObjects/Mailer/product.plist b/SoObjects/Mailer/product.plist index 2a93d2b7a..238a62294 100644 --- a/SoObjects/Mailer/product.plist +++ b/SoObjects/Mailer/product.plist @@ -42,7 +42,7 @@ superclass = "SOGoMailBaseObject"; defaultRoles = { "View" = ( "Owner", "ObjectViewer" ); - "Access Contents Information" = ( "Owner", "ObjectReader" ); + "Access Contents Information" = ( "Owner", "ObjectViewer" ); "Add Documents, Images, and Files" = ( "Owner", "ObjectCreator" ); "Delete Objects" = ( "Owner", "ObjectEraser" ); "WebDAV Access" = ( "Owner", "ObjectViewer" ); diff --git a/SoObjects/SOGo/SOGoContentObject.m b/SoObjects/SOGo/SOGoContentObject.m index e45b458f7..1e1d0f795 100644 --- a/SoObjects/SOGo/SOGoContentObject.m +++ b/SoObjects/SOGo/SOGoContentObject.m @@ -374,16 +374,14 @@ containerAcls = [container aclsForUser: uid]; if ([containerAcls count] > 0) { - if ([containerAcls containsObject: SOGoRole_ObjectCreator]) + [acls addObjectsFromArray: containerAcls]; + if (isNew) { - [acls addObject: SOGoRole_ObjectCreator]; - if (isNew) + if ([containerAcls containsObject: SOGoRole_ObjectCreator]) [acls addObject: SOGoRole_ObjectEditor]; + else + [acls removeObject: SOGoRole_ObjectEditor]; } - if ([containerAcls containsObject: SOGoRole_ObjectReader]) - [acls addObject: SOGoRole_ObjectViewer]; - if ([containerAcls containsObject: SOGoRole_ObjectEditor]) - [acls addObject: SOGoRole_ObjectEditor]; } return acls; diff --git a/SoObjects/SOGo/SOGoGCSFolder.m b/SoObjects/SOGo/SOGoGCSFolder.m index 728d3c303..8eb59067e 100644 --- a/SoObjects/SOGo/SOGoGCSFolder.m +++ b/SoObjects/SOGo/SOGoGCSFolder.m @@ -596,8 +596,6 @@ static NSString *defaultUserID = @""; containerAcls = [container aclsForUser: uid]; if ([containerAcls count] > 0) { - if ([containerAcls containsObject: SOGoRole_ObjectReader]) - [acls addObject: SOGoRole_ObjectViewer]; #warning this should be checked if ([containerAcls containsObject: SOGoRole_ObjectEraser]) [acls addObject: SOGoRole_ObjectEraser]; diff --git a/SoObjects/SOGo/SOGoPermissions.m b/SoObjects/SOGo/SOGoPermissions.m index 0e9769151..d6c25f3a9 100644 --- a/SoObjects/SOGo/SOGoPermissions.m +++ b/SoObjects/SOGo/SOGoPermissions.m @@ -26,7 +26,6 @@ NSString *SOGoRole_ObjectCreator = @"ObjectCreator"; NSString *SOGoRole_ObjectEraser = @"ObjectEraser"; NSString *SOGoRole_ObjectViewer = @"ObjectViewer"; -NSString *SOGoRole_ObjectReader = @"ObjectReader"; NSString *SOGoRole_ObjectEditor = @"ObjectEditor"; NSString *SOGoRole_FolderCreator = @"FolderCreator"; diff --git a/UI/Common/UIxFolderActions.m b/UI/Common/UIxFolderActions.m index 44d21f6d3..d8c659685 100644 --- a/UI/Common/UIxFolderActions.m +++ b/UI/Common/UIxFolderActions.m @@ -147,34 +147,39 @@ - (WOResponse *) canAccessContentAction { -#warning IMPROVEMENTS REQUIRED! - NSArray *acls; -// NSEnumerator *userAcls; -// NSString *currentAcl; + /* We want this action to be authorized managed by the SOPE's internal acl + handling. */ + return [self responseWith204]; +// #warning IMPROVEMENTS REQUIRED! +// NSArray *acls; +// // NSEnumerator *userAcls; +// // NSString *currentAcl; - [self _setupContext]; +// [self _setupContext]; -// NSLog(@"canAccessContentAction %@, owner %@", subscriptionPointer, owner); +// // NSLog(@"canAccessContentAction %@, owner %@", subscriptionPointer, owner); - if ([login isEqualToString: owner] || [owner isEqualToString: @"nobody"]) { - return [self responseWith204]; - } - else { - acls = [clientObject aclsForUser: login]; -// userAcls = [acls objectEnumerator]; -// currentAcl = [userAcls nextObject]; -// while (currentAcl) { -// NSLog(@"ACL login %@, owner %@, folder %@: %@", -// login, owner, baseFolder, currentAcl); -// currentAcl = [userAcls nextObject]; -// } - if (([[clientObject folderType] isEqualToString: @"Contact"] && [acls containsObject: SOGoRole_ObjectReader]) || - ([[clientObject folderType] isEqualToString: @"Appointment"] && [acls containsObject: SOGoRole_AuthorizedSubscriber])) { - return [self responseWith204]; - } - } +// if ([login isEqualToString: owner] || [owner isEqualToString: @"nobody"]) { +// return [self responseWith204]; +// } +// else { +// acls = [clientObject aclsForUser: login]; +// // userAcls = [acls objectEnumerator]; +// // currentAcl = [userAcls nextObject]; +// // while (currentAcl) { +// // NSLog(@"ACL login %@, owner %@, folder %@: %@", +// // login, owner, baseFolder, currentAcl); +// // currentAcl = [userAcls nextObject]; +// // } +// if (([[clientObject folderType] isEqualToString: @"Contact"] +// && [acls containsObject: SOGoRole_ObjectViewer]) || +// ([[clientObject folderType] isEqualToString: @"Appointment"] +// && [acls containsObject: SOGoRole_AuthorizedSubscriber])) { +// return [self responseWith204]; +// } +// } - return [self responseWithStatus: 403]; +// return [self responseWithStatus: 403]; } - (WOResponse *) _realFolderActivation: (BOOL) makeActive diff --git a/UI/Common/product.plist b/UI/Common/product.plist index ea75a393f..16cf11bf6 100644 --- a/UI/Common/product.plist +++ b/UI/Common/product.plist @@ -84,7 +84,7 @@ actionName = "unsubscribe"; }; canAccessContent = { - protectedBy = ""; + protectedBy = "Access Object"; actionClass = "UIxFolderActions"; actionName = "canAccessContent"; }; diff --git a/UI/Contacts/UIxContactsUserRightsEditor.m b/UI/Contacts/UIxContactsUserRightsEditor.m index 65cb1d118..a6d43ee01 100644 --- a/UI/Contacts/UIxContactsUserRightsEditor.m +++ b/UI/Contacts/UIxContactsUserRightsEditor.m @@ -81,19 +81,6 @@ return [userRights containsObject: SOGoRole_ObjectViewer]; } -- (void) setUserCanReadObjects: (BOOL) userCanReadObjects -{ - if (userCanReadObjects) - [self appendRight: SOGoRole_ObjectReader]; - else - [self removeRight: SOGoRole_ObjectReader]; -} - -- (BOOL) userCanReadObjects -{ - return [userRights containsObject: SOGoRole_ObjectReader]; -} - - (void) updateRights { WORequest *request; @@ -115,11 +102,6 @@ else [self removeRight: SOGoRole_ObjectViewer]; - if ([[request formValueForKey: @"ObjectReader"] length] > 0) - [self appendRight: SOGoRole_ObjectReader]; - else - [self removeRight: SOGoRole_ObjectReader]; - if ([[request formValueForKey: @"ObjectEraser"] length] > 0) [self appendRight: SOGoRole_ObjectEraser]; else diff --git a/UI/MailerUI/UIxMailUserRightsEditor.m b/UI/MailerUI/UIxMailUserRightsEditor.m index 08942a3ef..c9d3853cb 100644 --- a/UI/MailerUI/UIxMailUserRightsEditor.m +++ b/UI/MailerUI/UIxMailUserRightsEditor.m @@ -42,19 +42,6 @@ return [userRights containsObject: SOGoRole_ObjectViewer]; } -- (void) setUserCanReadMails: (BOOL) userCanReadMails -{ - if (userCanReadMails) - [self appendRight: SOGoRole_ObjectReader]; - else - [self removeRight: SOGoRole_ObjectReader]; -} - -- (BOOL) userCanReadMails -{ - return [userRights containsObject: SOGoRole_ObjectReader]; -} - - (void) setUserCanMarkMailsRead: (BOOL) userCanMarkMailsRead { if (userCanMarkMailsRead) @@ -183,11 +170,6 @@ else [self removeRight: SOGoRole_ObjectViewer]; - if ([[request formValueForKey: SOGoRole_ObjectReader] length] > 0) - [self appendRight: SOGoRole_ObjectReader]; - else - [self removeRight: SOGoRole_ObjectReader]; - if ([[request formValueForKey: SOGoMailRole_SeenKeeper] length] > 0) [self appendRight: SOGoMailRole_SeenKeeper]; else diff --git a/UI/MainUI/product.plist b/UI/MainUI/product.plist index 3eb0a70d5..05ffd1464 100644 --- a/UI/MainUI/product.plist +++ b/UI/MainUI/product.plist @@ -21,31 +21,44 @@ defaultRoles = { "View" = ( "Owner", "ObjectViewer" ); "Change Images And Files" = ( "Owner", "ObjectEditor" ); - "Access Contents Information" = ( "Owner", "ObjectReader" ); + "Access Object" = ( "Owner", "ObjectViewer", "ObjectEditor", "ObjectCreator", "ObjectEraser" ); + "Access Contents Information" = ( "Owner", "ObjectViewer" ); "Add Documents, Images, and Files" = ( "Owner", "ObjectCreator" ); "Add Folders" = ( "Owner", "FolderCreator" ); "ReadAcls" = ( "Owner" ); "SaveAcls" = ( "Owner" ); "Delete Objects" = ( "Owner", "ObjectEraser" ); + "WebDAV Access" = ( "Owner", "ObjectViewer", "ObjectEditor", "ObjectCreator", "ObjectEraser" ); }; }; SOGoContentObject = { superclass = "SOGoObject"; + defaultAccess = "Access Contents Information"; protectedBy = "Access Object"; defaultRoles = { - "Access Object" = ( "Owner", "ObjectViewer" ); - "Access Contents Information" = ( "Owner", "ObjectViewer" ); - "Change Images And Files" = ( "Owner", "ObjectEditor" ); + "Access Contents Information" = ( "Owner", "ObjectViewer", "ObjectEditor" ); + "Change Images And Files" = ( "Owner", "ObjectEditor" ); + }; + methods = { + DELETE = { + protectedBy = "Delete Objects"; + }; + GET = { + protectedBy = "Access Contents Information"; + }; + PUT = { + protectedBy = "Change Images And Files"; + }; }; }; + SOGoFolder = { superclass = "SOGoObject"; protectedBy = "Access Object"; defaultRoles = { "Change Images And Files" = ( "Owner", "ObjectEditor" ); - "WebDAV Access" = ( "Owner", "AuthorizedSubscriber" ); - "Access Object" = ( "Owner", "ObjectViewer" ); - "Access Contents Information" = ( "Owner", "ObjectViewer" ); + "View" = ( "Owner", "ObjectViewer", "ObjectEditor" ); + "Access Contents Information" = ( "Owner", "ObjectViewer", "ObjectEditor" ); }; }; SOGoParentFolder = { diff --git a/UI/Templates/ContactsUI/UIxContactsUserRightsEditor.wox b/UI/Templates/ContactsUI/UIxContactsUserRightsEditor.wox index 620cfd20a..5ed6a6b19 100644 --- a/UI/Templates/ContactsUI/UIxContactsUserRightsEditor.wox +++ b/UI/Templates/ContactsUI/UIxContactsUserRightsEditor.wox @@ -27,21 +27,16 @@ var:checked="userCanCreateObjects"/>
+ +

- -
- -