mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-20 04:19:35 +00:00
See ChangeLog
Monotone-Parent: 0400894ebb0d9305dae91e6efb9e8a62a36e6d5b Monotone-Revision: 814be30289e980e05d1340e3dc8d3bad9155344d Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2008-11-18T00:06:37 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -84,7 +84,7 @@
|
||||
- (void) renameTo: (NSString *) newName;
|
||||
|
||||
- (WOResponse *) subscribe: (BOOL) reallyDo
|
||||
inTheNameOf: (NSString *) delegatedUser
|
||||
inTheNamesOf: (NSArray *) delegatedUsers
|
||||
fromMailInvitation: (BOOL) isMailInvitation
|
||||
inContext: (WOContext *) localContext;
|
||||
|
||||
|
||||
@@ -660,59 +660,72 @@ static NSArray *childRecordFields = nil;
|
||||
}
|
||||
|
||||
- (WOResponse *) subscribe: (BOOL) reallyDo
|
||||
inTheNameOf: (NSString *) delegatedUser
|
||||
inTheNamesOf: (NSArray *) delegatedUsers
|
||||
fromMailInvitation: (BOOL) isMailInvitation
|
||||
inContext: (WOContext *) localContext
|
||||
{
|
||||
WOResponse *response;
|
||||
SOGoUser *currentUser, *subscriptionUser;
|
||||
BOOL validRequest;
|
||||
SOGoUser *currentUser;
|
||||
|
||||
response = [localContext response];
|
||||
currentUser = [localContext activeUser];
|
||||
|
||||
if ([delegatedUser length])
|
||||
if (delegatedUsers && [delegatedUsers count])
|
||||
{
|
||||
validRequest = ([currentUser isSuperUser]);
|
||||
subscriptionUser = [SOGoUser userWithLogin: delegatedUser roles: nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
validRequest = YES;
|
||||
subscriptionUser = currentUser;
|
||||
}
|
||||
if (![currentUser isSuperUser])
|
||||
{
|
||||
[response setStatus: 403];
|
||||
[response appendContentString:
|
||||
@"You cannot subscribe another user to any folder"
|
||||
@" unless you are a super-user."];
|
||||
}
|
||||
else
|
||||
{
|
||||
SOGoUser *subscriptionUser;
|
||||
int i;
|
||||
|
||||
if (validRequest)
|
||||
[self _subscribeUser: subscriptionUser
|
||||
reallyDo: reallyDo
|
||||
fromMailInvitation: isMailInvitation
|
||||
inResponse: response];
|
||||
for (i = 0; i < [delegatedUsers count]; i++)
|
||||
{
|
||||
subscriptionUser = [SOGoUser userWithLogin: [delegatedUsers objectAtIndex: i]
|
||||
roles: nil];
|
||||
|
||||
[self _subscribeUser: subscriptionUser
|
||||
reallyDo: reallyDo
|
||||
fromMailInvitation: isMailInvitation
|
||||
inResponse: response];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[response setStatus: 403];
|
||||
[response appendContentString:
|
||||
@"You cannot subscribe another user to any folder"
|
||||
@" unless you are a super-user."];
|
||||
[self _subscribeUser: currentUser
|
||||
reallyDo: reallyDo
|
||||
fromMailInvitation: isMailInvitation
|
||||
inResponse: response];
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
- (NSString *) _parseDAVDelegatedUser: (WOContext *) queryContext
|
||||
- (NSArray *) _parseDAVDelegatedUser: (WOContext *) queryContext
|
||||
{
|
||||
id <DOMDocument> document;
|
||||
id <DOMNamedNodeMap> attrs;
|
||||
|
||||
id o;
|
||||
document = [[queryContext request] contentAsDOMDocument];
|
||||
attrs = [[document documentElement] attributes];
|
||||
|
||||
return [[attrs namedItem: @"user"] nodeValue];
|
||||
o = [attrs namedItem: @"users"];
|
||||
|
||||
if (o) return [[o nodeValue] componentsSeparatedByString: @","];
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id <WOActionResults>) davSubscribe: (WOContext *) queryContext
|
||||
{
|
||||
return [self subscribe: YES
|
||||
inTheNameOf: [self _parseDAVDelegatedUser: queryContext]
|
||||
inTheNamesOf: [self _parseDAVDelegatedUser: queryContext]
|
||||
fromMailInvitation: NO
|
||||
inContext: queryContext];
|
||||
}
|
||||
@@ -720,7 +733,7 @@ static NSArray *childRecordFields = nil;
|
||||
- (id <WOActionResults>) davUnsubscribe: (WOContext *) queryContext
|
||||
{
|
||||
return [self subscribe: NO
|
||||
inTheNameOf: [self _parseDAVDelegatedUser: queryContext]
|
||||
inTheNamesOf: [self _parseDAVDelegatedUser: queryContext]
|
||||
fromMailInvitation: NO
|
||||
inContext: queryContext];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user