Merge branch 'settingsRefactor'

This commit is contained in:
brantje 2016-12-30 14:10:11 +01:00
commit 483b13dae7
No known key found for this signature in database
GPG key ID: 5FF1D117F918687F
27 changed files with 372 additions and 114 deletions

View file

@ -14,6 +14,7 @@ namespace OCA\Passman\AppInfo;
use OCP\Util;
use OCP\BackgroundJob;
use OCP\App;
use OCA\Passman\Notifier;
use OCA\Passman\Activity;
require_once __DIR__ . '/autoload.php';
@ -49,3 +50,4 @@ $manager->registerExtension(function() {
* The string has to match the app's folder name
*/
Util::addTranslations('passman');
\OCP\App::registerAdmin('passman', 'templates/admin.settings');

View file

@ -40,8 +40,9 @@ For an demo of this app visit [https://demo.passman.cc](https://demo.passman.cc)
<database>sqlite</database>
<database min-version="5.5">mysql</database>
</dependencies>
<settings>
<admin>OCA\Passman\Settings\Admin</admin>
<admin>OCA\Passman\Controller\SettingsController</admin>
</settings>
<background-jobs>

View file

@ -67,6 +67,11 @@ return [
['name' => 'share#updateSharedCredentialACL', 'url' => '/api/v2/sharing/credential/{item_guid}/acl', 'verb' => 'PATCH'],
['name' => 'internal#getAppVersion', 'url' => '/api/v2/version', 'verb' => 'GET'],
//Settings
['name' => 'settings#getSettings', 'url' => '/api/v2/settings', 'verb' => 'GET'],
['name' => 'settings#saveUserSetting', 'url' => '/api/v2/settings/{key}/{value}', 'verb' => 'POST'],
['name' => 'settings#saveAdminSetting', 'url' => '/api/v2/settings/{key}/{value}/admin1/admin2', 'verb' => 'POST'],
//Translations
['name' => 'translation#getLanguageStrings', 'url' => '/api/v2/language', 'verb' => 'GET'],
@ -76,8 +81,5 @@ return [
['name' => 'internal#read', 'url' => '/api/internal/notifications/read/{credential_id}', 'verb' => 'DELETE'],
['name' => 'internal#getAppVersion', 'url' => '/api/internal/version', 'verb' => 'GET'],
['name' => 'internal#generatePerson', 'url' => '/api/internal/generate_person', 'verb' => 'GET'],
['name' => 'internal#save_settings', 'url' => '/api/internal/settings/{key}/{value}', 'verb' => 'POST'],
['name' => 'internal#get_settings', 'url' => '/api/internal/settings', 'verb' => 'GET'],
]
];

View file

@ -11,13 +11,11 @@
namespace OCA\Passman\Controller;
use OCA\Files_External\NotFoundException;
use OCA\Passman\Db\SharingACL;
use OCA\Passman\Service\SettingsService;
use OCA\Passman\Utility\NotFoundJSONResponse;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\IConfig;
use OCP\IRequest;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\ApiController;
@ -26,7 +24,7 @@ use OCA\Passman\Activity;
use OCA\Passman\Service\ActivityService;
use OCA\Passman\Service\CredentialRevisionService;
use OCA\Passman\Service\ShareService;
use OCP\IUser;
class CredentialController extends ApiController {
private $userId;
@ -34,7 +32,7 @@ class CredentialController extends ApiController {
private $activityService;
private $credentialRevisionService;
private $sharingService;
private $config;
private $settings;
public function __construct($AppName,
IRequest $request,
@ -43,7 +41,7 @@ class CredentialController extends ApiController {
ActivityService $activityService,
CredentialRevisionService $credentialRevisionService,
ShareService $sharingService,
IConfig $config
SettingsService $settings
) {
parent::__construct($AppName, $request);
$this->userId = $userId;
@ -51,7 +49,7 @@ class CredentialController extends ApiController {
$this->activityService = $activityService;
$this->credentialRevisionService = $credentialRevisionService;
$this->sharingService = $sharingService;
$this->config = $config;
$this->settings = $settings;
}
@ -151,7 +149,7 @@ class CredentialController extends ApiController {
} else {
return new DataResponse(['msg' => 'Not authorized'], Http::STATUS_UNAUTHORIZED);
}
if ($this->config->getAppValue('passman', 'user_sharing_enabled', 1) === 0 || $this->config->getAppValue('passman', 'user_sharing_enabled', 1) === '0') {
if ($this->settings->isEnabled('user_sharing_enabled')) {
return new DataResponse(['msg' => 'Not authorized'], Http::STATUS_UNAUTHORIZED);
}
}

View file

@ -0,0 +1,96 @@
<?php
/**
* Nextcloud - passman
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Sander Brand <brantje@gmail.com>
* @copyright Sander Brand 2016
*/
namespace OCA\Passman\Controller;
use OCP\IL10N;
use OCP\Settings\ISettings;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\ApiController;
use OCP\IRequest;
use OCA\Passman\Service\SettingsService;
class SettingsController extends ApiController {
private $userId;
private $settings;
public function __construct(
$AppName,
IRequest $request,
$userId,
SettingsService $settings,
IL10N $l) {
parent::__construct($AppName, $request);
$this->settings = $settings;
$this->l = $l;
$this->userId = $userId;
}
/**
* @return TemplateResponse
*/
public function getForm() {
return new TemplateResponse('passman', 'part.admin');
}
/**
* @return string the section ID, e.g. 'sharing'
*/
public function getSection() {
return 'additional';
}
/**
* @return int whether the form should be rather on the top or bottom of
* the admin section. The forms are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
*
* E.g.: 70
*/
public function getPriority() {
return 0;
}
/**
* Get all settings
*
* @NoAdminRequired
* @NoCSRFRequired
*/
public function getSettings() {
$settings = $this->settings->getAppSettings();
return new JSONResponse($settings);
}
/**
* Save a user setting
*
* @NoAdminRequired
* @NoCSRFRequired
*/
public function saveUserSetting($key, $value) {
$this->settings->setUserSetting($key, $value);
return new JSONResponse('OK');
}
/**
* Save a app setting
*
* @NoCSRFRequired
*/
public function saveAdminSetting($key, $value) {
$this->settings->setAppSetting($key, $value);
return new JSONResponse('OK');
}
}

View file

@ -16,6 +16,7 @@ use OCA\Passman\Db\Vault;
use OCA\Passman\Service\CredentialService;
use OCA\Passman\Service\FileService;
use OCA\Passman\Service\NotificationService;
use OCA\Passman\Service\SettingsService;
use OCA\Passman\Service\ShareService;
use OCA\Passman\Utility\NotFoundJSONResponse;
use OCA\Passman\Utility\Utils;
@ -44,7 +45,7 @@ class ShareController extends ApiController {
private $credentialService;
private $notificationService;
private $fileService;
private $config;
private $settings;
private $limit = 50;
private $offset = 0;
@ -60,7 +61,7 @@ class ShareController extends ApiController {
CredentialService $credentialService,
NotificationService $notificationService,
FileService $fileService,
IConfig $config
SettingsService $config
) {
parent::__construct($AppName, $request);
@ -73,14 +74,9 @@ class ShareController extends ApiController {
$this->credentialService = $credentialService;
$this->notificationService = $notificationService;
$this->fileService = $fileService;
$this->config = $config;
$this->settings = $config;
}
private function isSharingEnabled() {
if ($this->config->getAppValue('passman', 'link_sharing_enabled', 1) === 0 || $this->config->getAppValue('passman', 'link_sharing_enabled', 1) === '0') {
return new JSONResponse(array());
}
}
/**
* @param $item_id
@ -91,8 +87,10 @@ class ShareController extends ApiController {
* @NoCSRFRequired
*/
public function createPublicShare($item_id, $item_guid, $permissions, $expire_timestamp, $expire_views) {
$this->isSharingEnabled();
if (!$this->settings->isEnabled('link_sharing_enabled')) {
return new JSONResponse(array());
}
try {
$credential = $this->credentialService->getCredentialByGUID($item_guid);
@ -130,7 +128,9 @@ class ShareController extends ApiController {
* @NoCSRFRequired
*/
public function applyIntermediateShare($item_id, $item_guid, $vaults, $permissions) {
$this->isSharingEnabled();
if (!$this->settings->isEnabled('user_sharing_enabled')) {
return new JSONResponse(array());
}
/**
* Assemble notification
*/
@ -223,7 +223,9 @@ class ShareController extends ApiController {
* @NoCSRFRequired
*/
public function unshareCredential($item_guid) {
$this->isSharingEnabled();
if (!$this->settings->isEnabled('user_sharing_enabled')) {
return new JSONResponse(array());
}
$acl_list = $this->shareService->getCredentialAclList($item_guid);
$request_list = $this->shareService->getShareRequestsByGuid($item_guid);
foreach ($acl_list as $ACL) {
@ -338,6 +340,9 @@ class ShareController extends ApiController {
* @NoCSRFRequired
*/
public function getPendingRequests() {
if (!$this->settings->isEnabled('user_sharing_enabled')) {
return new JSONResponse(array());
}
try {
$requests = $this->shareService->getUserPendingRequests($this->userId->getUID());
$results = array();
@ -374,7 +379,9 @@ class ShareController extends ApiController {
* @NoCSRFRequired
*/
public function getVaultItems($vault_guid) {
$this->isSharingEnabled();
if (!$this->settings->isEnabled('user_sharing_enabled')) {
return new JSONResponse(array());
}
try {
return new JSONResponse($this->shareService->getSharedItems($this->userId->getUID(), $vault_guid));
@ -426,7 +433,9 @@ class ShareController extends ApiController {
* @PublicPage
*/
public function getPublicCredentialData($credential_guid) {
$this->isSharingEnabled();
if (!$this->settings->isEnabled('user_sharing_enabled')) {
return new JSONResponse(array());
}
//@TODO Check expire date
$acl = $this->shareService->getACL(null, $credential_guid);

View file

@ -38,7 +38,7 @@
defaultVaultPass: null
};
$http.get(OC.generateUrl('apps/passman/api/internal/settings')).then(function (response) {
$http.get(OC.generateUrl('apps/passman/api/v2/settings')).then(function (response) {
if (response.data) {
settings = angular.merge(settings, response.data);
$rootScope.$broadcast('settings_loaded');

View file

@ -60,7 +60,7 @@ $(document).ready(function () {
setAdminKey: function (key, value) {
var request = $.ajax({
url: this._baseUrl + '/' + key + '/' + value,
url: this._baseUrl + '/' + key + '/' + value +'/admin1/admin2',
method: 'POST'
});
request.done(function () {
@ -84,7 +84,7 @@ $(document).ready(function () {
};
var settings = new Settings(OC.generateUrl('apps/passman/api/internal/settings'));
var settings = new Settings(OC.generateUrl('apps/passman/api/v2/settings'));
settings.load();
// ADMIN SETTINGS
@ -121,4 +121,8 @@ $(document).ready(function () {
settings.setAdminKey('vault_key_strength', $(this).val());
});
if($('form[name="passman_settings"]').length === 2){
$('form[name="passman_settings"]')[1].remove();
}
});

View file

@ -10,7 +10,6 @@ OC.L10N.register(
"Please fill in a label!" : "Bitte Beschriftung hinzufügen!",
"Please fill in a value!" : "Bitte einen Wert hinzufügen!",
"Error loading file" : "Fehler beim Laden der Datei",
"An error happend during decryption" : "Ein Fehler ist beim Entschlüsseln aufgetreten",
"Credential created!" : "Anmeldeinformation erstellt!",
"Credential deleted" : "Anmeldeinformation gelöscht",
"Credential updated" : "Anmeldeinformation aktualisiert",
@ -44,6 +43,10 @@ OC.L10N.register(
"Credential unshared" : "Anmeldeinformation wird nicht mehr geteilt",
"Credential shared" : "Anmeldeinformation wird geteilt",
"Saved!" : "Gespeichert!",
"Poor" : "Mangelhaft",
"Weak" : "Schwach",
"Good" : "Gut",
"Strong" : "Stark",
"Toggle visibility" : "Sichtbarkeit umschalten",
"Copy to clipboard" : "In die Zwischenablage kopieren",
"Copied to clipboard!" : "In die Zwischenablage kopiert!",
@ -224,6 +227,7 @@ OC.L10N.register(
"Click here to request it" : "Hier klicken um es anzufordern",
"Loading..." : "Lade...",
"Awwhh.... credential not found. Maybe it expired" : "Oh... Zugangsdaten nicht gefunden. Vielleicht sind sie abgelaufen",
"Error while saving field" : "Fehler beim Speichern des Feldes",
"A Passman item has been created, modified or deleted" : "Ein Passman-Element wurde erstellt, modifiziert oder gelöscht",
"A Passman item has expired" : "Ein Passman-Element ist abgelaufen",
"A Passman item has been shared" : "Ein Passman-Element wurde geteilt",
@ -252,6 +256,15 @@ OC.L10N.register(
"%s shared \"%s\" with you. Click here to accept" : "%s teilt \"%s\" mit dir. Um dies zu akzeptieren, klicke hier",
"%s has declined your share request for \"%s\"." : "%s hat das Teilen von \"%s\" mit dir abgelehnt.",
"%s has accepted your share request for \"%s\"." : "%s hat das Teilen von \"%s\" mit dir akzeptiert.",
"Unable to get version info" : "Versionsinfo konnte nicht ermittelt werden",
"Passman Settings" : "Passman-Einstellungen",
"Github version:" : "Github-Version:",
"A newer version of passman is available" : "Es ist eine neuere Version von Passman verfügbar",
"Allow users on this server to share passwords with a link" : "Erlaube Benutzern dieses Servers das Teilen von Passwörtern via Link",
"Allow users on this server to share passwords with other users" : "Erlaube Benutzern dieses Servers das Teilen von Passwörtern mit anderen Benutzern",
"Check for new versions" : "Nach neuerer Version suchen",
"Enable HTTPS check" : "HTTPS-Prüfung aktivieren",
"Disable context menu" : "Kontextmenü deaktivieren",
"Connection to server lost" : "Verbindung zum Server verloren",
"Problem loading page, reloading in 5 seconds" : "Problem beim Laden der Seite, Seite wird in 5 Sekunden nochmals geladen",
"Saving..." : "Speichere…",

View file

@ -8,7 +8,6 @@
"Please fill in a label!" : "Bitte Beschriftung hinzufügen!",
"Please fill in a value!" : "Bitte einen Wert hinzufügen!",
"Error loading file" : "Fehler beim Laden der Datei",
"An error happend during decryption" : "Ein Fehler ist beim Entschlüsseln aufgetreten",
"Credential created!" : "Anmeldeinformation erstellt!",
"Credential deleted" : "Anmeldeinformation gelöscht",
"Credential updated" : "Anmeldeinformation aktualisiert",
@ -42,6 +41,10 @@
"Credential unshared" : "Anmeldeinformation wird nicht mehr geteilt",
"Credential shared" : "Anmeldeinformation wird geteilt",
"Saved!" : "Gespeichert!",
"Poor" : "Mangelhaft",
"Weak" : "Schwach",
"Good" : "Gut",
"Strong" : "Stark",
"Toggle visibility" : "Sichtbarkeit umschalten",
"Copy to clipboard" : "In die Zwischenablage kopieren",
"Copied to clipboard!" : "In die Zwischenablage kopiert!",
@ -222,6 +225,7 @@
"Click here to request it" : "Hier klicken um es anzufordern",
"Loading..." : "Lade...",
"Awwhh.... credential not found. Maybe it expired" : "Oh... Zugangsdaten nicht gefunden. Vielleicht sind sie abgelaufen",
"Error while saving field" : "Fehler beim Speichern des Feldes",
"A Passman item has been created, modified or deleted" : "Ein Passman-Element wurde erstellt, modifiziert oder gelöscht",
"A Passman item has expired" : "Ein Passman-Element ist abgelaufen",
"A Passman item has been shared" : "Ein Passman-Element wurde geteilt",
@ -250,6 +254,15 @@
"%s shared \"%s\" with you. Click here to accept" : "%s teilt \"%s\" mit dir. Um dies zu akzeptieren, klicke hier",
"%s has declined your share request for \"%s\"." : "%s hat das Teilen von \"%s\" mit dir abgelehnt.",
"%s has accepted your share request for \"%s\"." : "%s hat das Teilen von \"%s\" mit dir akzeptiert.",
"Unable to get version info" : "Versionsinfo konnte nicht ermittelt werden",
"Passman Settings" : "Passman-Einstellungen",
"Github version:" : "Github-Version:",
"A newer version of passman is available" : "Es ist eine neuere Version von Passman verfügbar",
"Allow users on this server to share passwords with a link" : "Erlaube Benutzern dieses Servers das Teilen von Passwörtern via Link",
"Allow users on this server to share passwords with other users" : "Erlaube Benutzern dieses Servers das Teilen von Passwörtern mit anderen Benutzern",
"Check for new versions" : "Nach neuerer Version suchen",
"Enable HTTPS check" : "HTTPS-Prüfung aktivieren",
"Disable context menu" : "Kontextmenü deaktivieren",
"Connection to server lost" : "Verbindung zum Server verloren",
"Problem loading page, reloading in 5 seconds" : "Problem beim Laden der Seite, Seite wird in 5 Sekunden nochmals geladen",
"Saving..." : "Speichere…",

View file

@ -10,7 +10,6 @@ OC.L10N.register(
"Please fill in a label!" : "Bitte Beschriftung hinzufügen!",
"Please fill in a value!" : "Bitte einen Wert hinzufügen!",
"Error loading file" : "Fehler beim Laden der Datei",
"An error happend during decryption" : "Ein Fehler ist beim Entschlüsseln aufgetreten",
"Credential created!" : "Anmeldeinformation erstellt!",
"Credential deleted" : "Anmeldeinformation gelöscht",
"Credential updated" : "Anmeldeinformation aktualisiert",
@ -44,6 +43,10 @@ OC.L10N.register(
"Credential unshared" : "Anmeldeinformation wird nicht mehr geteilt",
"Credential shared" : "Anmeldeinformation wird geteilt",
"Saved!" : "Gespeichert!",
"Poor" : "mangelhaft",
"Weak" : "Schwach",
"Good" : "Gut",
"Strong" : "Stark",
"Toggle visibility" : "Sichtbarkeit umschalten",
"Copy to clipboard" : "In die Zwischenablage kopieren",
"Copied to clipboard!" : "In die Zwischenablage kopiert!",
@ -224,6 +227,7 @@ OC.L10N.register(
"Click here to request it" : "Hier klicken um es anzufordern",
"Loading..." : "Lade...",
"Awwhh.... credential not found. Maybe it expired" : "Oh... Zugangsdaten nicht gefunden. Vielleicht sind sie abgelaufen",
"Error while saving field" : "Fehler beim Speichern des Feldes",
"A Passman item has been created, modified or deleted" : "Ein Passman-Element wurde erstellt, modifiziert oder gelöscht",
"A Passman item has expired" : "Ein Passman-Element ist abgelaufen",
"A Passman item has been shared" : "Ein Passman-Element wurde geteilt",
@ -252,6 +256,15 @@ OC.L10N.register(
"%s shared \"%s\" with you. Click here to accept" : "%s teilt \"%s\" mit Ihnen. Um dies zu akzeptieren, klicken Sie bitte hier",
"%s has declined your share request for \"%s\"." : "%s hat das Teilen von \"%s\" mit Ihnen abgelehnt.",
"%s has accepted your share request for \"%s\"." : "%s hat das Teilen von \"%s\" mit Ihnen akzeptiert.",
"Unable to get version info" : "Versionsinfo konnte nicht ermittelt werden",
"Passman Settings" : "Passman-Einstellungen",
"Github version:" : "Github-Version:",
"A newer version of passman is available" : "Es ist eine neuere Version von Passman verfügbar",
"Allow users on this server to share passwords with a link" : "Erlaube Benutzern dieses Servers das Teilen von Passwörtern via Link",
"Allow users on this server to share passwords with other users" : "Erlaube Benutzern dieses Servers das Teilen von Passwörtern mit anderen Benutzern",
"Check for new versions" : "Nach neuerer Version suchen",
"Enable HTTPS check" : "HTTPS-Prüfung aktivieren",
"Disable context menu" : "Kontextmenü deaktivieren",
"Connection to server lost" : "Verbindung zum Server verloren",
"Problem loading page, reloading in 5 seconds" : "Problem beim Laden der Seite, Seite wird in 5 Sekunden erneut geladen",
"Saving..." : "Speichere...",

View file

@ -8,7 +8,6 @@
"Please fill in a label!" : "Bitte Beschriftung hinzufügen!",
"Please fill in a value!" : "Bitte einen Wert hinzufügen!",
"Error loading file" : "Fehler beim Laden der Datei",
"An error happend during decryption" : "Ein Fehler ist beim Entschlüsseln aufgetreten",
"Credential created!" : "Anmeldeinformation erstellt!",
"Credential deleted" : "Anmeldeinformation gelöscht",
"Credential updated" : "Anmeldeinformation aktualisiert",
@ -42,6 +41,10 @@
"Credential unshared" : "Anmeldeinformation wird nicht mehr geteilt",
"Credential shared" : "Anmeldeinformation wird geteilt",
"Saved!" : "Gespeichert!",
"Poor" : "mangelhaft",
"Weak" : "Schwach",
"Good" : "Gut",
"Strong" : "Stark",
"Toggle visibility" : "Sichtbarkeit umschalten",
"Copy to clipboard" : "In die Zwischenablage kopieren",
"Copied to clipboard!" : "In die Zwischenablage kopiert!",
@ -222,6 +225,7 @@
"Click here to request it" : "Hier klicken um es anzufordern",
"Loading..." : "Lade...",
"Awwhh.... credential not found. Maybe it expired" : "Oh... Zugangsdaten nicht gefunden. Vielleicht sind sie abgelaufen",
"Error while saving field" : "Fehler beim Speichern des Feldes",
"A Passman item has been created, modified or deleted" : "Ein Passman-Element wurde erstellt, modifiziert oder gelöscht",
"A Passman item has expired" : "Ein Passman-Element ist abgelaufen",
"A Passman item has been shared" : "Ein Passman-Element wurde geteilt",
@ -250,6 +254,15 @@
"%s shared \"%s\" with you. Click here to accept" : "%s teilt \"%s\" mit Ihnen. Um dies zu akzeptieren, klicken Sie bitte hier",
"%s has declined your share request for \"%s\"." : "%s hat das Teilen von \"%s\" mit Ihnen abgelehnt.",
"%s has accepted your share request for \"%s\"." : "%s hat das Teilen von \"%s\" mit Ihnen akzeptiert.",
"Unable to get version info" : "Versionsinfo konnte nicht ermittelt werden",
"Passman Settings" : "Passman-Einstellungen",
"Github version:" : "Github-Version:",
"A newer version of passman is available" : "Es ist eine neuere Version von Passman verfügbar",
"Allow users on this server to share passwords with a link" : "Erlaube Benutzern dieses Servers das Teilen von Passwörtern via Link",
"Allow users on this server to share passwords with other users" : "Erlaube Benutzern dieses Servers das Teilen von Passwörtern mit anderen Benutzern",
"Check for new versions" : "Nach neuerer Version suchen",
"Enable HTTPS check" : "HTTPS-Prüfung aktivieren",
"Disable context menu" : "Kontextmenü deaktivieren",
"Connection to server lost" : "Verbindung zum Server verloren",
"Problem loading page, reloading in 5 seconds" : "Problem beim Laden der Seite, Seite wird in 5 Sekunden erneut geladen",
"Saving..." : "Speichere...",

View file

@ -10,7 +10,6 @@ OC.L10N.register(
"Please fill in a label!" : "¡Por favor llene en una etiqueta!",
"Please fill in a value!" : "¡Por favor llene en un valor!",
"Error loading file" : "Error al cargar el archivo",
"An error happend during decryption" : "Un error sucedió durante el descifrado ",
"Credential created!" : "¡Credencial creada!",
"Credential deleted" : "Credencial eliminada",
"Credential updated" : "Credencial actualziada",

View file

@ -8,7 +8,6 @@
"Please fill in a label!" : "¡Por favor llene en una etiqueta!",
"Please fill in a value!" : "¡Por favor llene en un valor!",
"Error loading file" : "Error al cargar el archivo",
"An error happend during decryption" : "Un error sucedió durante el descifrado ",
"Credential created!" : "¡Credencial creada!",
"Credential deleted" : "Credencial eliminada",
"Credential updated" : "Credencial actualziada",

View file

@ -10,7 +10,6 @@ OC.L10N.register(
"Please fill in a label!" : "Veuillez remplir une étiquette !",
"Please fill in a value!" : "Veuillez remplir une valeur !",
"Error loading file" : "Erreur lors du chargement du fichier",
"An error happend during decryption" : "Une erreur est survenue lors du décryptage",
"Credential created!" : "Information d'identification créée !",
"Credential deleted" : "Information d'identification supprimée",
"Credential updated" : "Information d'identification mise à jour",
@ -44,6 +43,10 @@ OC.L10N.register(
"Credential unshared" : "Arrêt du partage de l'information d'identification ",
"Credential shared" : "Information d'identification partagée",
"Saved!" : "Sauvegardé !",
"Poor" : "Médiocre",
"Weak" : "Faible",
"Good" : "Bon",
"Strong" : "Fort",
"Toggle visibility" : "Activer la visibilité",
"Copy to clipboard" : "Copier dans le presse-papier",
"Copied to clipboard!" : "Copié dans le presse-papier !",
@ -204,6 +207,7 @@ OC.L10N.register(
"Click here to request it" : "Cliquez ici pour le demander",
"Loading..." : "Chargement...",
"Awwhh.... credential not found. Maybe it expired" : "Awwhh.... information d'identification non trouvée. Il est peut être expiré",
"Error while saving field" : "Erreur lors de la sauvegarde du champ",
"A Passman item has been created, modified or deleted" : "Un élément Passman a été créé, modifié ou supprimé",
"A Passman item has expired" : "Un élément Passman a expiré",
"A Passman item has been shared" : "Un élément Passman a été partagé",
@ -232,6 +236,14 @@ OC.L10N.register(
"%s shared \"%s\" with you. Click here to accept" : "%s a partagé \"%s\" avec vous. Cliquez ici pour accepter",
"%s has declined your share request for \"%s\"." : "%s a refusé votre demande de partage pour \"%s\"",
"%s has accepted your share request for \"%s\"." : "%s a accepté votre demande de partage pour \"%s\"",
"Unable to get version info" : "Impossible d'obtenir l'information de la version",
"Passman Settings" : "Paramètres de Passman",
"Github version:" : "Version Github :",
"A newer version of passman is available" : "Une version plus récente de Passman est disponible",
"Allow users on this server to share passwords with a link" : "Autoriser les utilisateurs de ce serveur à partager par lien des mots de passe",
"Allow users on this server to share passwords with other users" : "Autoriser les utilisateurs de ce serveur à partager des mots de passe avec d'autres utilisateurs",
"Check for new versions" : "Vérifier la présence de nouvelles versions",
"Enable HTTPS check" : "Activer la vérification HTTPS",
"Connection to server lost" : "Connexion au serveur perdu",
"Problem loading page, reloading in 5 seconds" : "Problème de chargement de la page, actualisation dans 5 secondes",
"Saving..." : "Enregistrement…",

View file

@ -8,7 +8,6 @@
"Please fill in a label!" : "Veuillez remplir une étiquette !",
"Please fill in a value!" : "Veuillez remplir une valeur !",
"Error loading file" : "Erreur lors du chargement du fichier",
"An error happend during decryption" : "Une erreur est survenue lors du décryptage",
"Credential created!" : "Information d'identification créée !",
"Credential deleted" : "Information d'identification supprimée",
"Credential updated" : "Information d'identification mise à jour",
@ -42,6 +41,10 @@
"Credential unshared" : "Arrêt du partage de l'information d'identification ",
"Credential shared" : "Information d'identification partagée",
"Saved!" : "Sauvegardé !",
"Poor" : "Médiocre",
"Weak" : "Faible",
"Good" : "Bon",
"Strong" : "Fort",
"Toggle visibility" : "Activer la visibilité",
"Copy to clipboard" : "Copier dans le presse-papier",
"Copied to clipboard!" : "Copié dans le presse-papier !",
@ -202,6 +205,7 @@
"Click here to request it" : "Cliquez ici pour le demander",
"Loading..." : "Chargement...",
"Awwhh.... credential not found. Maybe it expired" : "Awwhh.... information d'identification non trouvée. Il est peut être expiré",
"Error while saving field" : "Erreur lors de la sauvegarde du champ",
"A Passman item has been created, modified or deleted" : "Un élément Passman a été créé, modifié ou supprimé",
"A Passman item has expired" : "Un élément Passman a expiré",
"A Passman item has been shared" : "Un élément Passman a été partagé",
@ -230,6 +234,14 @@
"%s shared \"%s\" with you. Click here to accept" : "%s a partagé \"%s\" avec vous. Cliquez ici pour accepter",
"%s has declined your share request for \"%s\"." : "%s a refusé votre demande de partage pour \"%s\"",
"%s has accepted your share request for \"%s\"." : "%s a accepté votre demande de partage pour \"%s\"",
"Unable to get version info" : "Impossible d'obtenir l'information de la version",
"Passman Settings" : "Paramètres de Passman",
"Github version:" : "Version Github :",
"A newer version of passman is available" : "Une version plus récente de Passman est disponible",
"Allow users on this server to share passwords with a link" : "Autoriser les utilisateurs de ce serveur à partager par lien des mots de passe",
"Allow users on this server to share passwords with other users" : "Autoriser les utilisateurs de ce serveur à partager des mots de passe avec d'autres utilisateurs",
"Check for new versions" : "Vérifier la présence de nouvelles versions",
"Enable HTTPS check" : "Activer la vérification HTTPS",
"Connection to server lost" : "Connexion au serveur perdu",
"Problem loading page, reloading in 5 seconds" : "Problème de chargement de la page, actualisation dans 5 secondes",
"Saving..." : "Enregistrement…",

View file

@ -10,7 +10,6 @@ OC.L10N.register(
"Please fill in a label!" : "Aggiungi un'etichetta!",
"Please fill in a value!" : "Aggiungi un valore!",
"Error loading file" : "Errore durante il caricamento del file",
"An error happend during decryption" : "Si è verificato un errore durante la decifratura",
"Credential created!" : "Credenziali create!",
"Credential deleted" : "Credenziali eliminate",
"Credential updated" : "Credenziali aggiornate",

View file

@ -8,7 +8,6 @@
"Please fill in a label!" : "Aggiungi un'etichetta!",
"Please fill in a value!" : "Aggiungi un valore!",
"Error loading file" : "Errore durante il caricamento del file",
"An error happend during decryption" : "Si è verificato un errore durante la decifratura",
"Credential created!" : "Credenziali create!",
"Credential deleted" : "Credenziali eliminate",
"Credential updated" : "Credenziali aggiornate",

View file

@ -10,7 +10,6 @@ OC.L10N.register(
"Please fill in a label!" : "Voeg een label toe!",
"Please fill in a value!" : "Geef een waarde op!",
"Error loading file" : "Fout bij laden bestand",
"An error happend during decryption" : "Er trad een fout op bij ontsleutelen",
"Credential created!" : "Inloggegevens aangemaakt!",
"Credential deleted" : "Inloggegevens verwijderd",
"Credential updated" : "Inloggegevens bijgewerkt",
@ -44,6 +43,10 @@ OC.L10N.register(
"Credential unshared" : "Delen inloggegevens gestopt",
"Credential shared" : "Inloggegevens gedeeld",
"Saved!" : "Opgeslagen!",
"Poor" : "Slecht",
"Weak" : "Zwak",
"Good" : "Goed",
"Strong" : "Sterk",
"Toggle visibility" : "Omschakelen zichtbaarheid",
"Copy to clipboard" : "Kopiëren naar het klembord",
"Copied to clipboard!" : "Gekopieerd naar het klembord!",
@ -224,6 +227,7 @@ OC.L10N.register(
"Click here to request it" : "Klik hier om het aan te vragen",
"Loading..." : "Laden...",
"Awwhh.... credential not found. Maybe it expired" : "Uhmmm.... inloggegeven niet gevonden. Misschien verlopen",
"Error while saving field" : "Fout bij opslaan veld",
"A Passman item has been created, modified or deleted" : "Er is een Passman object gemaakt, gewijzigd of verwijderd",
"A Passman item has expired" : "Er is een Passman object vervallen",
"A Passman item has been shared" : "Er is een Passman object gedeeld",
@ -252,6 +256,15 @@ OC.L10N.register(
"%s shared \"%s\" with you. Click here to accept" : "%s deelde \"%s\" met je. Klik hier om te accepteren",
"%s has declined your share request for \"%s\"." : "%s weigerde je aanvraag om \"%s\" te delen.",
"%s has accepted your share request for \"%s\"." : "%s accepteerde je aanvraag om \"%s\" te delen.",
"Unable to get version info" : "Kon de versieinformatie niet ophalen",
"Passman Settings" : "Passman instellingen",
"Github version:" : "Github versie:",
"A newer version of passman is available" : "Er is een meer recente versie van passman beschikbaar",
"Allow users on this server to share passwords with a link" : "Toestaan dat gebruikers op deze server wachtwoorden delen via een link",
"Allow users on this server to share passwords with other users" : "Toestaan dat gebruikers op deze server wachtwoorden met andere gebruikers delen",
"Check for new versions" : "Controleren op nieuwe versies",
"Enable HTTPS check" : "Inschakelen HTTPS controle",
"Disable context menu" : "Deactiveren contextmenu",
"Connection to server lost" : "Verbinding met server verloren",
"Problem loading page, reloading in 5 seconds" : "Probleem met het laden van de pagina, wordt ververst in 5 seconden",
"Saving..." : "Opslaan...",

View file

@ -8,7 +8,6 @@
"Please fill in a label!" : "Voeg een label toe!",
"Please fill in a value!" : "Geef een waarde op!",
"Error loading file" : "Fout bij laden bestand",
"An error happend during decryption" : "Er trad een fout op bij ontsleutelen",
"Credential created!" : "Inloggegevens aangemaakt!",
"Credential deleted" : "Inloggegevens verwijderd",
"Credential updated" : "Inloggegevens bijgewerkt",
@ -42,6 +41,10 @@
"Credential unshared" : "Delen inloggegevens gestopt",
"Credential shared" : "Inloggegevens gedeeld",
"Saved!" : "Opgeslagen!",
"Poor" : "Slecht",
"Weak" : "Zwak",
"Good" : "Goed",
"Strong" : "Sterk",
"Toggle visibility" : "Omschakelen zichtbaarheid",
"Copy to clipboard" : "Kopiëren naar het klembord",
"Copied to clipboard!" : "Gekopieerd naar het klembord!",
@ -222,6 +225,7 @@
"Click here to request it" : "Klik hier om het aan te vragen",
"Loading..." : "Laden...",
"Awwhh.... credential not found. Maybe it expired" : "Uhmmm.... inloggegeven niet gevonden. Misschien verlopen",
"Error while saving field" : "Fout bij opslaan veld",
"A Passman item has been created, modified or deleted" : "Er is een Passman object gemaakt, gewijzigd of verwijderd",
"A Passman item has expired" : "Er is een Passman object vervallen",
"A Passman item has been shared" : "Er is een Passman object gedeeld",
@ -250,6 +254,15 @@
"%s shared \"%s\" with you. Click here to accept" : "%s deelde \"%s\" met je. Klik hier om te accepteren",
"%s has declined your share request for \"%s\"." : "%s weigerde je aanvraag om \"%s\" te delen.",
"%s has accepted your share request for \"%s\"." : "%s accepteerde je aanvraag om \"%s\" te delen.",
"Unable to get version info" : "Kon de versieinformatie niet ophalen",
"Passman Settings" : "Passman instellingen",
"Github version:" : "Github versie:",
"A newer version of passman is available" : "Er is een meer recente versie van passman beschikbaar",
"Allow users on this server to share passwords with a link" : "Toestaan dat gebruikers op deze server wachtwoorden delen via een link",
"Allow users on this server to share passwords with other users" : "Toestaan dat gebruikers op deze server wachtwoorden met andere gebruikers delen",
"Check for new versions" : "Controleren op nieuwe versies",
"Enable HTTPS check" : "Inschakelen HTTPS controle",
"Disable context menu" : "Deactiveren contextmenu",
"Connection to server lost" : "Verbinding met server verloren",
"Problem loading page, reloading in 5 seconds" : "Probleem met het laden van de pagina, wordt ververst in 5 seconden",
"Saving..." : "Opslaan...",

View file

@ -10,7 +10,6 @@ OC.L10N.register(
"Please fill in a label!" : "Preencha o rótulo!",
"Please fill in a value!" : "Preencha um valor!",
"Error loading file" : "Erro ao carregar o arquivo",
"An error happend during decryption" : "Ocorreu um erro durante a descriptografia",
"Credential created!" : "Credencial criada!",
"Credential deleted" : "Credential excluída",
"Credential updated" : "Credencial atualizada",

View file

@ -8,7 +8,6 @@
"Please fill in a label!" : "Preencha o rótulo!",
"Please fill in a value!" : "Preencha um valor!",
"Error loading file" : "Erro ao carregar o arquivo",
"An error happend during decryption" : "Ocorreu um erro durante a descriptografia",
"Credential created!" : "Credencial criada!",
"Credential deleted" : "Credential excluída",
"Credential updated" : "Credencial atualizada",

View file

@ -36,6 +36,7 @@ use OCA\Passman\Service\FileService;
use OCA\Passman\Service\VaultService;
use OCA\Passman\Utility\Utils;
use OCA\Passman\Service\NotificationService;
Use OCA\Passman\Service\SettingsService;
use OCP\IConfig;
use OCP\IDBConnection;
@ -72,7 +73,7 @@ class Application extends App {
$c->query('CredentialService'),
$c->query('NotificationService'),
$c->query('FileService'),
$c->query('IConfig')
$c->query('SettingsService')
);
});
@ -112,6 +113,7 @@ class Application extends App {
$container->registerAlias('Utils', Utils::class);
$container->registerAlias('IDBConnection', IDBConnection::class);
$container->registerAlias('IConfig', IConfig::class);
$container->registerAlias('SettingsService', SettingsService::class);
}
/**

View file

@ -0,0 +1,114 @@
<?php
/**
* Nextcloud - passman
*
* @copyright Copyright (c) 2016, Sander Brand (brantje@gmail.com)
* @copyright Copyright (c) 2016, Marcos Zuriaga Miguel (wolfi@wolfi.es)
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Passman\Service;
use OCP\IConfig;
class SettingsService {
private $userId;
private $config;
private $appName;
public $settings;
private $numeric_settings = array(
'link_sharing_enabled',
'user_sharing_enabled',
'vault_key_strength',
'check_version',
'https_check',
'disable_contextmenu'
);
public function __construct($UserId, IConfig $config, $AppName) {
$this->userId = $UserId;
$this->config = $config;
$this->appName = $AppName;
}
/**
* Get all app settings
*
* @return array
*/
public function getAppSettings() {
$this->settings = array(
'link_sharing_enabled' => intval($this->config->getAppValue('passman', 'link_sharing_enabled', 1)),
'user_sharing_enabled' => intval($this->config->getAppValue('passman', 'user_sharing_enabled', 1)),
'vault_key_strength' => intval($this->config->getAppValue('passman', 'vault_key_strength', 3)),
'check_version' => intval($this->config->getAppValue('passman', 'check_version', 1)),
'https_check' => intval($this->config->getAppValue('passman', 'https_check', 1)),
'disable_contextmenu' => intval($this->config->getAppValue('passman', 'disable_contextmenu', 1)),
);
return $this->settings;
}
/**
* Get a app setting
*
* @param $key string
* @param null $default_value The default value if key does not exist
* @return mixed
*/
public function getAppSetting($key, $default_value = null) {
$value = $this->config->getAppValue('passman', $key, $default_value);
if (in_array($key, $this->numeric_settings)) {
$value = intval($value);
}
return $value;
}
/**
* Set a app setting
*
* @param $key string Setting name
* @param $value mixed Value of the setting
*/
public function setAppSetting($key, $value) {
$this->config->setAppValue('passman', $key, $value);
}
/**
* Set a user setting
*
* @param $key string Setting name
* @param $value mixed Value of the setting
*/
public function setUserSetting($key, $value){
return $this->config->setUserValue($this->userId, $this->appName, $key, $value);
}
/**
* Check if an setting is enabled (value of 1)
*
* @param $setting
* @return bool
*/
public function isEnabled($setting){
$value = intval($this->config->getAppValue('passman', $setting, false));
return ($value === 1);
}
}

View file

@ -1,70 +0,0 @@
<?php
/**
* Nextcloud - passman
*
* @copyright Copyright (c) 2016, Sander Brand (brantje@gmail.com)
* @copyright Copyright (c) 2016, Marcos Zuriaga Miguel (wolfi@wolfi.es)
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Passman\Settings;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use OCP\IL10N;
use OCP\Settings\ISettings;
class Admin implements ISettings {
private $config;
private $l;
public function __construct(
IConfig $config,
IL10N $l) {
$this->config = $config;
$this->l = $l;
}
/**
* @return TemplateResponse
*/
public function getForm() {
return new TemplateResponse('passman', 'settings-admin');
}
/**
* @return string the section ID, e.g. 'sharing'
*/
public function getSection() {
return 'additional';
}
/**
* @return int whether the form should be rather on the top or bottom of
* the admin section. The forms are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
*
* E.g.: 70
*/
public function getPriority() {
return 0;
}
}

View file

@ -0,0 +1,4 @@
<?php
namespace OCA\Passman;
$tmpl = new \OCP\Template('passman', 'part.admin');
return $tmpl->fetchPage();

View file

@ -25,7 +25,7 @@ if ($checkVersion) {
}
?>
<div id="passwordSharingSettings" class="followupsection">
<div id="passwordSharingSettings" class="followup section">
<form name="passman_settings">
<h2><?php p($l->t('Passman Settings')); ?></h2>
<?php