1
0
mirror of https://github.com/bitwarden/web synced 2026-01-02 08:33:18 +00:00

collection user refactor

This commit is contained in:
Kyle Spearrin
2017-05-11 14:52:51 -04:00
parent bfae8e7def
commit 6bda5d5983
3 changed files with 23 additions and 22 deletions

View File

@@ -10,18 +10,17 @@
$uibModalInstance.opened.then(function () {
$scope.loading = false;
apiService.collectionUsers.listCollection(
apiService.collections.listUsers(
{
orgId: $state.params.orgId,
collectionId: collection.id
id: collection.id
},
function (userList) {
if (userList && userList.Data.length) {
var users = [];
for (var i = 0; i < userList.Data.length; i++) {
users.push({
id: userList.Data[i].Id,
userId: userList.Data[i].UserId,
organizationUserId: userList.Data[i].OrganizationUserId,
name: userList.Data[i].Name,
email: userList.Data[i].Email,
type: userList.Data[i].Type,
@@ -41,16 +40,21 @@
return;
}
apiService.collectionUsers.del({ orgId: $state.params.orgId, id: user.id }, null, function () {
toastr.success(user.email + ' has been removed.', 'User Removed');
$analytics.eventTrack('Removed User From Collection');
var index = $scope.users.indexOf(user);
if (index > -1) {
$scope.users.splice(index, 1);
}
}, function () {
toastr.error('Unable to remove user.', 'Error');
});
apiService.collections.delUser(
{
orgId: $state.params.orgId,
id: collection.id,
orgUserId: user.organizationUserId
}, null, function () {
toastr.success(user.email + ' has been removed.', 'User Removed');
$analytics.eventTrack('Removed User From Collection');
var index = $scope.users.indexOf(user);
if (index > -1) {
$scope.users.splice(index, 1);
}
}, function () {
toastr.error('Unable to remove user.', 'Error');
});
};
$scope.close = function () {