Added compromised state to database

Signed-off-by: fnuesse <felix.nuesse@t-online.de>
This commit is contained in:
fnuesse 2019-01-08 21:23:27 +01:00
Родитель 5733031bcd
Коммит deee11f454
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 2089A3431243E819
7 изменённых файлов: 30 добавлений и 8 удалений

Просмотреть файл

@ -229,6 +229,10 @@
<type>boolean</type>
<default>false</default>
</field>
<field>
<name>compromised</name>
<type>clob</type>
</field>
<field>
<name>shared_key</name>
<type>clob</type>

Просмотреть файл

@ -19,7 +19,7 @@ Features:
- Import from various password managers (KeePass, LastPass, DashLane, ZOHO, Clipperz.is )
For an demo of this app visit [https://demo.passman.cc](https://demo.passman.cc)
]]></description>
<version>2.2.1</version>
<version>2.2.7</version>
<licence>agpl</licence>
<author homepage="https://github.com/brantje">Sander Brand</author>
<author homepage="https://github.com/animalillo">Marcos Zuriaga</author>
@ -42,8 +42,8 @@ For an demo of this app visit [https://demo.passman.cc](https://demo.passman.cc)
<database>pgsql</database>
<database min-version="5.5">mysql</database>
<lib>openssl</lib>
<nextcloud min-version="14" max-version="15"/>
<owncloud min-version="14" max-version="15"/>
<nextcloud min-version="14" max-version="16"/>
<owncloud min-version="14" max-version="16"/>
</dependencies>
<background-jobs>

Просмотреть файл

@ -70,7 +70,7 @@ class CredentialController extends ApiController {
$credential_id, $custom_fields, $delete_time,
$description, $email, $expire_time, $favicon, $files, $guid,
$hidden, $label, $otp, $password, $renew_interval,
$tags, $url, $username, $vault_id) {
$tags, $url, $username, $vault_id, $compromised) {
$credential = array(
'credential_id' => $credential_id,
'guid' => $guid,
@ -93,6 +93,7 @@ class CredentialController extends ApiController {
'custom_fields' => $custom_fields,
'otp' => $otp,
'hidden' => $hidden,
'compromised' => $compromised
);
@ -125,7 +126,7 @@ class CredentialController extends ApiController {
$credential_id, $custom_fields, $delete_time, $credential_guid,
$description, $email, $expire_time, $icon, $files, $guid,
$hidden, $label, $otp, $password, $renew_interval,
$tags, $url, $username, $vault_id, $revision_created, $shared_key, $acl, $unshare_action, $set_share_key, $skip_revision) {
$tags, $url, $username, $vault_id, $revision_created, $shared_key, $acl, $unshare_action, $set_share_key, $skip_revision, $compromised) {
$storedCredential = $this->credentialService->getCredentialByGUID($credential_guid);
@ -151,7 +152,8 @@ class CredentialController extends ApiController {
'delete_time' => $delete_time,
'hidden' => $hidden,
'otp' => $otp,
'user_id' => $storedCredential->getUserId()
'user_id' => $storedCredential->getUserId(),
'compromised' => $compromised
);

Просмотреть файл

@ -105,6 +105,9 @@
}
angular.merge($scope.active_vault.credentials, _credentials);
$scope.show_spinner = false;
console.log($scope.active_vault.credentials)
$rootScope.$broadcast('credentials_loaded');
$rootScope.vaultCache[$scope.active_vault.guid] = angular.copy($scope.active_vault);
if(!vault.private_sharing_key){

Просмотреть файл

@ -55,9 +55,10 @@
'files': [],
'custom_fields': [],
'otp': {},
'compromised': false,
'hidden': false
};
var _encryptedFields = ['description', 'username', 'password', 'files', 'custom_fields', 'otp', 'email', 'tags', 'url'];
var _encryptedFields = ['description', 'username', 'password', 'files', 'custom_fields', 'otp', 'email', 'tags', 'url', 'compromised'];
return {
@ -140,8 +141,14 @@
var fieldValue = angular.copy(credential[field]);
var field_decrypted_value;
try {
field_decrypted_value = EncryptService.decryptString(fieldValue, key);
if(fieldValue!==null){
field_decrypted_value = EncryptService.decryptString(fieldValue, key);
}else{
field_decrypted_value=null;
}
} catch (e) {
console.log(fieldValue)
console.log(e)
throw e;
}
try {

Просмотреть файл

@ -70,6 +70,8 @@ use \OCP\AppFramework\Db\Entity;
* @method string getHidden()
* @method void setSharedKey(string $value)
* @method string getSharedKey()
* @method void setCompromised(bool $value)
* @method bool getCompromised()
@ -101,6 +103,7 @@ class Credential extends Entity implements \JsonSerializable{
protected $otp;
protected $hidden;
protected $sharedKey;
protected $compromised;
public function __construct() {
// add types in constructor
@ -142,6 +145,7 @@ class Credential extends Entity implements \JsonSerializable{
'otp' => $this->getOtp(),
'hidden' => $this->getHidden(),
'shared_key' => $this->getSharedKey(),
'compromised' => $this->getCompromised()
];
}
}

Просмотреть файл

@ -138,6 +138,7 @@ class CredentialMapper extends Mapper {
$credential->setCustomFields($raw_credential['custom_fields']);
$credential->setOtp($raw_credential['otp']);
$credential->setHidden($raw_credential['hidden']);
$credential->setCompromised($raw_credential['compromised']);
if (isset($raw_credential['shared_key'])) {
$credential->setSharedKey($raw_credential['shared_key']);
}
@ -177,6 +178,7 @@ class CredentialMapper extends Mapper {
$credential->setOtp($raw_credential['otp']);
$credential->setHidden($raw_credential['hidden']);
$credential->setDeleteTime($raw_credential['delete_time']);
$credential->setCompromised($raw_credential['compromised']);
if (isset($raw_credential['shared_key'])) {
$credential->setSharedKey($raw_credential['shared_key']);