* Setup: fix no accounts found for SQL instances

in setup without an active user, no grants existed, seemed no problem before, maybe caused by contact sharing
This commit is contained in:
Ralf Becker 2020-12-15 18:09:56 +01:00
parent c301c1b194
commit 5fae437a52

View File

@ -273,10 +273,8 @@ class Storage
// remove some columns, absolutly not necessary to search in sql
$this->columns_to_search = array_diff(array_values($this->somain->db_cols),$this->sql_cols_not_to_search);
}
if ($this->user)
{
$this->grants = $this->get_grants($this->user,$contact_app);
}
$this->grants = $this->get_grants($this->user,$contact_app);
if ($this->account_repository != 'sql' && $this->contact_repository == 'sql')
{
if ($this->account_repository != $this->contact_repository)
@ -389,9 +387,10 @@ class Storage
$grants[0] |= Api\Acl::READ|Api\Acl::EDIT;
}
}
// no user, eg. setup or not logged in, allow read access to accounts
else
{
$grants = array();
$grants = [0 => Api\Acl::READ];
}
//error_log(__METHOD__."($user, '$contact_app') returning ".array2string($grants));
return $grants;