1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-27 12:36:14 +01:00

access all subvaults option for org users

This commit is contained in:
Kyle Spearrin 2017-04-20 22:19:18 -04:00
parent f92c5a214f
commit 4ba21638b1
4 changed files with 128 additions and 88 deletions

View File

@ -24,6 +24,7 @@
}
$scope.email = user.Email;
$scope.type = user.Type;
$scope.accessAllSubvaults = user.AccessAllSubvaults;
$scope.selectedSubvaults = subvaults;
});
});
@ -72,15 +73,18 @@
$scope.submitPromise = null;
$scope.submit = function (model) {
var subvaults = [];
for (var subvaultId in $scope.selectedSubvaults) {
if ($scope.selectedSubvaults.hasOwnProperty(subvaultId)) {
subvaults.push($scope.selectedSubvaults[subvaultId]);
if (!$scope.accessAllSubvaults) {
for (var subvaultId in $scope.selectedSubvaults) {
if ($scope.selectedSubvaults.hasOwnProperty(subvaultId)) {
subvaults.push($scope.selectedSubvaults[subvaultId]);
}
}
}
$scope.submitPromise = apiService.organizationUsers.put({ orgId: $state.params.orgId, id: id }, {
type: $scope.type,
subvaults: subvaults
subvaults: subvaults,
accessAllSubvaults: $scope.accessAllSubvaults
}, function () {
$uibModalInstance.close();
}).$promise;

View File

@ -60,16 +60,20 @@
$scope.submitPromise = null;
$scope.submit = function (model) {
var subvaults = [];
for (var subvaultId in $scope.selectedSubvaults) {
if ($scope.selectedSubvaults.hasOwnProperty(subvaultId)) {
subvaults.push($scope.selectedSubvaults[subvaultId]);
if (!model.accessAllSubvaults) {
for (var subvaultId in $scope.selectedSubvaults) {
if ($scope.selectedSubvaults.hasOwnProperty(subvaultId)) {
subvaults.push($scope.selectedSubvaults[subvaultId]);
}
}
}
$scope.submitPromise = apiService.organizationUsers.invite({ orgId: $state.params.orgId }, {
email: model.email,
type: model.type,
subvaults: subvaults
subvaults: subvaults,
accessAllSubvaults: model.accessAllSubvaults
}, function () {
$uibModalInstance.close();
}).$promise;

View File

@ -32,48 +32,64 @@
</div>
</div>
<h4>Subvault Access</h4>
<div ng-show="loading && !subvaults.length">
Loading...
<div class="radio">
<label>
<input type="radio" ng-model="accessAllSubvaults" name="AccessAllSubvaults"
ng-value="true" ng-checked="accessAllSubvaults">
This user can access and modify items in <u>all</u> current and future subvaults.
</label>
</div>
<div ng-show="!loading && !subvaults.length">
<p>No subvaults for your organization.</p>
<div class="radio">
<label>
<input type="radio" ng-model="accessAllSubvaults" name="AccessAllSubvaults"
ng-value="false" ng-checked="!accessAllSubvaults">
This user can access only the selected subvaults.
</label>
</div>
<div class="table-responsive" ng-show="subvaults.length" style="margin: 0;">
<table class="table table-striped table-hover" style="margin: 0;">
<thead>
<tr>
<th style="width: 40px;">
<input type="checkbox"
ng-checked="allSelected()"
ng-click="toggleSubvaultSelectionAll($event)">
</th>
<th>Name</th>
<th style="width: 100px; text-align: center;">Read Only</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="subvault in subvaults | orderBy: ['name']">
<td valign="middle">
<input type="checkbox"
name="selectedSubvaults[]"
value="{{subvault.id}}"
ng-checked="subvaultSelected(subvault)"
ng-click="toggleSubvaultSelection(subvault.id)">
</td>
<td valign="middle">
{{subvault.name}}
</td>
<td style="text-align: center;" valign="middle">
<input type="checkbox"
name="selectedSubvaultsReadonly[]"
value="{{subvault.id}}"
ng-disabled="!subvaultSelected(subvault)"
ng-checked="subvaultSelected(subvault) && selectedSubvaults[subvault.id].readOnly"
ng-click="toggleSubvaultReadOnlySelection(subvault.id)">
</td>
</tr>
</tbody>
</table>
<div ng-show="!accessAllSubvaults">
<div ng-show="loading && !subvaults.length">
Loading subvaults...
</div>
<div ng-show="!loading && !subvaults.length">
<p>No subvaults for your organization.</p>
</div>
<div class="table-responsive" ng-show="subvaults.length" style="margin: 0;">
<table class="table table-striped table-hover" style="margin: 0;">
<thead>
<tr>
<th style="width: 40px;">
<input type="checkbox"
ng-checked="allSelected()"
ng-click="toggleSubvaultSelectionAll($event)">
</th>
<th>Name</th>
<th style="width: 100px; text-align: center;">Read Only</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="subvault in subvaults | orderBy: ['name']">
<td valign="middle">
<input type="checkbox"
name="selectedSubvaults[]"
value="{{subvault.id}}"
ng-checked="subvaultSelected(subvault)"
ng-click="toggleSubvaultSelection(subvault.id)">
</td>
<td valign="middle">
{{subvault.name}}
</td>
<td style="text-align: center;" valign="middle">
<input type="checkbox"
name="selectedSubvaultsReadonly[]"
value="{{subvault.id}}"
ng-disabled="!subvaultSelected(subvault)"
ng-checked="subvaultSelected(subvault) && selectedSubvaults[subvault.id].readOnly"
ng-click="toggleSubvaultReadOnlySelection(subvault.id)">
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="modal-footer">

View File

@ -40,48 +40,64 @@
</div>
</div>
<h4>Subvault Access</h4>
<div ng-show="loading && !subvaults.length">
Loading...
<div class="radio">
<label>
<input type="radio" ng-model="model.accessAllSubvaults" name="AccessAllSubvaults"
ng-value="true" ng-checked="model.accessAllSubvaults">
This user can access and modify items in <u>all</u> current and future subvaults.
</label>
</div>
<div ng-show="!loading && !subvaults.length">
<p>No subvaults for your organization.</p>
<div class="radio">
<label>
<input type="radio" ng-model="model.accessAllSubvaults" name="AccessAllSubvaults"
ng-value="false" ng-checked="!model.accessAllSubvaults">
This user can access only the selected subvaults.
</label>
</div>
<div class="table-responsive" ng-show="subvaults.length" style="margin: 0;">
<table class="table table-striped table-hover" style="margin: 0;">
<thead>
<tr>
<th style="width: 40px;">
<input type="checkbox"
ng-checked="allSelected()"
ng-click="toggleSubvaultSelectionAll($event)">
</th>
<th>Name</th>
<th style="width: 100px; text-align: center;">Read Only</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="subvault in subvaults | orderBy: ['name'] track by subvault.id">
<td style="width: 40px;" valign="middle">
<input type="checkbox"
name="selectedSubvaults[]"
value="{{subvault.id}}"
ng-checked="subvaultSelected(subvault)"
ng-click="toggleSubvaultSelection(subvault.id)">
</td>
<td valign="middle">
{{subvault.name}}
</td>
<td style="width: 100px; text-align: center;" valign="middle">
<input type="checkbox"
name="selectedSubvaultsReadonly[]"
value="{{subvault.id}}"
ng-disabled="!subvaultSelected(subvault)"
ng-checked="subvaultSelected(subvault) && selectedSubvaults[subvault.id].readOnly"
ng-click="toggleSubvaultReadOnlySelection(subvault.id)">
</td>
</tr>
</tbody>
</table>
<div ng-show="!model.accessAllSubvaults">
<div ng-show="loading && !subvaults.length">
Loading subvaults...
</div>
<div ng-show="!loading && !subvaults.length">
<p>No subvaults for your organization.</p>
</div>
<div class="table-responsive" ng-show="subvaults.length" style="margin: 0;">
<table class="table table-striped table-hover" style="margin: 0;">
<thead>
<tr>
<th style="width: 40px;">
<input type="checkbox"
ng-checked="allSelected()"
ng-click="toggleSubvaultSelectionAll($event)">
</th>
<th>Name</th>
<th style="width: 100px; text-align: center;">Read Only</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="subvault in subvaults | orderBy: ['name'] track by subvault.id">
<td style="width: 40px;" valign="middle">
<input type="checkbox"
name="selectedSubvaults[]"
value="{{subvault.id}}"
ng-checked="subvaultSelected(subvault)"
ng-click="toggleSubvaultSelection(subvault.id)">
</td>
<td valign="middle">
{{subvault.name}}
</td>
<td style="width: 100px; text-align: center;" valign="middle">
<input type="checkbox"
name="selectedSubvaultsReadonly[]"
value="{{subvault.id}}"
ng-disabled="!subvaultSelected(subvault)"
ng-checked="subvaultSelected(subvault) && selectedSubvaults[subvault.id].readOnly"
ng-click="toggleSubvaultReadOnlySelection(subvault.id)">
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="modal-footer">