"hasPermission(#topic.branch.id, 'BRANCH', 'BranchPermission.EDIT_OWN_POSTS')) or " +
"(not hasPermission(#topic.id, 'TOPIC', 'GeneralPermission.WRITE') and " +
"hasPermission(#topic.branch.id, 'BRANCH', 'BranchPermission.EDIT_OTHERS_POSTS'))")
public void updateTopic(Topic topic, Poll poll) {
if (topic.getCodeReview() != null) {
throw new AccessDeniedException("It is not allowed to edit Code Review!");
}
Post post = topic.getFirstPost();
post.updateModificationDate();
if (poll != null && poll.getEndingDate() != null) {
topic.getPoll().setEndingDate(poll.getEndingDate());