diff --git a/Documentation/SOGoInstallationGuide.asciidoc b/Documentation/SOGoInstallationGuide.asciidoc index f57e77c25..879d1dde7 100644 --- a/Documentation/SOGoInstallationGuide.asciidoc +++ b/Documentation/SOGoInstallationGuide.asciidoc @@ -684,6 +684,9 @@ Possible values are: Defaults to `NO` when unset. +|S |SOGoDisableSharing +|List of modules where sharing should be disabled, for example `(Mail, Calendar)`. Modules can be `Mail`, `Contacts` and `Calendar`. Default value empty list (sharing enabled for everybody). + |S |SOGoPasswordChangeEnabled |Parameter used to allow or not users to change their passwords from SOGo. diff --git a/SoObjects/SOGo/SOGoSystemDefaults.h b/SoObjects/SOGo/SOGoSystemDefaults.h index adcf9f070..bb9f0ebbf 100644 --- a/SoObjects/SOGo/SOGoSystemDefaults.h +++ b/SoObjects/SOGo/SOGoSystemDefaults.h @@ -22,6 +22,11 @@ #define SOGOSYSTEMDEFAULTS_H #import +#import + +static const NSString *kDisableSharingMail = @"Mail"; +static const NSString *kDisableSharingContacts = @"Contacts"; +static const NSString *kDisableSharingCalendar = @"Calendar"; @interface SOGoSystemDefaults : SOGoDomainDefaults { @@ -121,6 +126,8 @@ - (NSArray *) passwordRecoveryDomains; - (NSString *) JWTSecret; +- (NSArray *) disableSharing; + @end #endif /* SOGOSYSTEMDEFAULTS_H */ diff --git a/SoObjects/SOGo/SOGoSystemDefaults.m b/SoObjects/SOGo/SOGoSystemDefaults.m index 6ad003906..fbd18c7db 100644 --- a/SoObjects/SOGo/SOGoSystemDefaults.m +++ b/SoObjects/SOGo/SOGoSystemDefaults.m @@ -791,5 +791,18 @@ _injectConfigurationFromFile (NSMutableDictionary *defaultsDict, return secret; } +- (NSArray *) disableSharing +{ + static NSArray *disableSharing = nil; + + if (!disableSharing) + { + disableSharing = [self stringArrayForKey: @"SOGoDisableSharing"]; + [disableSharing retain]; + } + + return disableSharing; +} + @end diff --git a/UI/Common/UIxUserRightsEditor.m b/UI/Common/UIxUserRightsEditor.m index 941a2be88..d03bee896 100644 --- a/UI/Common/UIxUserRightsEditor.m +++ b/UI/Common/UIxUserRightsEditor.m @@ -29,6 +29,7 @@ #import #import #import +#import #import @@ -258,12 +259,35 @@ NSDictionary *currentUser, *jsonResponse;; NSEnumerator *usersList; NSString *currentUid; - NSArray *o; + NSArray *o, *reqPathArray; + SOGoSystemDefaults *sd; request = [[self context] request]; response = [self responseWithStatus: 200]; users = [[request contentAsString] objectFromJSONString]; usersList = [users objectEnumerator]; + reqPathArray = [request requestHandlerPathArray]; + sd = [SOGoSystemDefaults sharedSystemDefaults]; + + // Disable sharing + if (NSNotFound != [reqPathArray indexOfObject: kDisableSharingMail] + && nil != [sd disableSharing] + && NSNotFound != [[sd disableSharing] indexOfObject: kDisableSharingMail]) { + response = [self responseWithStatus: 403]; + return response; + } + if (NSNotFound != [reqPathArray indexOfObject: kDisableSharingContacts] + && nil != [sd disableSharing] + && NSNotFound != [[sd disableSharing] indexOfObject: kDisableSharingContacts]) { + response = [self responseWithStatus: 403]; + return response; + } + if (NSNotFound != [reqPathArray indexOfObject: kDisableSharingCalendar] + && nil != [sd disableSharing] + && NSNotFound != [[sd disableSharing] indexOfObject: kDisableSharingCalendar]) { + response = [self responseWithStatus: 403]; + return response; + } while ((currentUser = [usersList nextObject])) { diff --git a/UI/Contacts/UIxContactFoldersView.m b/UI/Contacts/UIxContactFoldersView.m index 50efa560d..87ad98f0f 100644 --- a/UI/Contacts/UIxContactFoldersView.m +++ b/UI/Contacts/UIxContactFoldersView.m @@ -493,6 +493,20 @@ Class SOGoContactSourceFolderK, SOGoGCSFolderK; return [self responseWithStatus: 204]; } +- (BOOL) isContactSharingEnabled { + BOOL result; + SOGoSystemDefaults *sd; + + result = YES; + sd = [SOGoSystemDefaults sharedSystemDefaults]; + if (nil != [sd disableSharing] + && NSNotFound != [[sd disableSharing] indexOfObject: kDisableSharingContacts]) { + result = NO; + } + + return result; +} + - (id) defaultAction { // NSString *check; diff --git a/UI/MailerUI/UIxMailMainFrame.m b/UI/MailerUI/UIxMailMainFrame.m index 73d62e5f4..caa4275aa 100644 --- a/UI/MailerUI/UIxMailMainFrame.m +++ b/UI/MailerUI/UIxMailMainFrame.m @@ -42,6 +42,7 @@ #import #import #import +#import #import #import #import @@ -582,6 +583,20 @@ return _currentLabel; } +- (BOOL) isMailSharingEnabled { + BOOL result; + SOGoSystemDefaults *sd; + + result = YES; + sd = [SOGoSystemDefaults sharedSystemDefaults]; + if (nil != [sd disableSharing] + && NSNotFound != [[sd disableSharing] indexOfObject: kDisableSharingMail]) { + result = NO; + } + + return result; +} + @end /* UIxMailMainFrame */ @interface UIxMailFolderTemplate : UIxComponent diff --git a/UI/Scheduler/UIxCalMainView.m b/UI/Scheduler/UIxCalMainView.m index 38b358177..450b7c14c 100644 --- a/UI/Scheduler/UIxCalMainView.m +++ b/UI/Scheduler/UIxCalMainView.m @@ -32,6 +32,7 @@ #import #import #import +#import #import @@ -361,6 +362,20 @@ return repeatFrequencies; } +- (BOOL) isCalendarSharingEnabled { + BOOL result; + SOGoSystemDefaults *sd; + + result = YES; + sd = [SOGoSystemDefaults sharedSystemDefaults]; + if (nil != [sd disableSharing] + && NSNotFound != [[sd disableSharing] indexOfObject: kDisableSharingCalendar]) { + result = NO; + } + + return result; +} + @end /* Component Viewer, parent class of Appointment Viewer and Task Viewer */ diff --git a/UI/Templates/ContactsUI/UIxContactFoldersView.wox b/UI/Templates/ContactsUI/UIxContactFoldersView.wox index e33588a2f..04a902328 100644 --- a/UI/Templates/ContactsUI/UIxContactFoldersView.wox +++ b/UI/Templates/ContactsUI/UIxContactFoldersView.wox @@ -109,12 +109,14 @@ - - - - - - + + + + + + + + diff --git a/UI/Templates/MailerUI/UIxMailMainFrame.wox b/UI/Templates/MailerUI/UIxMailMainFrame.wox index f2644bf90..b5edda3c1 100644 --- a/UI/Templates/MailerUI/UIxMailMainFrame.wox +++ b/UI/Templates/MailerUI/UIxMailMainFrame.wox @@ -279,12 +279,14 @@ - - - - - - + + + + + + + + diff --git a/UI/Templates/SchedulerUI/UIxCalMainView.wox b/UI/Templates/SchedulerUI/UIxCalMainView.wox index 9de8a6f8f..ab4714d65 100644 --- a/UI/Templates/SchedulerUI/UIxCalMainView.wox +++ b/UI/Templates/SchedulerUI/UIxCalMainView.wox @@ -583,15 +583,17 @@ - - - - - - - - + + + + + + + + + +