Added calendar sharing capability

This commit is contained in:
Ludovic Marcotte
2015-04-24 16:07:48 -04:00
committed by Francis Lachapelle
parent 0d62ec0bea
commit feee156c0a
11 changed files with 197 additions and 65 deletions

View File

@@ -23,6 +23,7 @@
#import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSValue.h>
#import <NGObjWeb/WORequest.h>
#import <SoObjects/SOGo/SOGoPermissions.h>
@@ -94,22 +95,35 @@
return rightsForType;
}
- (void) updateRights
- (NSDictionary *) userRightsForObject
{
NSMutableDictionary *d;
[self prepareRightsForm];
d = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:[self userCanCreateObjects]], @"canCreateObjects",
[NSNumber numberWithBool:[self userCanEraseObjects]], @"canEraseObjects",
nil];
[d addEntriesFromDictionary: rights];
return d;
}
- (void) updateRights: (NSDictionary *) newRights
{
NSEnumerator *types;
NSString *currentType, *currentValue;
NSArray *rightsForType;
WORequest *request;
request = [context request];
types = [[self rightTypes] objectEnumerator];
currentType = [types nextObject];
while (currentType)
{
rightsForType = [self _rightsForType: currentType];
currentValue
= [request formValueForKey:
[NSString stringWithFormat: @"%@Right", currentType]];
currentValue = [newRights objectForKey: currentType];
if ([currentValue isEqualToString: @"None"])
[self removeAllRightsFromList: rightsForType];
else
@@ -119,12 +133,12 @@
currentType = [types nextObject];
}
if ([[request formValueForKey: @"ObjectCreator"] length] > 0)
if ([[newRights objectForKey: @"canCreateObjects"] boolValue])
[self appendRight: SOGoRole_ObjectCreator];
else
[self removeRight: SOGoRole_ObjectCreator];
if ([[request formValueForKey: @"ObjectEraser"] length] > 0)
if ([[newRights objectForKey: @"canEraseObjects"] boolValue])
[self appendRight: SOGoRole_ObjectEraser];
else
[self removeRight: SOGoRole_ObjectEraser];