johndoh / roundcube-sauserprefs

Adds a 'Spam' tab to the 'Personal Settings' to allow the user to change their SpamAssassin preferences.
https://plugins.roundcube.net/#/packages/johndoh/sauserprefs
55 stars 18 forks source link

sauserprefs_allowed_hosts not working right ? #58

Closed PablitoMurillo closed 4 years ago

PablitoMurillo commented 4 years ago

Hi

I have a RC working on a multi-domain enviroment, and I'm using 'localhost' to connecto to imap server, so $_SESSION['storage_host'] is allways "localhost" and this made that the opcion is not working I made a lillte change in you code in teh Init function

    // Host exceptions
    $hosts = $this->rcube->config->get('sauserprefs_allowed_hosts');
    // Get host for username_domain variable
    $host_user = $this->rcube->config->get('username_domain');

    //if (!empty($hosts) && !in_array($_SESSION['storage_host'], (array) $hosts)) {
    // change the IF to use the real domain
    if (!empty($hosts) && !in_array($host_user, (array) $hosts)) {
        return;
    }

I added a zip with the patch

patch.sauserprefs-php.zip

johndoh commented 4 years ago

is this really needed? You can already change rc config based on the hostname used to access rc. see https://github.com/roundcube/roundcubemail/wiki/Configuration:-Multi-Domain-Setup

PablitoMurillo commented 4 years ago

I use the Multi Domain Setup, but to avoid a lot of controls on smtp/imap server, I only allow localhost to use an specific port on smtp/imap, this is why $_SESSION['storage_host'] is allways 'localhost' :(

Could be both variables :D

Thanks for the great work on the plugin, by teh way !

johndoh commented 4 years ago

I don't understand, your use of localhost as imap server does not mean you cannot use include_host_config as that config option uses the hostname that was used to access rc, not the imap server.

any way I really do not like your proposed change, it looks very hacky me to. even if you can't/don't want to use include_host_config you could write your own plugin to control the config any way you like.