mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-02-27 04:06:23 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user