From dfb3f58de2ad1d55bc979752ea0e95aedfcfe92a Mon Sep 17 00:00:00 2001 From: wolfgang Date: Thu, 29 Nov 2007 16:15:37 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1282 d1b88da0-ebda-0310-925b-ed51d893ca5b --- ChangeLog | 6 ++++++ SoObjects/Appointments/SOGoAppointmentFolder.m | 18 ++++++++++++++++++ SoObjects/Appointments/product.plist | 1 - SoObjects/Contacts/SOGoContactLDAPFolder.m | 13 +++++++++---- SoObjects/Mailer/SOGoMailFolder.m | 10 ++++++++++ SoObjects/Mailer/product.plist | 6 ------ SoObjects/SOGo/SOGoFolder.m | 8 ++++++++ SoObjects/SOGo/SOGoGCSFolder.m | 5 +---- SoObjects/SOGo/SOGoObject.h | 2 ++ SoObjects/SOGo/SOGoObject.m | 6 ++++++ SoObjects/SOGo/SOGoUser.m | 5 ++++- UI/MainUI/product.plist | 3 +-- 12 files changed, 65 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index ac7004ae..716be005 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-11-29 Wolfgang Sourdeau + + * SoObjects/SOGo/SOGoObject.m ([SOGoObject -subscriptionRoles]): + new method that returns the roles that qualifies for adding the + special "authorized subscribed" sogo role. + 2007-11-27 Wolfgang Sourdeau * SoObjects/SOGo/SOGoContentObject.m ([SOGoContentObject diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index 48c9478c..f4753e7c 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -775,6 +775,24 @@ static NSNumber *sharedYes = nil; return privacySqlString; } +- (NSArray *) subscriptionRoles +{ + return [NSArray arrayWithObjects: + SOGoRole_ObjectCreator, SOGoRole_ObjectEraser, + SOGoCalendarRole_PublicResponder, + SOGoCalendarRole_PublicModifier, + SOGoCalendarRole_PublicViewer, + SOGoCalendarRole_PublicDAndTViewer, + SOGoCalendarRole_PrivateResponder, + SOGoCalendarRole_PrivateModifier, + SOGoCalendarRole_PrivateViewer, + SOGoCalendarRole_PrivateDAndTViewer, + SOGoCalendarRole_ConfidentialResponder, + SOGoCalendarRole_ConfidentialModifier, + SOGoCalendarRole_ConfidentialViewer, + SOGoCalendarRole_ConfidentialDAndTViewer, nil]; +} + - (NSString *) roleForComponentsWithAccessClass: (iCalAccessClass) accessClass forUser: (NSString *) uid { diff --git a/SoObjects/Appointments/product.plist b/SoObjects/Appointments/product.plist index 6b2ecb32..538ad319 100644 --- a/SoObjects/Appointments/product.plist +++ b/SoObjects/Appointments/product.plist @@ -39,7 +39,6 @@ "ViewDAndT" = ( "Organizer", "Participant", "ComponentDAndTViewer" ); "ModifyComponent" = ( "Owner", "Organizer" ); "RespondToComponent" = ( "Participant" ); - "Access Object" = ( "Owner", "Organizer", "Participant", "ComponentModifier", "ComponentResponder", "ComponentViewer", "ComponentDAndTViewer" ); }; }; SOGoAppointmentObject = { diff --git a/SoObjects/Contacts/SOGoContactLDAPFolder.m b/SoObjects/Contacts/SOGoContactLDAPFolder.m index b35f0d0d..a23f09a5 100644 --- a/SoObjects/Contacts/SOGoContactLDAPFolder.m +++ b/SoObjects/Contacts/SOGoContactLDAPFolder.m @@ -26,21 +26,21 @@ #import #import -#import #import +#import #import #import +#import #import +#import #import #import +#import #import #import #import "SOGoContactLDIFEntry.h" #import "SOGoContactLDAPFolder.h" -#import -#import -#import @class WOContext; @@ -303,6 +303,11 @@ return @"nobody"; } +- (NSArray *) subscriptionRoles +{ + return [NSArray arrayWithObject: SoRole_Authenticated]; +} + /* TODO: this might change one day when we support LDAP acls */ - (NSArray *) aclsForUser: (NSString *) uid { diff --git a/SoObjects/Mailer/SOGoMailFolder.m b/SoObjects/Mailer/SOGoMailFolder.m index a0cff9ec..1486c00c 100644 --- a/SoObjects/Mailer/SOGoMailFolder.m +++ b/SoObjects/Mailer/SOGoMailFolder.m @@ -544,6 +544,16 @@ static NSString *defaultUserID = @"anyone"; [mailboxACL retain]; } +- (NSArray *) subscriptionRoles +{ + return [NSArray arrayWithObjects: SOGoRole_ObjectViewer, + SOGoMailRole_SeenKeeper, SOGoMailRole_Writer, + SOGoRole_ObjectCreator, SOGoMailRole_Poster, + SOGoRole_FolderCreator, SOGoRole_FolderEraser, + SOGoRole_ObjectEraser, SOGoMailRole_Expunger, + SOGoMailRole_Administrator, nil]; +} + - (NSArray *) aclUsers { NSArray *users; diff --git a/SoObjects/Mailer/product.plist b/SoObjects/Mailer/product.plist index 238a6229..88954481 100644 --- a/SoObjects/Mailer/product.plist +++ b/SoObjects/Mailer/product.plist @@ -19,8 +19,6 @@ "Add Documents, Images, and Files" = ( "Owner", "ObjectCreator" ); "Delete Objects" = ( "Owner", "ObjectEraser" ); "WebDAV Access" = ( "Owner", "AuthorizedSubscriber" ); - "ReadAcls" = ( "Owner", "AuthorizedSubscriber" ); - "SaveAcls" = ( "Owner" ); }; }; SOGoMailAccount = { @@ -31,8 +29,6 @@ "Add Documents, Images, and Files" = ( "Owner", "ObjectCreator" ); "Delete Objects" = ( "Owner", "ObjectEraser" ); "WebDAV Access" = ( "Owner", "AuthorizedSubscriber" ); - "ReadAcls" = ( "Owner", "AuthorizedSubscriber" ); - "SaveAcls" = ( "Owner" ); }; }; SOGoSharedMailAccount = { @@ -46,8 +42,6 @@ "Add Documents, Images, and Files" = ( "Owner", "ObjectCreator" ); "Delete Objects" = ( "Owner", "ObjectEraser" ); "WebDAV Access" = ( "Owner", "ObjectViewer" ); - "ReadAcls" = ( "Owner", "ObjectViewer" ); - "SaveAcls" = ( "Owner", "MailAdministrator" ); }; }; SOGoSharedInboxFolder = { diff --git a/SoObjects/SOGo/SOGoFolder.m b/SoObjects/SOGo/SOGoFolder.m index 0f481510..1460deb1 100644 --- a/SoObjects/SOGo/SOGoFolder.m +++ b/SoObjects/SOGo/SOGoFolder.m @@ -30,6 +30,7 @@ #import "NSString+Utilities.h" +#import "SOGoPermissions.h" #import "SOGoFolder.h" @implementation SOGoFolder @@ -241,6 +242,13 @@ /* acls */ +- (NSArray *) subscriptionRoles +{ + return [NSArray arrayWithObjects: SoRole_Owner, SOGoRole_ObjectViewer, + SOGoRole_ObjectEditor, SOGoRole_ObjectCreator, + SOGoRole_ObjectEraser, nil]; +} + - (NSArray *) aclsForUser: (NSString *) uid { return nil; diff --git a/SoObjects/SOGo/SOGoGCSFolder.m b/SoObjects/SOGo/SOGoGCSFolder.m index 8eb59067..1698d06d 100644 --- a/SoObjects/SOGo/SOGoGCSFolder.m +++ b/SoObjects/SOGo/SOGoGCSFolder.m @@ -452,10 +452,7 @@ static NSString *defaultUserID = @""; acls = [NSMutableArray array]; if ([records count] > 0) - { - [acls addObject: SOGoRole_AuthorizedSubscriber]; - [acls addObjectsFromArray: [records valueForKey: @"c_role"]]; - } + [acls addObjectsFromArray: [records valueForKey: @"c_role"]]; return acls; } diff --git a/SoObjects/SOGo/SOGoObject.h b/SoObjects/SOGo/SOGoObject.h index 5404508a..a6ff53d2 100644 --- a/SoObjects/SOGo/SOGoObject.h +++ b/SoObjects/SOGo/SOGoObject.h @@ -111,6 +111,8 @@ /* acls */ +- (NSArray *) subscriptionRoles; + - (NSArray *) aclUsers; - (NSArray *) aclsForUser: (NSString *) uid; - (void) setRoles: (NSArray *) roles diff --git a/SoObjects/SOGo/SOGoObject.m b/SoObjects/SOGo/SOGoObject.m index 3b8f9ca2..ff29a3c4 100644 --- a/SoObjects/SOGo/SOGoObject.m +++ b/SoObjects/SOGo/SOGoObject.m @@ -830,6 +830,12 @@ static BOOL kontactGroupDAV = YES; /* acls */ +/* roles required to obtain the "authorized subscriber" role */ +- (NSArray *) subscriptionRoles +{ + return [container subscriptionRoles]; +} + - (NSArray *) aclUsers { [self subclassResponsibility: _cmd]; diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index bdf37fa0..9c7bd9d3 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -604,8 +604,11 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek"; if ([object isKindOfClass: [SOGoObject class]]) { sogoRoles = [(SOGoObject *) object aclsForUser: login]; - if (sogoRoles) + if ([sogoRoles count]) [rolesForObject addObjectsFromArray: sogoRoles]; + sogoRoles = [(SOGoObject *) object subscriptionRoles]; + if ([sogoRoles firstObjectCommonWithArray: rolesForObject]) + [rolesForObject addObject: SOGoRole_AuthorizedSubscriber]; } return rolesForObject; diff --git a/UI/MainUI/product.plist b/UI/MainUI/product.plist index 05ffd146..cac3981e 100644 --- a/UI/MainUI/product.plist +++ b/UI/MainUI/product.plist @@ -21,7 +21,7 @@ defaultRoles = { "View" = ( "Owner", "ObjectViewer" ); "Change Images And Files" = ( "Owner", "ObjectEditor" ); - "Access Object" = ( "Owner", "ObjectViewer", "ObjectEditor", "ObjectCreator", "ObjectEraser" ); + "Access Object" = ( "Owner", "AuthorizedSubscriber" ); "Access Contents Information" = ( "Owner", "ObjectViewer" ); "Add Documents, Images, and Files" = ( "Owner", "ObjectCreator" ); "Add Folders" = ( "Owner", "FolderCreator" ); @@ -51,7 +51,6 @@ }; }; }; - SOGoFolder = { superclass = "SOGoObject"; protectedBy = "Access Object"; -- 2.39.5