(json) Return ACLs when subscribing to a folder
This commit is contained in:
parent
5aa19ebfb7
commit
f19b213c02
|
@ -75,8 +75,11 @@
|
||||||
- (WOResponse *) _subscribeAction: (BOOL) reallyDo
|
- (WOResponse *) _subscribeAction: (BOOL) reallyDo
|
||||||
{
|
{
|
||||||
WOResponse *response;
|
WOResponse *response;
|
||||||
|
NSArray *allACLs;
|
||||||
NSDictionary *jsonResponse;
|
NSDictionary *jsonResponse;
|
||||||
|
NSMutableDictionary *acls;
|
||||||
NSURL *mailInvitationURL;
|
NSURL *mailInvitationURL;
|
||||||
|
BOOL objectCreator, objectEditor, objectEraser;
|
||||||
|
|
||||||
response = nil;
|
response = nil;
|
||||||
[self _setupContext];
|
[self _setupContext];
|
||||||
|
@ -102,6 +105,15 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// We extract ACLs for this address book
|
||||||
|
allACLs = ([owner isEqualToString: login] ? nil : [clientObject aclsForUser: login]);
|
||||||
|
objectCreator = ([owner isEqualToString: login] || [allACLs containsObject: SOGoRole_ObjectCreator]);
|
||||||
|
objectEditor = ([owner isEqualToString: login] || [allACLs containsObject: SOGoRole_ObjectEditor]);
|
||||||
|
objectEraser = ([owner isEqualToString: login] || [allACLs containsObject: SOGoRole_ObjectEraser]);
|
||||||
|
acls = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool: objectCreator], @"objectCreator",
|
||||||
|
[NSNumber numberWithBool: objectEditor], @"objectEditor",
|
||||||
|
[NSNumber numberWithBool: objectEraser], @"objectEraser", nil];
|
||||||
|
|
||||||
// @see [SOGoGCSFolder folderWithSubscriptionReference:inContainer:]
|
// @see [SOGoGCSFolder folderWithSubscriptionReference:inContainer:]
|
||||||
jsonResponse
|
jsonResponse
|
||||||
= [NSDictionary dictionaryWithObjectsAndKeys:
|
= [NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
|
@ -112,6 +124,7 @@
|
||||||
[NSNumber numberWithBool:
|
[NSNumber numberWithBool:
|
||||||
[clientObject isKindOfClass: [SOGoContactSourceFolder class]]
|
[clientObject isKindOfClass: [SOGoContactSourceFolder class]]
|
||||||
&& ![(SOGoContactSourceFolder *) clientObject isPersonalSource]], @"isRemote",
|
&& ![(SOGoContactSourceFolder *) clientObject isPersonalSource]], @"isRemote",
|
||||||
|
acls, @"acls",
|
||||||
nil];
|
nil];
|
||||||
response = [self responseWithStatus: 200
|
response = [self responseWithStatus: 200
|
||||||
andJSONRepresentation: jsonResponse];
|
andJSONRepresentation: jsonResponse];
|
||||||
|
|
Loading…
Reference in a new issue