See ChangeLog

Monotone-Parent: 8ff4e6d2b420caded81d7317c1170ff6ce35249e
Monotone-Revision: 2b7803f8e993e96ff4490197722ef0a2a5faad70

Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2012-04-18T17:39:11
This commit is contained in:
Ludovic Marcotte committed 2012-04-18 17:39:11 +00:00
1 parent 045363c72e
commit dbd99fac84
12 files changed
+170 -43

No files matched your search

+2 -2
View File
@@ -102,8 +102,8 @@
- (void) removeFolderSettings: (NSMutableDictionary *) moduleSettings
withReference: (NSString *) reference;
- (BOOL) subscribeUser: (NSString *) subscribingUser
reallyDo: (BOOL) reallyDo;
- (BOOL) subscribeUserOrGroup: (NSString *) theIdentifier
reallyDo: (BOOL) reallyDo;
- (BOOL) userIsSubscriber: (NSString *) subscribingUser;
- (void) initializeQuickTablesAclsInContext: (WOContext *) localContext;
+39 -11
View File
@@ -840,19 +840,48 @@ static NSArray *childRecordFields = nil;
return [folderSubscription containsObject: [self folderReference]];
}
- (BOOL) subscribeUser: (NSString *) subscribingUser
reallyDo: (BOOL) reallyDo
- (BOOL) subscribeUserOrGroup: (NSString *) theIdentifier
reallyDo: (BOOL) reallyDo
{
NSMutableDictionary *moduleSettings;
NSMutableArray *folderSubscription;
NSString *subscriptionPointer;
NSMutableArray *allUsers;
SOGoUserSettings *us;
NSMutableDictionary *moduleSettings;
NSDictionary *dict;
SOGoUser *sogoUser;
BOOL rc;
int i;
sogoUser = [SOGoUser userWithLogin: subscribingUser roles: nil];
if (sogoUser)
dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: theIdentifier];
if ([[dict objectForKey: @"isGroup"] boolValue])
{
SOGoGroup *aGroup;
aGroup = [SOGoGroup groupWithIdentifier: theIdentifier
inDomain: [[context activeUser] domain]];
allUsers = [NSMutableArray arrayWithArray: [aGroup members]];
// We remove the active user from the group (if present) in order to
// not subscribe him to his own resource!
[allUsers removeObject: [context activeUser]];
}
else
{
sogoUser = [SOGoUser userWithLogin: theIdentifier roles: nil];
if (sogoUser)
allUsers = [NSArray arrayWithObject: sogoUser];
else
allUsers = [NSArray array];
}
rc = NO;
for (i = 0; i < [allUsers count]; i++)
{
sogoUser = [allUsers objectAtIndex: i];
us = [sogoUser userSettings];
moduleSettings = [us objectForKey: [container nameInContainer]];
if (!(moduleSettings
@@ -883,14 +912,13 @@ static NSArray *childRecordFields = nil;
[self removeFolderSettings: moduleSettings
withReference: subscriptionPointer];
[folderSubscription removeObject: subscriptionPointer];
}
}
[us synchronize];
rc = YES;
}
else
rc = NO;
return rc;
}
@@ -945,8 +973,8 @@ static NSArray *childRecordFields = nil;
LDAP call but more importantly, cache propagation calls that will
create contention on GDNC. */
for (count = 0; count < max; count++)
[self subscribeUser: [delegatedUsers objectAtIndex: count]
reallyDo: reallyDo];
[self subscribeUserOrGroup: [delegatedUsers objectAtIndex: count]
reallyDo: reallyDo];
}
else
{
@@ -965,7 +993,7 @@ static NSArray *childRecordFields = nil;
@"You cannot (un)subscribe to a folder that you own!"];
}
else
[self subscribeUser: userLogin reallyDo: reallyDo];
[self subscribeUserOrGroup: userLogin reallyDo: reallyDo];
}
return response;
+10 -1
View File
@@ -23,7 +23,6 @@
/*
Here are some group samples:
[ POSIX group ]
dn: cn=it-staff,ou=Group,dc=zzz,dc=xxx,dc=yyy
@@ -43,6 +42,16 @@
memberUid: hbt
memberUid: hossein
dn: cn=inverse,ou=groups,dc=inverse,dc=ca
objectClass: groupOfUniqueNames
objectClass: top
objectClass: extensibleObject
uniqueMember: uid=flachapelle,ou=users,dc=inverse,dc=ca
uniqueMember: uid=lmarcotte,ou=users,dc=inverse,dc=ca
uniqueMember: uid=wsourdeau,ou=users,dc=inverse,dc=ca
cn: inverse
mail: inverse@inverse.ca
*/
#include "SOGoGroup.h"
+48 -13
View File
@@ -251,7 +251,7 @@ static SoSecurityManager *sm = nil;
return nil;
}
- (void) _appendSubscribedSource: (NSString *) sourceKey
- (BOOL) _appendSubscribedSource: (NSString *) sourceKey
{
SOGoGCSFolder *subscribedFolder;
@@ -262,32 +262,67 @@ static SoSecurityManager *sm = nil;
&& ![sm validatePermission: SOGoPerm_AccessObject
onObject: subscribedFolder
inContext: context])
[subscribedSubFolders setObject: subscribedFolder
forKey: [subscribedFolder nameInContainer]];
{
[subscribedSubFolders setObject: subscribedFolder
forKey: [subscribedFolder nameInContainer]];
return YES;
}
return NO;
}
- (NSException *) appendSubscribedSources
{
NSArray *subscribedReferences;
SOGoUser *ownerUser;
NSMutableDictionary *folderDisplayNames;
NSMutableArray *subscribedReferences;
SOGoUserSettings *settings;
NSEnumerator *allKeys;
NSString *currentKey;
SOGoUser *ownerUser;
NSException *error;
id o;
BOOL dirty;
error = nil; /* we ignore non-DB errors at this time... */
dirty = NO;
ownerUser = [SOGoUser userWithLogin: owner];
settings = [ownerUser userSettings];
subscribedReferences = [[settings objectForKey: nameInContainer]
objectForKey: @"SubscribedFolders"];
if ([subscribedReferences isKindOfClass: [NSArray class]])
{
allKeys = [subscribedReferences objectEnumerator];
while ((currentKey = [allKeys nextObject]))
[self _appendSubscribedSource: currentKey];
}
subscribedReferences = [NSMutableArray arrayWithArray: [[settings objectForKey: nameInContainer]
objectForKey: @"SubscribedFolders"]];
o = [[settings objectForKey: nameInContainer] objectForKey: @"FolderDisplayNames"];
folderDisplayNames = nil;
if (o)
folderDisplayNames = [NSMutableDictionary dictionaryWithDictionary: o];
allKeys = [subscribedReferences objectEnumerator];
while ((currentKey = [allKeys nextObject]))
{
if (![self _appendSubscribedSource: currentKey])
{
// We no longer have access to this subscription, let's
// remove it from the current list.
[subscribedReferences removeObject: currentKey];
[folderDisplayNames removeObjectForKey: currentKey];
dirty = YES;
}
}
// If we changed the folder subscribtion list, we must sync it
if (dirty)
{
id o;
[[settings objectForKey: nameInContainer] setObject: subscribedReferences
forKey: @"SubscribedFolders"];
[[settings objectForKey: nameInContainer] setObject: folderDisplayNames
forKey: @"FolderDisplayNames"];
}
return error;
}
+4
View File
@@ -306,6 +306,10 @@
return allEmails;
}
//
// We always return the last object among our list of email addresses. This value
// is always added in SOGoUserManager: -_fillContactMailRecords:
//
- (NSString *) systemEmail
{
if (!allEmails)
+13 -4
View File
@@ -572,6 +572,9 @@
= [NSString stringWithFormat: @"%@@%@", uid, [dd mailDomain]];
else
systemEmail = uid;
// We always add the system email, which will always be returned
// by SOGoUser -systemEmail.
[emails addObject: systemEmail];
[contact setObject: [emails objectAtIndex: 0] forKey: @"c_email"];
}
@@ -583,11 +586,12 @@
withUIDorEmail: (NSString *) uid
inDomain: (NSString *) domain
{
NSMutableArray *emails;
NSDictionary *userEntry;
NSEnumerator *sogoSources;
NSObject <SOGoSource> *currentSource;
NSString *sourceID, *cn, *c_domain, *c_uid, *c_imaphostname, *c_imaplogin;
NSObject <SOGoSource> *currentSource;
NSEnumerator *sogoSources;
NSDictionary *userEntry;
NSMutableArray *emails;
NSNumber *isGroup;
NSArray *c_emails;
BOOL access;
@@ -635,6 +639,11 @@
if (!access)
[currentUser setObject: [NSNumber numberWithBool: NO]
forKey: @"MailAccess"];
// We check if it's a group
isGroup = [userEntry objectForKey: @"isGroup"];
if (isGroup)
[currentUser setObject: isGroup forKey: @"isGroup"];
// We also fill the resource attributes, if any
if ([userEntry objectForKey: @"isResource"])