mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 01:03:35 +00:00
leave organization
This commit is contained in:
@@ -44,6 +44,7 @@
|
|||||||
putUpgrade: { url: _apiUri + '/organizations/:id/upgrade', method: 'POST', params: { id: '@id' } },
|
putUpgrade: { url: _apiUri + '/organizations/:id/upgrade', method: 'POST', params: { id: '@id' } },
|
||||||
putCancel: { url: _apiUri + '/organizations/:id/cancel', method: 'POST', params: { id: '@id' } },
|
putCancel: { url: _apiUri + '/organizations/:id/cancel', method: 'POST', params: { id: '@id' } },
|
||||||
putReinstate: { url: _apiUri + '/organizations/:id/reinstate', method: 'POST', params: { id: '@id' } },
|
putReinstate: { url: _apiUri + '/organizations/:id/reinstate', method: 'POST', params: { id: '@id' } },
|
||||||
|
postLeave: { url: _apiUri + '/organizations/:id/leave', method: 'POST', params: { id: '@id' } },
|
||||||
del: { url: _apiUri + '/organizations/:id/delete', method: 'POST', params: { id: '@id' } }
|
del: { url: _apiUri + '/organizations/:id/delete', method: 'POST', params: { id: '@id' } }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,7 @@
|
|||||||
|
|
||||||
$scope.viewOrganization = function (org) {
|
$scope.viewOrganization = function (org) {
|
||||||
if (org.type === 2) { // 2 = User
|
if (org.type === 2) { // 2 = User
|
||||||
|
scrollToTop();
|
||||||
toastr.error('You cannot manage this organization.');
|
toastr.error('You cannot manage this organization.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -83,6 +84,27 @@
|
|||||||
$state.go('backend.org.dashboard', { orgId: org.id });
|
$state.go('backend.org.dashboard', { orgId: org.id });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.leaveOrganization = function (org) {
|
||||||
|
if (!confirm('Are you sure you want to leave this organization (' + org.name + ')?')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
apiService.organizations.postLeave({ id: org.id }, {}, function (response) {
|
||||||
|
authService.refreshAccessToken().then(function () {
|
||||||
|
var index = $scope.model.organizations.indexOf(org);
|
||||||
|
if (index > -1) {
|
||||||
|
$scope.model.organizations.splice(index, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
toastr.success('You have left the organization.');
|
||||||
|
scrollToTop();
|
||||||
|
});
|
||||||
|
}, function (error) {
|
||||||
|
toastr.error('Unable to leave this organization.');
|
||||||
|
scrollToTop();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$scope.twoFactor = function () {
|
$scope.twoFactor = function () {
|
||||||
var twoFactorModal = $uibModal.open({
|
var twoFactorModal = $uibModal.open({
|
||||||
animation: true,
|
animation: true,
|
||||||
@@ -114,4 +136,8 @@
|
|||||||
controller: 'settingsDeleteController'
|
controller: 'settingsDeleteController'
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function scrollToTop() {
|
||||||
|
$('html, body').animate({ scrollTop: 0 }, 200);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -114,13 +114,26 @@
|
|||||||
No organizations yet for your account.
|
No organizations yet for your account.
|
||||||
</div>
|
</div>
|
||||||
<div class="list-group" ng-if="model.organizations && model.organizations.length">
|
<div class="list-group" ng-if="model.organizations && model.organizations.length">
|
||||||
<a ng-repeat="org in model.organizations | orderBy: ['name']"
|
<div class="list-group-item" ng-repeat="org in model.organizations | orderBy: ['name']">
|
||||||
href="javascript:void(0)" ng-click="viewOrganization(org)" class="list-group-item">
|
<div class="btn-group" uib-dropdown dropdown-append-to-body>
|
||||||
<letter-avatar data="{{org.name}}" round="false" avwidth="25" avheight="25"
|
<button type="button" class="btn btn-default" uib-dropdown-toggle>
|
||||||
avclass="img-rounded" fontsize="10"></letter-avatar>
|
<i class="fa fa-cog"></i> <span class="caret"></span>
|
||||||
{{org.name}}
|
</button>
|
||||||
<span class="label bg-gray" ng-if="!org.enabled">DISABLED</span>
|
<ul class="dropdown-menu" uib-dropdown-menu>
|
||||||
</a>
|
<li>
|
||||||
|
<a href="javascript:void(0)" ng-click="leaveOrganization(org)" class="text-red">
|
||||||
|
<i class="fa fa-fw fa-remove"></i> Leave
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<a href="javascript:void(0)" ng-click="viewOrganization(org)">
|
||||||
|
<letter-avatar data="{{org.name}}" round="false" avwidth="25" avheight="25"
|
||||||
|
avclass="img-rounded" fontsize="10"></letter-avatar>
|
||||||
|
{{org.name}}
|
||||||
|
<span class="label bg-gray" ng-if="!org.enabled">DISABLED</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-footer">
|
<div class="box-footer">
|
||||||
<a ui-sref="backend.user.settingsCreateOrg" class="btn btn-default btn-flat">
|
<a ui-sref="backend.user.settingsCreateOrg" class="btn btn-default btn-flat">
|
||||||
|
|||||||
Reference in New Issue
Block a user