From cfac03935f8dc3f5052f641f01f134a5058885c2 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 1 Jun 2007 21:03:50 +0000 Subject: [PATCH] Monotone-Parent: 46a08848069e50e55115c60ffb756cc911fa4310 Monotone-Revision: b9fe5f69982d5b9b75bf023532dd4a76d1435875 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-06-01T21:03:50 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 5 +++++ SoObjects/SOGo/SOGoFolder.m | 23 +++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 53b0e1f36..7cefe4651 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2007-06-01 Wolfgang Sourdeau + * SoObjects/SOGo/SOGoFolder.m ([SOGoFolder -aclsForUser:uid]): if + the user has the "ObjectReader" role on the parent container, then + he is granted the "ObjectViewer" role on this object. Same for + "ObjectEraser", although this might change later. + * UI/Scheduler/UIxComponentEditor.m ([UIxComponentEditor -toolbar]): determine the toolbar filename based on the permissions declared by the securitymanager. The role mechanism diff --git a/SoObjects/SOGo/SOGoFolder.m b/SoObjects/SOGo/SOGoFolder.m index 8b1e08cb5..6dc6f4f07 100644 --- a/SoObjects/SOGo/SOGoFolder.m +++ b/SoObjects/SOGo/SOGoFolder.m @@ -434,8 +434,27 @@ static NSString *defaultUserID = @""; - (NSArray *) aclsForUser: (NSString *) uid { - return [self aclsForUser: uid - forObjectAtPath: [self pathArrayToSoObject]]; + NSMutableArray *acls; + NSArray *ownAcls, *containerAcls; + + acls = [NSMutableArray array]; + ownAcls = [self aclsForUser: uid + forObjectAtPath: [self pathArrayToSoObject]]; + [acls addObjectsFromArray: ownAcls]; + if ([container respondsToSelector: @selector (aclsForUser:)]) + { + 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]; + } + } + + return acls; } - (void) setRoles: (NSArray *) roles