mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-08-29 18:26:05 +00:00
Allow admin to be enabled only when accessed at a particular domain.
This commit is contained in:
parent
f5eb6f99a3
commit
02a1e6efb8
@ -121,6 +121,13 @@ class DAViCalSession extends Session
|
||||
function LoginRequired( $roles = '' ) {
|
||||
global $c, $session, $main_menu, $sub_menu, $tab_menu;
|
||||
|
||||
$current_domain = (isset($_SERVER['SERVER_NAME'])?$_SERVER['SERVER_NAME']:$_SERVER['SERVER_ADDR']);
|
||||
if ( (isset($c->restrict_admin_domain) && $c->restrict_admin_domain != $current_domain)
|
||||
|| (isset($c->restrict_admin_port) && $c->restrict_admin_port != $_SERVER['SERVER_PORT'] ) ) {
|
||||
header('Location: caldav.php');
|
||||
dbg_error_log( 'LOG WARNING', 'Access to "%s" via "%s:%d" rejected.', $_SERVER['REQUEST_URI'], $current_domain, $_SERVER['SERVER_PORT'] );
|
||||
exit(0);
|
||||
}
|
||||
if ( $this->logged_in && $roles == '' ) return;
|
||||
if ( ! $this->logged_in ) {
|
||||
$c->messages[] = i18n('You must log in to use this system.');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user