Intranet: per-user Configuration



  • Hello Community!

    I’d like to have a simple if-then-clause in my Intranet.conf config file to have a per-user variable definition.

    I’m not familiar with php-programming, especially I don’t know the PHP variable holding the user name or login name for WebApp. Can somebody please translate the following peudocode to valid php:

    if (login_name = "xxx"); then
      define('PLUGIN_INTRANET_BUTTON_TITLE_3', 'myURL');
      define('PLUGIN_INTRANET_URL_3', 'http://myURL.com/');
    end if
    

    Thank you very much!



  • I wanted to do something similar, but I don’t think the Username is available via Environment Variables. Luckily I was able to using various VLANs instead. I also have an internal proxy for I needed to look for the source IP and the X-Forwarded-for IP:

    if ( strncmp("10.200.150.", $_SERVER['REMOTE_ADDR'], 11) === 0 ||
         strncmp("10.201.150.", $_SERVER['REMOTE_ADDR'], 11) === 0 ||
         strncmp("10.200.200.", $_SERVER['REMOTE_ADDR'], 11) === 0 ||
         strncmp("10.201.200.", $_SERVER['REMOTE_ADDR'], 11) === 0 ||
         strncmp("10.200.150.", $_SERVER['HTTP_X_FORWARDED_FOR'], 11) === 0 ||
         strncmp("10.201.150.", $_SERVER['HTTP_X_FORWARDED_FOR'], 11) === 0 ||
         strncmp("10.200.200.", $_SERVER['HTTP_X_FORWARDED_FOR'], 11) === 0 ||
         strncmp("10.201.200.", $_SERVER['HTTP_X_FORWARDED_FOR'], 11) === 0 ) {
            define('PLUGIN_INTRANET_USER_DEFAULT_ENABLE', true);
            define('PLUGIN_INTRANET_BUTTON_TITLE', 'Teams');
            define('PLUGIN_INTRANET_URL', 'https://teams/');
    } else {
            define('PLUGIN_INTRANET_USER_DEFAULT_ENABLE', false);
            define('PLUGIN_INTRANET_BUTTON_TITLE', 'Teams');
            define('PLUGIN_INTRANET_URL', 'https://teams/');
    }
    


  • In another plugin, I found the environment variable

    $data['username']
    

    It might be as simple as

    if ( $data['username'] == 'xxx' ) {
      define('PLUGIN_INTRANET_BUTTON_TITLE_3', 'myURL');
      define('PLUGIN_INTRANET_URL_3', 'http://myURL.com/')
      }
    

    I will test this when I have access to my System. Right now, i’m on the road.



  • OK, that does not work.

    $data[‘username’] is an empty string when the config file is called. Still looking for a solution …


Log in to reply
 

Looks like your connection to Kopano Community Forum was lost, please wait while we try to reconnect.