From df1b58350ebcfa8ab57b3cbedff4fb22a73bf352 Mon Sep 17 00:00:00 2001 From: Marcos Zuriaga Date: Mon, 26 Sep 2016 20:49:30 +0200 Subject: [PATCH] Share beggins --- js/app/controllers/share.js | 17 +++++++++++++---- js/app/controllers/vault.js | 4 ++-- js/templates.js | 2 +- templates/views/share_credential.html | 2 +- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/js/app/controllers/share.js b/js/app/controllers/share.js index 8c5d093c..e4209108 100644 --- a/js/app/controllers/share.js +++ b/js/app/controllers/share.js @@ -68,16 +68,16 @@ angular.module('passmanApp') $scope.accessLevels = [ { label: 'Can edit', - value: 'CAN_EDIT' + value: '2' }, { label: 'Can view', - value: 'CAN_VIEW' + value: '1' } ]; $scope.inputSharedWith = []; - $scope.selectedAccessLevel = 'CAN_VIEW'; + $scope.selectedAccessLevel = '1'; $scope.searchUsers = function($query){ return ShareService.search($query) @@ -99,5 +99,14 @@ angular.module('passmanApp') } } - + $scope.applyShare = function(){ + console.log("boom!"); + var list = $scope.share_settings.credentialSharedWithUserAndGroup; + console.log(list); + for (var i = 0; i < list.length; i++){ + ShareService.getVaultsByUser(list[i].user_id).then(function(data){ + console.log(data); + }) + } + } }]); diff --git a/js/app/controllers/vault.js b/js/app/controllers/vault.js index 3ba69963..1fc7626a 100644 --- a/js/app/controllers/vault.js +++ b/js/app/controllers/vault.js @@ -74,11 +74,11 @@ angular.module('passmanApp') }; var key_size = 1024; - ShareService.generateRSAKeys(key_size, function (progress) { + ShareService.generateRSAKeys(key_size).progress(function (progress) { var p = progress > 0 ? 2 : 1; $scope.$apply(); $scope.creating_keys = 'Generating sharing keys (' + p + ' / 2)'; - }, function (kp) { + }).then(function (kp) { var pem = ShareService.rsaKeyPairToPEM(kp); $scope.creating_keys = false; $scope.sharing_keys.private_sharing_key = pem.privateKey; diff --git a/js/templates.js b/js/templates.js index da4c3ad1..749df644 100644 --- a/js/templates.js +++ b/js/templates.js @@ -101,7 +101,7 @@ angular.module('views/settings.html', []).run(['$templateCache', function($templ angular.module('views/share_credential.html', []).run(['$templateCache', function($templateCache) { 'use strict'; $templateCache.put('views/share_credential.html', - '
'); + '
'); }]); angular.module('views/show_vault.html', []).run(['$templateCache', function($templateCache) { diff --git a/templates/views/share_credential.html b/templates/views/share_credential.html index 938661e4..30349a48 100644 --- a/templates/views/share_credential.html +++ b/templates/views/share_credential.html @@ -23,7 +23,7 @@
- +