mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-23 11:56:00 +01:00
collection user refactor
This commit is contained in:
parent
bfae8e7def
commit
6bda5d5983
@ -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 () {
|
||||
|
@ -22,12 +22,12 @@
|
||||
<i class="fa fa-cog"></i> <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li ng-show="user.id">
|
||||
<li ng-show="!user.accessAll">
|
||||
<a href="javascript:void(0)" ng-click="remove(user)" class="text-red">
|
||||
<i class="fa fa-fw fa-remove"></i> Remove
|
||||
</a>
|
||||
</li>
|
||||
<li ng-show="!user.id">
|
||||
<li ng-show="user.accessAll">
|
||||
<a href="javascript:void(0)">
|
||||
No options...
|
||||
</a>
|
||||
|
@ -74,14 +74,11 @@
|
||||
getDetails: { url: _apiUri + '/organizations/:orgId/collections/:id/details', method: 'GET', params: { id: '@id', orgId: '@orgId' } },
|
||||
listMe: { url: _apiUri + '/collections', method: 'GET', params: {} },
|
||||
listOrganization: { method: 'GET', params: { orgId: '@orgId' } },
|
||||
listUsers: { url: _apiUri + '/organizations/:orgId/collections/:id/users', method: 'GET', params: { id: '@id', orgId: '@orgId' } },
|
||||
post: { method: 'POST', params: { orgId: '@orgId' } },
|
||||
put: { method: 'POST', params: { id: '@id', orgId: '@orgId' } },
|
||||
del: { url: _apiUri + '/organizations/:orgId/collections/:id/delete', method: 'POST', params: { id: '@id', orgId: '@orgId' } }
|
||||
});
|
||||
|
||||
_service.collectionUsers = $resource(_apiUri + '/organizations/:orgId/collectionUsers/:id', {}, {
|
||||
listCollection: { url: _apiUri + '/organizations/:orgId/collectionUsers/:collectionId', method: 'GET', params: { collectionId: '@collectionId', orgId: '@orgId' } },
|
||||
del: { url: _apiUri + '/organizations/:orgId/collectionUsers/:id/delete', method: 'POST', params: { id: '@id', orgId: '@orgId' } }
|
||||
del: { url: _apiUri + '/organizations/:orgId/collections/:id/delete', method: 'POST', params: { id: '@id', orgId: '@orgId' } },
|
||||
delUser: { url: _apiUri + '/organizations/:orgId/collections/:id/delete-user/:orgUserId', method: 'POST', params: { id: '@id', orgId: '@orgId', orgUserId: '@orgUserId' } }
|
||||
});
|
||||
|
||||
_service.groups = $resource(_apiUri + '/organizations/:orgId/groups/:id', {}, {
|
||||
|
Loading…
Reference in New Issue
Block a user