Skip to content

Commit

Permalink
* Setup: fix no accounts found for SQL instances
Browse files Browse the repository at this point in the history
in setup without an active user, no grants existed, seemed no problem before, maybe caused by contact sharing
  • Loading branch information
ralfbecker committed Dec 15, 2020
1 parent f06cc03 commit db77752
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions api/src/Contacts/Storage.php
Expand Up @@ -273,10 +273,8 @@ function __construct($contact_app='addressbook',Api\Db $db=null)
// 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)
Expand Down Expand Up @@ -389,9 +387,10 @@ function get_grants($user, $contact_app='addressbook', $preferences=null)
$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;
Expand Down

0 comments on commit db77752

Please sign in to comment.