* @param inActivityDTO
* - current {@link ActivityDTO} to be posted.
*/
private void performGroupAuthorization(final Principal inPrincipal, final ActivityDTO inActivityDTO)
{
DomainGroupModelView currentDomainGroup = domainGroupsByShortNameMapper.fetchUniqueResult(inActivityDTO
.getDestinationStream().getUniqueIdentifier());
boolean isUserCoordinator = groupCoordMapper.execute(currentDomainGroup.getEntityId()).contains(
inPrincipal.getId());
// if group is public check to see if the current stream interaction is allowed based on configuration,
// if so then short-circuit.
if (currentDomainGroup.isPublic())
{
if (currentDomainGroup.isStreamPostable() || isUserCoordinator)
{
return;
}
else
{
throw new AuthorizationException("Group is public but the poster is not a "
+ "coordinator and the group is configured to not allow stream posts.");
}
}
// The group is private, continue forward testing private group authorization.
if (isUserCoordinator)
{
// user is a coordinator
return;
}
if (groupFollowersDAO.execute(currentDomainGroup.getEntityId()).contains(inPrincipal.getId())
&& currentDomainGroup.isStreamPostable())
{
// user is a follower
return;
}