mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-30 01:38:37 +01:00
* CalDAV/CardDAV: fix freebusy-URL for users and support basic auth with regular user credentials too
This commit is contained in:
parent
4af0bec278
commit
38ef0e0a94
@ -401,6 +401,15 @@ class addressbook_vcal extends addressbook_bo
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'freebusy_uri':
|
||||||
|
// fix Freebusy URL for users
|
||||||
|
if (!empty($entry['account_id']) && ($user = Api\Accounts::id2name($entry['account_id'])))
|
||||||
|
{
|
||||||
|
$value = Api\Header\Http::fullUrl(Api\Framework::link('/calendar/freebusy.php', ['user' => $user]));
|
||||||
|
}
|
||||||
|
if (!empty($value)) $hasdata++;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'n_fn':
|
case 'n_fn':
|
||||||
case 'fileas_type':
|
case 'fileas_type':
|
||||||
// mark entries with fileas_type == 'org_name' as X-ABSHOWAS:COMPANY (Apple AB specific)
|
// mark entries with fileas_type == 'org_name' as X-ABSHOWAS:COMPANY (Apple AB specific)
|
||||||
|
@ -19,12 +19,22 @@ $GLOBALS['egw_info'] = array(
|
|||||||
'nofooter' => True,
|
'nofooter' => True,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
// check if we are loged in, by checking sessionid and kp3, as the sessionid get set automaticaly by php for php4-sessions
|
// check if we are already logged in
|
||||||
if (!($loged_in = !empty($_COOKIE['sessionid'])))
|
require_once __DIR__.'/../api/src/autoload.php';
|
||||||
|
if (!($logged_in = !empty(Api\Session::get_sessionid())))
|
||||||
|
{
|
||||||
|
// support basic auth for regular user-credentials
|
||||||
|
if (!empty($_SERVER['PHP_AUTH_PW']) || !empty($_SERVER['REDIRECT_HTTP_AUTHORIZATION']))
|
||||||
|
{
|
||||||
|
$GLOBALS['egw_info']['flags']['autocreate_session_callback'] = Api\Header\Authenticate::class.'::autocreate_session_callback';
|
||||||
|
$logged_in = true; // header sends 401, if not authenticated
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$GLOBALS['egw_info']['flags']['currentapp'] = 'login';
|
$GLOBALS['egw_info']['flags']['currentapp'] = 'login';
|
||||||
$GLOBALS['egw_info']['flags']['noapi'] = True;
|
$GLOBALS['egw_info']['flags']['noapi'] = True;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
include ('../header.inc.php');
|
include ('../header.inc.php');
|
||||||
|
|
||||||
function fail_exit($msg)
|
function fail_exit($msg)
|
||||||
@ -32,10 +42,11 @@ function fail_exit($msg)
|
|||||||
echo "<html>\n<head>\n<title>$msg</title>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=".
|
echo "<html>\n<head>\n<title>$msg</title>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=".
|
||||||
Api\Translation::charset()."\" />\n</head>\n<body><h1>$msg</h1>\n</body>\n</html>\n";
|
Api\Translation::charset()."\" />\n</head>\n<body><h1>$msg</h1>\n</body>\n</html>\n";
|
||||||
|
|
||||||
exit();
|
http_response_code(401);
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$loged_in)
|
if (!$logged_in)
|
||||||
{
|
{
|
||||||
include ('../api/src/loader.php');
|
include ('../api/src/loader.php');
|
||||||
$GLOBALS['egw_info']['flags']['currentapp'] = 'calendar';
|
$GLOBALS['egw_info']['flags']['currentapp'] = 'calendar';
|
||||||
@ -59,7 +70,7 @@ if ($user === false || !($username = $GLOBALS['egw']->accounts->id2name($user)))
|
|||||||
{
|
{
|
||||||
fail_exit(lang("freebusy: unknown user '%1', wrong password or not available to not logged in users !!!"." $username($user)",$_GET['user']));
|
fail_exit(lang("freebusy: unknown user '%1', wrong password or not available to not logged in users !!!"." $username($user)",$_GET['user']));
|
||||||
}
|
}
|
||||||
if (!$loged_in)
|
if (!$logged_in)
|
||||||
{
|
{
|
||||||
if (empty($_GET['cred']))
|
if (empty($_GET['cred']))
|
||||||
{
|
{
|
||||||
@ -68,7 +79,7 @@ if (!$loged_in)
|
|||||||
$GLOBALS['egw']->preferences->account_id = $user;
|
$GLOBALS['egw']->preferences->account_id = $user;
|
||||||
$GLOBALS['egw_info']['user']['preferences'] = $GLOBALS['egw']->preferences->read_repository();
|
$GLOBALS['egw_info']['user']['preferences'] = $GLOBALS['egw']->preferences->read_repository();
|
||||||
$cal_prefs = &$GLOBALS['egw_info']['user']['preferences']['calendar'];
|
$cal_prefs = &$GLOBALS['egw_info']['user']['preferences']['calendar'];
|
||||||
$loged_in = !empty($cal_prefs['freebusy']) &&
|
$logged_in = !empty($cal_prefs['freebusy']) &&
|
||||||
(empty($cal_prefs['freebusy_pw']) || $cal_prefs['freebusy_pw'] == $_GET['password']);
|
(empty($cal_prefs['freebusy_pw']) || $cal_prefs['freebusy_pw'] == $_GET['password']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -86,18 +97,18 @@ if (!$loged_in)
|
|||||||
}
|
}
|
||||||
if (array_key_exists($domain, $GLOBALS['egw_domain']))
|
if (array_key_exists($domain, $GLOBALS['egw_domain']))
|
||||||
{
|
{
|
||||||
$_POST['login'] = $authname;
|
$_POST['login'] = $authuser;
|
||||||
$_REQUEST['domain'] = $domain;
|
$_REQUEST['domain'] = $domain;
|
||||||
$GLOBALS['egw_info']['server']['default_domain'] = $domain;
|
$GLOBALS['egw_info']['server']['default_domain'] = $domain;
|
||||||
$GLOBALS['egw_info']['user']['domain'] = $domain;
|
$GLOBALS['egw_info']['user']['domain'] = $domain;
|
||||||
$GLOBALS['egw_info']['flags']['currentapp'] = 'login';
|
$GLOBALS['egw_info']['flags']['currentapp'] = 'login';
|
||||||
$GLOBALS['egw_info']['flags']['noapi'] = false;
|
$GLOBALS['egw_info']['flags']['noapi'] = false;
|
||||||
$loged_in = $GLOBALS['egw']->session->create($authuser, $password, 'text');
|
$logged_in = $GLOBALS['egw']->session->create($authuser, $password, 'text');
|
||||||
session_unset();
|
session_unset();
|
||||||
session_destroy();
|
session_destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$loged_in)
|
if (!$logged_in)
|
||||||
{
|
{
|
||||||
fail_exit(lang("freebusy: unknown user '%1', or not available for unauthenticated users!", $_GET['user']));
|
fail_exit(lang("freebusy: unknown user '%1', or not available for unauthenticated users!", $_GET['user']));
|
||||||
}
|
}
|
||||||
|
@ -1204,7 +1204,7 @@ class calendar_so
|
|||||||
*/
|
*/
|
||||||
private static function get_union_selects(array &$selects,$start,$end,$users,$cat_id,$filter,$query,$users_raw)
|
private static function get_union_selects(array &$selects,$start,$end,$users,$cat_id,$filter,$query,$users_raw)
|
||||||
{
|
{
|
||||||
if (in_array(basename($_SERVER['SCRIPT_FILENAME']),array('groupdav.php','rpc.php','xmlrpc.php','/activesync/index.php')) ||
|
if (in_array(basename($_SERVER['SCRIPT_FILENAME']),array('groupdav.php','freebusy.php','/activesync/index.php')) ||
|
||||||
!in_array($GLOBALS['egw_info']['flags']['currentapp'],array('calendar','home')))
|
!in_array($GLOBALS['egw_info']['flags']['currentapp'],array('calendar','home')))
|
||||||
{
|
{
|
||||||
return; // disable integration for GroupDAV, SyncML, ...
|
return; // disable integration for GroupDAV, SyncML, ...
|
||||||
|
Loading…
Reference in New Issue
Block a user