PersonModelView currentPerson = getPersonModelViewByAccountIdMapper.execute(inActivityDTO
.getDestinationStream().getUniqueIdentifier());
if (currentPerson == null)
{
throw new AuthorizationException("Cannot locate current person. The activity destination stream id is "
+ inActivityDTO.getDestinationStream().getUniqueIdentifier());
}
boolean isActorTheStreamOwner = inPrincipal.getAccountId().equalsIgnoreCase(
inActivityDTO.getDestinationStream().getUniqueIdentifier());
// Test if the user is the owner of the stream being posted to or the stream
// has been authorized for this type of interaction.
if (isActorTheStreamOwner || currentPerson.isStreamPostable())
{
return;
}
throw new AuthorizationException("Current user does not have access rights to post this activity.");
}