class QosPublishHandler {

    private static final Logger LOG = LoggerFactory.getLogger(QosPublishHandler.class);

    protected final IAuthorizator m_authorizator;

    protected QosPublishHandler(IAuthorizator m_authorizator) {
        this.m_authorizator = m_authorizator;
    }

    public boolean checkWriteOnTopic(Topic topic, Channel channel) {<FILL_FUNCTION_BODY>}
}

        String clientID = NettyUtils.clientID(channel);
        String username = NettyUtils.userName(channel);
        if (!m_authorizator.canWrite(topic, username, clientID)) {
            LOG.error("MQTT client is not authorized to publish on topic. CId={}, topic={}", clientID, topic);
            return true;
        }
        return false;
    
<no_super_class>