diff --git a/lib/Db/CredentialMapper.php b/lib/Db/CredentialMapper.php index 86acf0fe..1302f54a 100644 --- a/lib/Db/CredentialMapper.php +++ b/lib/Db/CredentialMapper.php @@ -44,6 +44,11 @@ class CredentialMapper extends Mapper { return $this->findEntities($sql, [$timestamp]); } + /** + * @param $credential_id + * @param null $user_id + * @return Credential + */ public function getCredentialById($credential_id, $user_id = null){ $sql = 'SELECT * FROM `*PREFIX*passman_credentials` ' . 'WHERE `id` = ?'; diff --git a/lib/Service/CredentialService.php b/lib/Service/CredentialService.php index d7c403ef..621307bf 100644 --- a/lib/Service/CredentialService.php +++ b/lib/Service/CredentialService.php @@ -54,7 +54,10 @@ class CredentialService { } public function getCredentialById($credential_id, $user_id){ - return $this->credentialMapper->getCredentialById($credential_id, $user_id); + $credential = $this->credentialMapper->getCredentialById($credential_id); + if ($credential->getUserId() == $user_id){ + return $credential; + } } public function getCredentialLabelById($credential_id){ return $this->credentialMapper->getCredentialLabelById($credential_id);