mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-28 21:35:43 +00:00
feat(core): Add SOGoDisableSharingAnyAuthUser option to disable sharing to any user authenticated for mail, contacts and calendar
This commit is contained in:
1 parent
6e60b10755
commit
e0ef59d5f2
5 files changed
+67
-1
No files matched your search
@@ -101,7 +101,11 @@
|
||||
NSDictionary *currentUserInfos;
|
||||
NSMutableDictionary *userData;
|
||||
id <WOActionResults> result;
|
||||
WORequest *request;
|
||||
NSArray *reqPathArray;
|
||||
NSEnumerator *aclsEnum;
|
||||
BOOL defaultUserDisable;
|
||||
SOGoSystemDefaults *sd;
|
||||
|
||||
if (!prepared)
|
||||
{
|
||||
@@ -142,8 +146,27 @@
|
||||
}
|
||||
|
||||
// Add the 'Any authenticated' user
|
||||
if (defaultUserID)
|
||||
request = [[self context] request];
|
||||
reqPathArray = [request requestHandlerPathArray];
|
||||
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
||||
if (NSNotFound != [reqPathArray indexOfObject: kDisableSharingMail]
|
||||
&& nil != [sd disableSharingAnyAuthUser]
|
||||
&& NSNotFound != [[sd disableSharingAnyAuthUser] indexOfObject: kDisableSharingMail]) {
|
||||
defaultUserDisable = YES;
|
||||
}
|
||||
if (NSNotFound != [reqPathArray indexOfObject: kDisableSharingContacts]
|
||||
&& nil != [sd disableSharingAnyAuthUser]
|
||||
&& NSNotFound != [[sd disableSharingAnyAuthUser] indexOfObject: kDisableSharingContacts]) {
|
||||
defaultUserDisable = YES;
|
||||
}
|
||||
if (NSNotFound != [reqPathArray indexOfObject: kDisableSharingCalendar]
|
||||
&& nil != [sd disableSharingAnyAuthUser]
|
||||
&& NSNotFound != [[sd disableSharingAnyAuthUser] indexOfObject: kDisableSharingCalendar]) {
|
||||
defaultUserDisable = YES;
|
||||
}
|
||||
if (!defaultUserDisable && defaultUserID)
|
||||
{
|
||||
|
||||
userData = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
defaultUserID, @"uid",
|
||||
[self labelForKey: @"Any Authenticated User"], @"cn",
|
||||
|
||||
@@ -292,6 +292,32 @@
|
||||
while ((currentUser = [usersList nextObject]))
|
||||
{
|
||||
currentUid = [currentUser objectForKey: @"uid"];
|
||||
|
||||
//Check if we disable the fact to set rights for defaultsUser
|
||||
if (!defaultUserID)
|
||||
ASSIGN (defaultUserID, [[self clientObject] defaultUserID]);
|
||||
if([currentUid isEqualToString: defaultUserID])
|
||||
{
|
||||
if (NSNotFound != [reqPathArray indexOfObject: kDisableSharingMail]
|
||||
&& nil != [sd disableSharingAnyAuthUser]
|
||||
&& NSNotFound != [[sd disableSharingAnyAuthUser] indexOfObject: kDisableSharingMail]) {
|
||||
response = [self responseWithStatus: 403];
|
||||
return response;
|
||||
}
|
||||
if (NSNotFound != [reqPathArray indexOfObject: kDisableSharingContacts]
|
||||
&& nil != [sd disableSharingAnyAuthUser]
|
||||
&& NSNotFound != [[sd disableSharingAnyAuthUser] indexOfObject: kDisableSharingContacts]) {
|
||||
response = [self responseWithStatus: 403];
|
||||
return response;
|
||||
}
|
||||
if (NSNotFound != [reqPathArray indexOfObject: kDisableSharingCalendar]
|
||||
&& nil != [sd disableSharingAnyAuthUser]
|
||||
&& NSNotFound != [[sd disableSharingAnyAuthUser] indexOfObject: kDisableSharingCalendar]) {
|
||||
response = [self responseWithStatus: 403];
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
if (!([self _initRightsForUserID: currentUid]))
|
||||
{
|
||||
jsonResponse = [NSDictionary dictionaryWithObject: [self labelForKey: @"No such user."]
|
||||
|
||||
Reference in new issue
Block a user