Michael Fürmann
2015-02-19 3e994a81a8b407c0076eaf90649fbf98e71082e2
server/plugins-available/xmpp_plugin.inc.php
@@ -67,6 +67,9 @@
        $app->plugins->registerEvent('xmpp_domain_insert', 'xmpp_plugin', 'domainInsert');
        $app->plugins->registerEvent('xmpp_domain_update', 'xmpp_plugin', 'domainUpdate');
        $app->plugins->registerEvent('xmpp_domain_delete', 'xmpp_plugin', 'domainDelete');
        $app->plugins->registerEvent('xmpp_user_insert', 'xmpp_plugin', 'userInsert');
        $app->plugins->registerEvent('xmpp_user_update', 'xmpp_plugin', 'userUpdate');
        $app->plugins->registerEvent('xmpp_user_delete', 'xmpp_plugin', 'userDelete');
    }
@@ -135,7 +138,6 @@
        $tpl->newTemplate('metronome_conf_host.master');
        $tpl->setVar('domain', $data['new']['domain']);
        $tpl->setVar('active', $data['new']['active'] == 'y' ? 'true' : 'false');
        $tpl->setVar('auth_method', $data['new']['auth_method'] == 'isp' ? 'external' : 'internal_'.$data['new']['auth_method']);
        $tpl->setVar('public_registration', $data['new']['public_registration'] == 'y' ? 'true' : 'false');
        $admins = array();
@@ -227,6 +229,27 @@
        $app->services->restartServiceDelayed('metronome', 'restart');
    }
    function userInsert($event_name, $data){
        //$data['new']['auth_method']
        // Check domain for auth settings
        // Don't allow manual user creation for mailaccount controlled domains
        // maybe metronomectl adduser for new local users
    }
    function userUpdate($event_name, $data){
        // Check domain for auth settings
        // Don't allow manual user update for mailaccount controlled domains
        // maybe metronomectl passwd for existing local users
    }
    function userDelete($event_name, $data){
        // Check domain for auth settings
        // Don't allow manual user deletion for mailaccount controlled domains
        // Remove account from metronome
        exec('metronomectl deluser '.$data['old']['jid']);
    }
} // end class
?>