oc: API to know if a message can be deleted by a subscriber

Instead of asking general container. This gives the possibility to
perform the deletion depending on the data from the message, for instance,
the user creator.
This commit is contained in:
Enrique J. Hernández Blasco
2016-01-28 15:47:17 +01:00
parent bcf94c5b43
commit dcb1d2f574
3 changed files with 13 additions and 4 deletions

View File

@@ -597,7 +597,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
if ([[context activeUser] isEqual: ownerUser]
|| (![message isKindOfClass: MAPIStoreFAIMessageK]
&& [self subscriberCanDeleteMessages]))
&& ([self subscriberCanDeleteMessages] || [message subscriberCanDeleteMessage])))
{
/* we ensure the table caches are loaded so that old and new state
can be compared */

View File

@@ -82,6 +82,7 @@
- (BOOL) subscriberCanReadMessage;
- (BOOL) subscriberCanModifyMessage;
- (BOOL) subscriberCanDeleteMessage;
@end

View File

@@ -547,7 +547,8 @@ rtf2html (NSData *compressedRTF)
for (count = 0; count < max; count++)
[[containerTables objectAtIndex: count] restrictedChildKeys];
}
/* TODO: Check the save process succeeded */
[self save: memCtx];
/* We make sure that any change-related properties are removed from the
properties dictionary, to make sure that related methods will be
@@ -649,8 +650,7 @@ rtf2html (NSData *compressedRTF)
if (userIsOwner
|| ([self isKindOfClass: MAPIStoreEmbeddedMessageK]
&& [mainMessage subscriberCanModifyMessage])
|| [(MAPIStoreFolder *)
[mainMessage container] subscriberCanDeleteMessages])
|| [mainMessage subscriberCanDeleteMessage])
access |= 0x04;
*data = MAPILongValue (memCtx, access);
@@ -987,14 +987,22 @@ rtf2html (NSData *compressedRTF)
return activeUserRoles;
}
/* Can the current active user read the message? */
- (BOOL) subscriberCanReadMessage
{
return NO;
}
/* Can the current active user modify the message? */
- (BOOL) subscriberCanModifyMessage
{
return NO;
}
/* Can the current active user delete the message? */
- (BOOL) subscriberCanDeleteMessage
{
return NO;
}
@end