Custom admin query key

This commit is contained in:
RainLoop Team 2016-03-22 21:31:26 +03:00
parent 27870cec26
commit 54c3e0732e
4 changed files with 7 additions and 3 deletions

View file

@ -13,6 +13,7 @@ class Links
this.sVersion = Settings.settingsGet('Version'); this.sVersion = Settings.settingsGet('Version');
this.sAuthSuffix = Settings.settingsGet('AuthAccountHash') || '0'; this.sAuthSuffix = Settings.settingsGet('AuthAccountHash') || '0';
this.sWebPrefix = Settings.settingsGet('WebPath') || ''; this.sWebPrefix = Settings.settingsGet('WebPath') || '';
this.sAdminPath = Settings.settingsGet('AdminPath') || 'admin';
this.sVersionPrefix = Settings.settingsGet('WebVersionPath') || 'rainloop/v/' + this.sVersion + '/'; this.sVersionPrefix = Settings.settingsGet('WebVersionPath') || 'rainloop/v/' + this.sVersion + '/';
this.sStaticPrefix = this.sVersionPrefix + 'static/'; this.sStaticPrefix = this.sVersionPrefix + 'static/';
} }
@ -40,7 +41,7 @@ class Links
* @return {string} * @return {string}
*/ */
rootAdmin() { rootAdmin() {
return this.sServer + '/Admin/'; return this.sServer + this.sAdminPath;
} }
/** /**
@ -249,7 +250,7 @@ class Links
search = Utils.pString(search); search = Utils.pString(search);
let result = this.sBase + 'mailbox/'; let result = this.sBase + 'mailbox/';
if ('' !== folder) if ('' !== folder)
{ {
const resultThreadUid = Utils.pInt(threadUid); const resultThreadUid = Utils.pInt(threadUid);

View file

@ -1402,6 +1402,7 @@ class Actions
'Auth' => false, 'Auth' => false,
'AccountHash' => '', 'AccountHash' => '',
'WebPath' => \RainLoop\Utils::WebPath(), 'WebPath' => \RainLoop\Utils::WebPath(),
'AdminPath' => \strtolower($oConfig->Get('security', 'admin_panel_key', 'admin')),
'WebVersionPath' => \RainLoop\Utils::WebVersionPath(), 'WebVersionPath' => \RainLoop\Utils::WebVersionPath(),
'AccountSignMe' => false, 'AccountSignMe' => false,
'AuthAccountHash' => '', 'AuthAccountHash' => '',

View file

@ -129,6 +129,7 @@ class Application extends \RainLoop\Config\AbstractConfig
'force_two_factor_auth' => array(false), 'force_two_factor_auth' => array(false),
'allow_universal_login' => array(false), 'allow_universal_login' => array(false),
'admin_panel_host' => array(''), 'admin_panel_host' => array(''),
'admin_panel_key' => array('admin'),
'core_install_access_domain' => array('') 'core_install_access_domain' => array('')
), ),

View file

@ -110,7 +110,8 @@ class Service
$sAdminPanelHost = $this->oActions->Config()->Get('security', 'admin_panel_host', ''); $sAdminPanelHost = $this->oActions->Config()->Get('security', 'admin_panel_host', '');
if (empty($sAdminPanelHost)) if (empty($sAdminPanelHost))
{ {
$bAdmin = !empty($aPaths[0]) && \in_array(\strtolower($aPaths[0]), array('admin', 'cp')); $sAdminPanelKey = \strtolower($this->oActions->Config()->Get('security', 'admin_panel_key', 'admin'));
$bAdmin = !empty($aPaths[0]) && $aPaths[0] === $sAdminPanelKey;
} }
else if (empty($aPaths[0]) && else if (empty($aPaths[0]) &&
\MailSo\Base\Utils::StrToLowerIfAscii($sAdminPanelHost) === \MailSo\Base\Utils::StrToLowerIfAscii($this->oHttp->GetHost())) \MailSo\Base\Utils::StrToLowerIfAscii($sAdminPanelHost) === \MailSo\Base\Utils::StrToLowerIfAscii($this->oHttp->GetHost()))