diff --git a/ChangeLog b/ChangeLog index c619a0b6b..6f1902985 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-12-01 Wolfgang Sourdeau + * OpenChange/MAPIStoreGCSMessage.m (-getPrAccess:inMemCtx:) + (-getPrAccessLevel:inMemCtx:): return a value based on the ACL + getters below. + * OpenChange/MAPIStoreFSMessage.m (-subscriberCanReadMessage): returns YES when the message is of class "IPM.Microsoft.ScheduleData.FreeBusy", as a hack until freebusy diff --git a/OpenChange/MAPIStoreGCSMessage.m b/OpenChange/MAPIStoreGCSMessage.m index 695561da0..c5e945583 100644 --- a/OpenChange/MAPIStoreGCSMessage.m +++ b/OpenChange/MAPIStoreGCSMessage.m @@ -22,8 +22,10 @@ #import #import +#import #import #import +#import #import "MAPIStoreContext.h" #import "MAPIStoreGCSFolder.h" @@ -48,6 +50,69 @@ return [sogoObject lastModified]; } +- (int) getPrAccess: (void **) data // TODO + inMemCtx: (TALLOC_CTX *) memCtx +{ + MAPIStoreContext *context; + WOContext *woContext; + SoSecurityManager *sm; + uint32_t access; + + context = [self context]; + if ([[context activeUser] isEqual: [context ownerUser]]) + access = 0x03; + else + { + sm = [SoSecurityManager sharedSecurityManager]; + woContext = [context woContext]; + + access = 0; + if (![sm validatePermission: SoPerm_ChangeImagesAndFiles + onObject: sogoObject + inContext: woContext]) + access |= 1; + if (![sm validatePermission: SoPerm_AccessContentsInformation + onObject: sogoObject + inContext: woContext]) + access |= 2; + if (![sm validatePermission: SOGoPerm_DeleteObject + onObject: sogoObject + inContext: woContext]) + access |= 4; + } + *data = MAPILongValue (memCtx, access); + + return MAPISTORE_SUCCESS; +} + +- (int) getPrAccessLevel: (void **) data // TODO + inMemCtx: (TALLOC_CTX *) memCtx +{ + MAPIStoreContext *context; + WOContext *woContext; + SoSecurityManager *sm; + uint32_t accessLvl; + + context = [self context]; + if ([[context activeUser] isEqual: [context ownerUser]]) + accessLvl = 1; + else + { + sm = [SoSecurityManager sharedSecurityManager]; + woContext = [context woContext]; + + if (![sm validatePermission: SoPerm_ChangeImagesAndFiles + onObject: sogoObject + inContext: woContext]) + accessLvl = 1; + else + accessLvl = 0; + } + *data = MAPILongValue (memCtx, accessLvl); + + return MAPISTORE_SUCCESS; +} + - (int) getPrChangeKey: (void **) data inMemCtx: (TALLOC_CTX *) memCtx {