mirror of
https://github.com/bitwarden/browser.git
synced 2024-09-01 00:10:39 +02:00
fixed to collection sharing. observe login edit.
This commit is contained in:
parent
565c6bafae
commit
4518e7056c
|
@ -19,8 +19,8 @@
|
|||
var collections = {};
|
||||
if (user && user.Collections) {
|
||||
for (var i = 0; i < user.Collections.Data.length; i++) {
|
||||
collections[user.Collections.Data[i].CollectionId] = {
|
||||
collectionId: user.Collections.Data[i].CollectionId,
|
||||
collections[user.Collections.Data[i].Id] = {
|
||||
collectionId: user.Collections.Data[i].Id,
|
||||
readOnly: user.Collections.Data[i].ReadOnly
|
||||
};
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
_service.ciphers = $resource(_apiUri + '/ciphers/: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 } },
|
||||
listDetails: { url: _apiUri + '/ciphers/details', method: 'GET', params: {} },
|
||||
listOrganizationDetails: { url: _apiUri + '/ciphers/organization-details', method: 'GET', params: {} },
|
||||
|
|
|
@ -30,6 +30,7 @@ angular
|
|||
'type': 1,
|
||||
folderId: encryptedLogin.FolderId,
|
||||
favorite: encryptedLogin.Favorite,
|
||||
edit: encryptedLogin.Edit,
|
||||
name: cryptoService.decrypt(encryptedLogin.Name, key),
|
||||
uri: encryptedLogin.Uri && encryptedLogin.Uri !== '' ? cryptoService.decrypt(encryptedLogin.Uri, key) : null,
|
||||
username: encryptedLogin.Username && encryptedLogin.Username !== '' ? cryptoService.decrypt(encryptedLogin.Username, key) : null,
|
||||
|
@ -54,6 +55,7 @@ angular
|
|||
collectionIds: encryptedCipher.CollectionIds || [],
|
||||
folderId: encryptedCipher.FolderId,
|
||||
favorite: encryptedCipher.Favorite,
|
||||
edit: encryptedCipher.Edit,
|
||||
name: _service.decryptProperty(encryptedCipher.Data.Name, key, false),
|
||||
username: _service.decryptProperty(encryptedCipher.Data.Username, key, true)
|
||||
};
|
||||
|
|
|
@ -40,6 +40,10 @@
|
|||
};
|
||||
|
||||
$scope.folderSort = function (item) {
|
||||
if (!item.id) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return item.name.toLowerCase();
|
||||
};
|
||||
|
||||
|
|
|
@ -63,6 +63,10 @@
|
|||
};
|
||||
|
||||
$scope.folderSort = function (item) {
|
||||
if (!item.id) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return item.name.toLowerCase();
|
||||
};
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
$scope.collections = [];
|
||||
|
||||
$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.readOnly = !cipher.Edit;
|
||||
|
@ -42,7 +42,10 @@
|
|||
apiService.collections.listMe(function (response) {
|
||||
var collections = [];
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,10 @@
|
|||
apiService.collections.listMe(function (response) {
|
||||
var collections = [];
|
||||
for (var i = 0; i < response.Data.length; i++) {
|
||||
if (response.Data[i].ReadOnly) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var decCollection = cipherService.decryptCollection(response.Data[i]);
|
||||
decCollection.organizationId = response.Data[i].OrganizationId;
|
||||
collections.push(decCollection);
|
||||
|
@ -70,7 +74,8 @@
|
|||
var collections = {};
|
||||
if ($event.target.checked) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,12 +66,12 @@
|
|||
<i class="fa fa-fw fa-share-alt"></i> Share
|
||||
</a>
|
||||
</li>
|
||||
<li ng-show="login.organizationId">
|
||||
<li ng-show="login.organizationId && login.edit">
|
||||
<a href="javascript:void(0)" ng-click="collections(login)">
|
||||
<i class="fa fa-fw fa-cubes"></i> Collections
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<li ng-show="login.edit">
|
||||
<a href="javascript:void(0)" ng-click="deleteLogin(login)" class="text-red">
|
||||
<i class="fa fa-fw fa-trash"></i> Delete
|
||||
</a>
|
||||
|
@ -153,12 +153,12 @@
|
|||
<i class="fa fa-fw fa-share-alt"></i> Share
|
||||
</a>
|
||||
</li>
|
||||
<li ng-show="login.organizationId">
|
||||
<li ng-show="login.organizationId && login.edit">
|
||||
<a href="javascript:void(0)" ng-click="collections(login)">
|
||||
<i class="fa fa-fw fa-cubes"></i> Collections
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<li ng-show="login.edit">
|
||||
<a href="javascript:void(0)" ng-click="deleteLogin(login)" class="text-red">
|
||||
<i class="fa fa-fw fa-trash"></i> Delete
|
||||
</a>
|
||||
|
|
|
@ -62,12 +62,12 @@
|
|||
<i class="fa fa-fw fa-pencil"></i> Edit
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<li ng-show="login.edit">
|
||||
<a href="javascript:void(0)" ng-click="editCollections(login)">
|
||||
<i class="fa fa-fw fa-cubes"></i> Collections
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<li ng-show="login.edit">
|
||||
<a href="javascript:void(0)" ng-click="removeLogin(login, collection)"
|
||||
ng-if="collection.id" class="text-red">
|
||||
<i class="fa fa-fw fa-remove"></i> Remove
|
||||
|
|
Loading…
Reference in New Issue
Block a user