mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-20 06:03:20 +00:00
Removed tight coupling of group membership expansion and LDAPSource.
Any implementation of SOGoSource may now support group expansion by implementing the protocol MembershipAwareSource.
This commit is contained in:
@@ -27,7 +27,6 @@
|
||||
#import <SOGo/NSDictionary+Utilities.h>
|
||||
#import <SOGo/NSString+Utilities.h>
|
||||
#import <SOGo/SOGoDomainDefaults.h>
|
||||
#import <SOGo/SOGoGroup.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoUserManager.h>
|
||||
|
||||
@@ -120,10 +119,10 @@
|
||||
- (BOOL) _initRights
|
||||
{
|
||||
BOOL response;
|
||||
NSString *newUID, *domain;
|
||||
NSString *newUID;
|
||||
SOGoUserManager *um;
|
||||
SOGoObject *clientObject;
|
||||
SOGoGroup *group;
|
||||
NSDictionary *dict;
|
||||
|
||||
response = NO;
|
||||
|
||||
@@ -140,9 +139,8 @@
|
||||
{
|
||||
if (![newUID hasPrefix: @"@"])
|
||||
{
|
||||
domain = [[context activeUser] domain];
|
||||
group = [SOGoGroup groupWithIdentifier: newUID inDomain: domain];
|
||||
if (group)
|
||||
dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: newUID];
|
||||
if (dict && [[dict objectForKey: @"isGroup"] boolValue])
|
||||
newUID = [NSString stringWithFormat: @"@%@", newUID];
|
||||
}
|
||||
ASSIGN (uid, newUID);
|
||||
@@ -158,10 +156,9 @@
|
||||
- (BOOL) _initRightsForUserID:(NSString *) newUID
|
||||
{
|
||||
BOOL response;
|
||||
NSString *domain;
|
||||
SOGoUserManager *um;
|
||||
SOGoObject *clientObject;
|
||||
SOGoGroup *group;
|
||||
NSDictionary *dict;
|
||||
|
||||
response = NO;
|
||||
|
||||
@@ -174,11 +171,11 @@
|
||||
if ([newUID isEqualToString: defaultUserID] || [newUID isEqualToString: @"anonymous"]
|
||||
|| [[um getEmailForUID: newUID] length] > 0)
|
||||
{
|
||||
#warning Duplicated code from _initRights
|
||||
if (![newUID hasPrefix: @"@"])
|
||||
{
|
||||
domain = [[context activeUser] domain];
|
||||
group = [SOGoGroup groupWithIdentifier: newUID inDomain: domain];
|
||||
if (group)
|
||||
dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: newUID];
|
||||
if (dict && [[dict objectForKey: @"isGroup"] boolValue])
|
||||
newUID = [NSString stringWithFormat: @"@%@", newUID];
|
||||
}
|
||||
ASSIGN (uid, newUID);
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
#import <SOGo/NSArray+Utilities.h>
|
||||
#import <SOGo/NSCalendarDate+SOGo.h>
|
||||
#import <SOGo/NSDictionary+Utilities.h>
|
||||
#import <SOGo/LDAPSource.h>
|
||||
#import <SOGo/SOGoGroup.h>
|
||||
#import <SOGo/SOGoSource.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoUserDefaults.h>
|
||||
@@ -409,13 +407,9 @@
|
||||
|
||||
if ([[dict objectForKey: @"isGroup"] boolValue])
|
||||
{
|
||||
if ([source isKindOfClass: [LDAPSource class]] && [(LDAPSource *) source groupExpansionEnabled])
|
||||
if ([source conformsToProtocol:@protocol(MembershipAwareSource)])
|
||||
{
|
||||
SOGoGroup *aGroup;
|
||||
|
||||
aGroup = [SOGoGroup groupWithIdentifier: [contact nameInContainer]
|
||||
inDomain: [[context activeUser] domain]];
|
||||
allUsers = [aGroup members]; // array of SOGoUser objects
|
||||
allUsers = [(id<MembershipAwareSource>)(source) membersForGroupWithUID: [dict objectForKey: @"c_uid"]];
|
||||
max = [allUsers count];
|
||||
allUsersData = [NSMutableArray arrayWithCapacity: max];
|
||||
for (i = 0; i < max; i++)
|
||||
|
||||
Reference in New Issue
Block a user