feat(core): Add SOGoDisableSharing option to disable sharing for mail, contacts and calendar

This commit is contained in:
smizrahi
2022-12-12 12:03:59 +01:00
parent 5d6b40c8cf
commit 435495f007
10 changed files with 119 additions and 22 deletions
+25 -1
View File
@@ -29,6 +29,7 @@
#import <SOGo/SOGoDomainDefaults.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserManager.h>
#import <SOGo/SOGoSystemDefaults.h>
#import <UI/SOGoUI/SOGoACLAdvisory.h>
@@ -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]))
{