Started woking on some credential changes

This commit is contained in:
Marcos Zuriaga 2016-10-03 20:38:40 +02:00
parent f8c86b9ea6
commit 0b2dff77eb
No known key found for this signature in database
GPG key ID: 7D15585354D072FF
2 changed files with 9 additions and 1 deletions

View file

@ -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` = ?';

View file

@ -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);