mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-26 12:51:52 +02:00
* InfoLog/CalDAV: removed delegation now removes event in sync-report eg. in Smooth-Sync
This commit is contained in:
parent
70b22e3377
commit
dfb260d809
@ -253,10 +253,16 @@ class infolog_groupdav extends Api\CalDAV\Handler
|
|||||||
'col_filter' => $filter,
|
'col_filter' => $filter,
|
||||||
'custom_fields' => true, // otherwise custom fields get NOT loaded!
|
'custom_fields' => true, // otherwise custom fields get NOT loaded!
|
||||||
);
|
);
|
||||||
|
$check_responsible = false;
|
||||||
|
if (substr($task_filter, -8) == '+deleted')
|
||||||
|
{
|
||||||
|
$check_responsible = substr($task_filter, 0, 4) == 'user' ?
|
||||||
|
(int)substr($task_filter, 4) : $GLOBALS['egw_info']['user']['account_id'];
|
||||||
|
}
|
||||||
|
|
||||||
if (!$calendar_data)
|
if (!$calendar_data)
|
||||||
{
|
{
|
||||||
$query['cols'] = array('info_id', 'info_datemodified', 'info_uid', 'caldav_name', 'info_subject', 'info_status');
|
$query['cols'] = array('main.info_id AS info_id', 'info_datemodified', 'info_uid', 'caldav_name', 'info_subject', 'info_status');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($start))
|
if (is_array($start))
|
||||||
@ -284,7 +290,10 @@ class infolog_groupdav extends Api\CalDAV\Handler
|
|||||||
unset($requested_multiget_ids[$k]);
|
unset($requested_multiget_ids[$k]);
|
||||||
}
|
}
|
||||||
// sync-collection report: deleted entry need to be reported without properties
|
// sync-collection report: deleted entry need to be reported without properties
|
||||||
if ($task['info_status'] == 'deleted')
|
if ($task['info_status'] == 'deleted' ||
|
||||||
|
// or event is reported as removed from collection, because collection owner is no longer an attendee
|
||||||
|
$check_responsible && $task['info_owner'] != $check_responsible &&
|
||||||
|
!infolog_so::is_responsible_user($task, $check_responsible))
|
||||||
{
|
{
|
||||||
$files[] = array('path' => $path.urldecode($this->get_path($task)));
|
$files[] = array('path' => $path.urldecode($this->get_path($task)));
|
||||||
continue;
|
continue;
|
||||||
|
@ -91,14 +91,28 @@ class infolog_so
|
|||||||
* Check if user is responsible for an entry: he or one of his memberships is in responsible
|
* Check if user is responsible for an entry: he or one of his memberships is in responsible
|
||||||
*
|
*
|
||||||
* @param array $info infolog entry as array
|
* @param array $info infolog entry as array
|
||||||
|
* @param int $user =null user to check for, default $this->user
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function is_responsible($info,$user=null)
|
function is_responsible($info,$user=null)
|
||||||
{
|
{
|
||||||
if (!$user) $user = $this->user;
|
if (!$user) $user = $this->user;
|
||||||
|
|
||||||
|
return self::is_responsible_user($info, $user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if user is responsible for an entry: he or one of his memberships is in responsible
|
||||||
|
*
|
||||||
|
* @param array $info infolog entry as array
|
||||||
|
* @param int $user =null user to check for
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
static function is_responsible_user($info, $user)
|
||||||
|
{
|
||||||
|
|
||||||
static $um_cache = array();
|
static $um_cache = array();
|
||||||
if ($user == $this->user) $user_and_memberships =& $um_cache[$user];
|
$user_and_memberships =& $um_cache[$user];
|
||||||
if (!isset($user_and_memberships))
|
if (!isset($user_and_memberships))
|
||||||
{
|
{
|
||||||
$user_and_memberships = $GLOBALS['egw']->accounts->memberships($user,true);
|
$user_and_memberships = $GLOBALS['egw']->accounts->memberships($user,true);
|
||||||
@ -201,9 +215,10 @@ class infolog_so
|
|||||||
function aclFilter($_filter = False)
|
function aclFilter($_filter = False)
|
||||||
{
|
{
|
||||||
$vars = null;
|
$vars = null;
|
||||||
preg_match('/(my|responsible|delegated|own|privat|private|all|user)([0-9,-]*)/',$_filter,$vars);
|
preg_match('/(my|responsible|delegated|own|privat|private|all|user)([0-9,-]*)(+deleted)?/',$_filter,$vars);
|
||||||
$filter = $vars[1];
|
$filter = $vars[1];
|
||||||
$f_user = $vars[2];
|
$f_user = $vars[2];
|
||||||
|
$deleted_too = !empty($vars[3]);
|
||||||
|
|
||||||
if (isset($this->acl_filter[$filter.$f_user]))
|
if (isset($this->acl_filter[$filter.$f_user]))
|
||||||
{
|
{
|
||||||
@ -247,12 +262,12 @@ class infolog_so
|
|||||||
}
|
}
|
||||||
$public_access = $this->db->expression($this->info_table,array('info_owner' => $public_user_list));
|
$public_access = $this->db->expression($this->info_table,array('info_owner' => $public_user_list));
|
||||||
// implicit read-rights for responsible user
|
// implicit read-rights for responsible user
|
||||||
$filtermethod .= " OR (".$this->responsible_filter($this->user).')';
|
$filtermethod .= " OR (".$this->responsible_filter($this->user, $deleted_too).')';
|
||||||
|
|
||||||
// private: own entries plus the one user is responsible for
|
// private: own entries plus the one user is responsible for
|
||||||
if ($filter == 'private' || $filter == 'privat' || $filter == 'own')
|
if ($filter == 'private' || $filter == 'privat' || $filter == 'own')
|
||||||
{
|
{
|
||||||
$filtermethod .= " OR (".$this->responsible_filter($this->user).
|
$filtermethod .= " OR (".$this->responsible_filter($this->user, $deleted_too).
|
||||||
($filter == 'own' && count($public_user_list) ? // offer's should show up in own, eg. startpage, but need read-access
|
($filter == 'own' && count($public_user_list) ? // offer's should show up in own, eg. startpage, but need read-access
|
||||||
" OR info_status = 'offer' AND $public_access" : '').")".
|
" OR info_status = 'offer' AND $public_access" : '').")".
|
||||||
" AND (info_access='public'".($has_private_access?" OR $has_private_access":'').')';
|
" AND (info_access='public'".($has_private_access?" OR $has_private_access":'').')';
|
||||||
@ -274,7 +289,7 @@ class infolog_so
|
|||||||
{
|
{
|
||||||
$filtermethod .= $this->db->expression($this->info_table,' AND (',array(
|
$filtermethod .= $this->db->expression($this->info_table,' AND (',array(
|
||||||
'info_owner' => $f_user,
|
'info_owner' => $f_user,
|
||||||
)," AND $this->users_table.account_id IS NULL OR ",$this->responsible_filter($f_user),')');
|
)," AND $this->users_table.account_id IS NULL OR ",$this->responsible_filter($f_user, $deleted_too),')');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//echo "<p>aclFilter(filter='$_filter',user='$f_user') = '$filtermethod', privat_user_list=".print_r($privat_user_list,True).", public_user_list=".print_r($public_user_list,True)."</p>\n";
|
//echo "<p>aclFilter(filter='$_filter',user='$f_user') = '$filtermethod', privat_user_list=".print_r($privat_user_list,True).", public_user_list=".print_r($public_user_list,True)."</p>\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user