diff --git a/src/app/vault/vaultSharedController.js b/src/app/vault/vaultSharedController.js index 74e1c5b469..2588c84a96 100644 --- a/src/app/vault/vaultSharedController.js +++ b/src/app/vault/vaultSharedController.js @@ -2,7 +2,7 @@ .module('bit.vault') .controller('vaultSharedController', function ($scope, apiService, cipherService, $analytics, $q, $localStorage, - $uibModal, $filter, $rootScope) { + $uibModal, $filter, $rootScope, authService, cryptoService) { $scope.logins = []; $scope.collections = []; $scope.loading = true; @@ -52,6 +52,54 @@ 'Edit the login and copy it manually instead.'); }; + $scope.attachments = function (login) { + authService.getUserProfile().then(function (profile) { + return { + isPremium: profile.premium, + orgUseStorage: login.organizationId && !!profile.organizations[login.organizationId].maxStorageGb + }; + }).then(function (perms) { + if (login.organizationId && !perms.orgUseStorage) { + $uibModal.open({ + animation: true, + templateUrl: 'app/views/paidOrgRequired.html', + controller: 'paidOrgRequiredController', + resolve: { + orgId: function () { return login.organizationId; } + } + }); + return; + } + + if (!login.organizationId && !perms.isPremium) { + $uibModal.open({ + animation: true, + templateUrl: 'app/views/premiumRequired.html', + controller: 'premiumRequiredController' + }); + return; + } + + if (!login.organizationId && !cryptoService.getEncKey()) { + toastr.error('You cannot use this feature until you update your encryption key.', 'Feature Unavailable'); + return; + } + + var attachmentModel = $uibModal.open({ + animation: true, + templateUrl: 'app/vault/views/vaultAttachments.html', + controller: 'vaultAttachmentsController', + resolve: { + loginId: function () { return login.id; } + } + }); + + attachmentModel.result.then(function (hasAttachments) { + login.hasAttachments = hasAttachments; + }); + }); + }; + $scope.filterByCollection = function (collection) { return function (cipher) { if (!cipher.collectionIds || !cipher.collectionIds.length) { diff --git a/src/app/vault/views/vaultShared.html b/src/app/vault/views/vaultShared.html index 67b0bdd5e2..9c71d010fe 100644 --- a/src/app/vault/views/vaultShared.html +++ b/src/app/vault/views/vaultShared.html @@ -62,6 +62,11 @@ Edit +
  • + + Attachments + +
  • Collections @@ -85,6 +90,8 @@ {{login.name}} +
    {{login.username}}