Add check for add access if entry to be saved has no ID, and type has an owner - prevents inserting (importing) into restricted types

This commit is contained in:
Nathan Gray 2011-12-06 23:30:48 +00:00
parent f7b8997be3
commit 5b5a6bb625

View File

@ -828,10 +828,17 @@ class infolog_bo
if (isset($this->group_owners[$values['info_type']])) if (isset($this->group_owners[$values['info_type']]))
{ {
$values['info_owner'] = $this->group_owners[$values['info_type']]; $values['info_owner'] = $this->group_owners[$values['info_type']];
if (!($this->grants[$this->group_owners[$values['info_type']]] & EGW_ACL_EDIT)) if ($values['info_id'] && !($this->grants[$this->group_owners[$values['info_type']]] & EGW_ACL_EDIT))
{ {
if (!$this->check_access($values['info_id'],EGW_ACL_EDIT)) return false; // no edit rights from the group-owner and no implicit rights (delegated and sufficient rights) if (!$this->check_access($values['info_id'],EGW_ACL_EDIT)) return false; // no edit rights from the group-owner and no implicit rights (delegated and sufficient rights)
} }
else if (!$values['info_id'] && !($this->grants[$this->group_owners[$values['info_type']]] & EGW_ACL_ADD))
{
if (!$this->check_access($values,EGW_ACL_ADD))
{
return false;
}
}
} }
elseif (!$values['info_id'] && !$values['info_owner'] || $GLOBALS['egw']->accounts->get_type($values['info_owner']) == 'g') elseif (!$values['info_id'] && !$values['info_owner'] || $GLOBALS['egw']->accounts->get_type($values['info_owner']) == 'g')
{ {