oc: Honor calendar WebMail UI permissions on OpenChange library

By expanding roles from the given ACL to have these values as flags
inside the OpenChange library. This only applies to Calendar and
Tasks folders which stored four different access rights to three
different types of events/tasks.

As the events and tasks are stored in the same table, I have added
two new classes to manage permissions in the same way and this
avoids the code duplication called MAPIStoreCalTask(Folder|Message).
This commit is contained in:
Enrique J. Hernández Blasco
2016-02-22 17:51:54 +01:00
parent 17b2e3946c
commit 12e952eb55
19 changed files with 381 additions and 66 deletions

View File

@@ -129,12 +129,23 @@
task = [sogoObject component: NO secure: YES];
if ([task symbolicAccessClass] == iCalAccessPublic)
if ([task isPublic])
return [self getNo: data inMemCtx: memCtx];
return [self getYes: data inMemCtx: memCtx];
}
- (enum mapistore_error) getPidTagSensitivity: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx
{
uint32_t v;
v = (uint32_t) [self sensitivity];
*data = MAPILongValue (memCtx, v);
return MAPISTORE_SUCCESS;
}
- (enum mapistore_error) getPidTagImportance: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx
{
@@ -343,6 +354,28 @@
// ----------------------------------
// Sharing
// ----------------------------------
- (NSUInteger) sensitivity
{
iCalToDo *task;
NSUInteger v;
task = [sogoObject component: NO secure: YES];
/* FIXME: Use OpenChange constants names */
switch ([task symbolicAccessClass])
{
case iCalAccessPrivate:
v = 0x2;
break;
case iCalAccessConfidential:
v = 0x3;
break;
default:
v = 0x0;
break;
}
return v;
}
- (NSString *) creator
{
iCalToDo *task;
@@ -359,36 +392,6 @@
return [self creator];
}
- (BOOL) subscriberCanReadMessage
{
return ([[self activeUserRoles]
containsObject: SOGoCalendarRole_ComponentViewer]
|| [self subscriberCanModifyMessage]);
}
- (BOOL) subscriberCanModifyMessage
{
BOOL rc;
NSArray *roles = [self activeUserRoles];
if (isNew)
rc = [roles containsObject: SOGoRole_ObjectCreator];
else
rc = ([roles containsObject: SOGoCalendarRole_ComponentModifier]
|| [roles containsObject: SOGoCalendarRole_ComponentResponder]);
/* Check if the message is owned and it has permission to edit it */
if (!rc && [roles containsObject: MAPIStoreRightEditOwn])
{
NSString *currentUser;
currentUser = [[container context] activeUser];
rc = [currentUser isEqual: [self ownerUser]];
}
return rc;
}
- (void) save:(TALLOC_CTX *) memCtx
{
iCalCalendar *vCalendar;