1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-09-15 02:18:42 +02:00

fixed to collection sharing. observe login edit.

This commit is contained in:
Kyle Spearrin 2017-05-08 11:36:11 -04:00
parent 565c6bafae
commit 4518e7056c
9 changed files with 30 additions and 12 deletions

View File

@ -19,8 +19,8 @@
var collections = {}; var collections = {};
if (user && user.Collections) { if (user && user.Collections) {
for (var i = 0; i < user.Collections.Data.length; i++) { for (var i = 0; i < user.Collections.Data.length; i++) {
collections[user.Collections.Data[i].CollectionId] = { collections[user.Collections.Data[i].Id] = {
collectionId: user.Collections.Data[i].CollectionId, collectionId: user.Collections.Data[i].Id,
readOnly: user.Collections.Data[i].ReadOnly readOnly: user.Collections.Data[i].ReadOnly
}; };
} }

View File

@ -27,7 +27,7 @@
_service.ciphers = $resource(_apiUri + '/ciphers/:id', {}, { _service.ciphers = $resource(_apiUri + '/ciphers/:id', {}, {
get: { method: 'GET', params: { id: '@id' } }, get: { method: 'GET', params: { id: '@id' } },
getFullDetails: { url: _apiUri + '/ciphers/:id/full-details', method: 'GET', params: { id: '@id' } }, getDetails: { url: _apiUri + '/ciphers/:id/details', method: 'GET', params: { id: '@id' } },
list: { method: 'GET', params: { includeFolders: false, includeShared: true } }, list: { method: 'GET', params: { includeFolders: false, includeShared: true } },
listDetails: { url: _apiUri + '/ciphers/details', method: 'GET', params: {} }, listDetails: { url: _apiUri + '/ciphers/details', method: 'GET', params: {} },
listOrganizationDetails: { url: _apiUri + '/ciphers/organization-details', method: 'GET', params: {} }, listOrganizationDetails: { url: _apiUri + '/ciphers/organization-details', method: 'GET', params: {} },

View File

@ -30,6 +30,7 @@ angular
'type': 1, 'type': 1,
folderId: encryptedLogin.FolderId, folderId: encryptedLogin.FolderId,
favorite: encryptedLogin.Favorite, favorite: encryptedLogin.Favorite,
edit: encryptedLogin.Edit,
name: cryptoService.decrypt(encryptedLogin.Name, key), name: cryptoService.decrypt(encryptedLogin.Name, key),
uri: encryptedLogin.Uri && encryptedLogin.Uri !== '' ? cryptoService.decrypt(encryptedLogin.Uri, key) : null, uri: encryptedLogin.Uri && encryptedLogin.Uri !== '' ? cryptoService.decrypt(encryptedLogin.Uri, key) : null,
username: encryptedLogin.Username && encryptedLogin.Username !== '' ? cryptoService.decrypt(encryptedLogin.Username, key) : null, username: encryptedLogin.Username && encryptedLogin.Username !== '' ? cryptoService.decrypt(encryptedLogin.Username, key) : null,
@ -54,6 +55,7 @@ angular
collectionIds: encryptedCipher.CollectionIds || [], collectionIds: encryptedCipher.CollectionIds || [],
folderId: encryptedCipher.FolderId, folderId: encryptedCipher.FolderId,
favorite: encryptedCipher.Favorite, favorite: encryptedCipher.Favorite,
edit: encryptedCipher.Edit,
name: _service.decryptProperty(encryptedCipher.Data.Name, key, false), name: _service.decryptProperty(encryptedCipher.Data.Name, key, false),
username: _service.decryptProperty(encryptedCipher.Data.Username, key, true) username: _service.decryptProperty(encryptedCipher.Data.Username, key, true)
}; };

View File

@ -40,6 +40,10 @@
}; };
$scope.folderSort = function (item) { $scope.folderSort = function (item) {
if (!item.id) {
return '';
}
return item.name.toLowerCase(); return item.name.toLowerCase();
}; };

View File

@ -63,6 +63,10 @@
}; };
$scope.folderSort = function (item) { $scope.folderSort = function (item) {
if (!item.id) {
return '';
}
return item.name.toLowerCase(); return item.name.toLowerCase();
}; };

View File

@ -12,7 +12,7 @@
$scope.collections = []; $scope.collections = [];
$uibModalInstance.opened.then(function () { $uibModalInstance.opened.then(function () {
apiService.ciphers.getFullDetails({ id: loginId }).$promise.then(function (cipher) { apiService.ciphers.getDetails({ id: loginId }).$promise.then(function (cipher) {
$scope.loadingLogin = false; $scope.loadingLogin = false;
$scope.readOnly = !cipher.Edit; $scope.readOnly = !cipher.Edit;
@ -42,7 +42,10 @@
apiService.collections.listMe(function (response) { apiService.collections.listMe(function (response) {
var collections = []; var collections = [];
for (var i = 0; i < response.Data.length; i++) { for (var i = 0; i < response.Data.length; i++) {
if (response.Data[i].OrganizationId !== cipher.OrganizationId) { if (response.Data[i].OrganizationId !== cipher.OrganizationId || response.Data[i].ReadOnly) {
if (response.Data[i].Id in $scope.selectedCollections) {
delete $scope.selectedCollections[response.Data[i].Id];
}
continue; continue;
} }

View File

@ -54,6 +54,10 @@
apiService.collections.listMe(function (response) { apiService.collections.listMe(function (response) {
var collections = []; var collections = [];
for (var i = 0; i < response.Data.length; i++) { for (var i = 0; i < response.Data.length; i++) {
if (response.Data[i].ReadOnly) {
continue;
}
var decCollection = cipherService.decryptCollection(response.Data[i]); var decCollection = cipherService.decryptCollection(response.Data[i]);
decCollection.organizationId = response.Data[i].OrganizationId; decCollection.organizationId = response.Data[i].OrganizationId;
collections.push(decCollection); collections.push(decCollection);
@ -70,7 +74,8 @@
var collections = {}; var collections = {};
if ($event.target.checked) { if ($event.target.checked) {
for (var i = 0; i < $scope.collections.length; i++) { for (var i = 0; i < $scope.collections.length; i++) {
if ($scope.model.organizationId && $scope.collections[i].organizationId === $scope.model.organizationId) { if ($scope.model.organizationId && $scope.collections[i].organizationId === $scope.model.organizationId
&& !$scope.collections[i].readOnly) {
collections[$scope.collections[i].id] = true; collections[$scope.collections[i].id] = true;
} }
} }

View File

@ -66,12 +66,12 @@
<i class="fa fa-fw fa-share-alt"></i> Share <i class="fa fa-fw fa-share-alt"></i> Share
</a> </a>
</li> </li>
<li ng-show="login.organizationId"> <li ng-show="login.organizationId && login.edit">
<a href="javascript:void(0)" ng-click="collections(login)"> <a href="javascript:void(0)" ng-click="collections(login)">
<i class="fa fa-fw fa-cubes"></i> Collections <i class="fa fa-fw fa-cubes"></i> Collections
</a> </a>
</li> </li>
<li> <li ng-show="login.edit">
<a href="javascript:void(0)" ng-click="deleteLogin(login)" class="text-red"> <a href="javascript:void(0)" ng-click="deleteLogin(login)" class="text-red">
<i class="fa fa-fw fa-trash"></i> Delete <i class="fa fa-fw fa-trash"></i> Delete
</a> </a>
@ -153,12 +153,12 @@
<i class="fa fa-fw fa-share-alt"></i> Share <i class="fa fa-fw fa-share-alt"></i> Share
</a> </a>
</li> </li>
<li ng-show="login.organizationId"> <li ng-show="login.organizationId && login.edit">
<a href="javascript:void(0)" ng-click="collections(login)"> <a href="javascript:void(0)" ng-click="collections(login)">
<i class="fa fa-fw fa-cubes"></i> Collections <i class="fa fa-fw fa-cubes"></i> Collections
</a> </a>
</li> </li>
<li> <li ng-show="login.edit">
<a href="javascript:void(0)" ng-click="deleteLogin(login)" class="text-red"> <a href="javascript:void(0)" ng-click="deleteLogin(login)" class="text-red">
<i class="fa fa-fw fa-trash"></i> Delete <i class="fa fa-fw fa-trash"></i> Delete
</a> </a>

View File

@ -62,12 +62,12 @@
<i class="fa fa-fw fa-pencil"></i> Edit <i class="fa fa-fw fa-pencil"></i> Edit
</a> </a>
</li> </li>
<li> <li ng-show="login.edit">
<a href="javascript:void(0)" ng-click="editCollections(login)"> <a href="javascript:void(0)" ng-click="editCollections(login)">
<i class="fa fa-fw fa-cubes"></i> Collections <i class="fa fa-fw fa-cubes"></i> Collections
</a> </a>
</li> </li>
<li> <li ng-show="login.edit">
<a href="javascript:void(0)" ng-click="removeLogin(login, collection)" <a href="javascript:void(0)" ng-click="removeLogin(login, collection)"
ng-if="collection.id" class="text-red"> ng-if="collection.id" class="text-red">
<i class="fa fa-fw fa-remove"></i> Remove <i class="fa fa-fw fa-remove"></i> Remove