From 4499ec6a223c7be6fb114a778c6b7220712e5ab3 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 23 Mar 2017 00:33:35 -0400 Subject: [PATCH] reinvite and remove org users --- .../organizationPeopleController.js | 24 +++++++++++++++++++ .../views/organizationPeople.html | 4 ++-- src/app/services/apiService.js | 1 + 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/app/organization/organizationPeopleController.js b/src/app/organization/organizationPeopleController.js index bd91a7368e..a08794e0cb 100644 --- a/src/app/organization/organizationPeopleController.js +++ b/src/app/organization/organizationPeopleController.js @@ -7,6 +7,30 @@ loadList(); }); + $scope.reinvite = function (user) { + apiService.organizationUsers.reinvite({ orgId: $state.params.orgId, id: user.id }, null, function () { + toastr.success(user.email + ' has been invited again.', 'User Invited'); + }, function () { + toastr.error('Unable to invite user.', 'Error'); + }); + }; + + $scope.delete = function (user) { + if (!confirm('Are you sure you want to remove this user (' + user.email + ')?')) { + return; + } + + apiService.organizationUsers.del({ orgId: $state.params.orgId, id: user.id }, null, function () { + toastr.success(user.email + ' has been removed.', 'User Removed'); + var index = $scope.users.indexOf(user); + if (index > -1) { + $scope.users.splice(index, 1); + } + }, function () { + toastr.error('Unable to remove user.', 'Error'); + }); + }; + $scope.confirm = function (user) { apiService.users.getPublicKey({ id: user.userId }, function (userKey) { var orgKey = cryptoService.getOrgKey($state.params.orgId); diff --git a/src/app/organization/views/organizationPeople.html b/src/app/organization/views/organizationPeople.html index 77cc83487f..cedd2d3dd2 100644 --- a/src/app/organization/views/organizationPeople.html +++ b/src/app/organization/views/organizationPeople.html @@ -31,8 +31,8 @@
  • Confirm
  • -
  • Re-send Invitation
  • -
  • Remove
  • +
  • Re-send Invitation
  • +
  • Remove
  • diff --git a/src/app/services/apiService.js b/src/app/services/apiService.js index 05907bf888..f8c12adb9c 100644 --- a/src/app/services/apiService.js +++ b/src/app/services/apiService.js @@ -43,6 +43,7 @@ get: { method: 'GET', params: { id: '@id', orgId: '@orgId' } }, list: { method: 'GET', params: { orgId: '@orgId' } }, invite: { url: _apiUri + '/organizations/:orgId/users/invite', method: 'POST', params: { orgId: '@orgId' } }, + reinvite: { url: _apiUri + '/organizations/:orgId/users/:id/reinvite', method: 'POST', params: { id: '@id', orgId: '@orgId' } }, accept: { url: _apiUri + '/organizations/:orgId/users/:id/accept', method: 'POST', params: { id: '@id', orgId: '@orgId' } }, confirm: { url: _apiUri + '/organizations/:orgId/users/:id/confirm', method: 'POST', params: { id: '@id', orgId: '@orgId' } }, put: { method: 'POST', params: { id: '@id', orgId: '@orgId' } },