1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-23 11:56:00 +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.email = user.Email;
$scope.type = user.Type; $scope.type = user.Type;
$scope.accessAllSubvaults = user.AccessAllSubvaults;
$scope.selectedSubvaults = subvaults; $scope.selectedSubvaults = subvaults;
}); });
}); });
@ -72,15 +73,18 @@
$scope.submitPromise = null; $scope.submitPromise = null;
$scope.submit = function (model) { $scope.submit = function (model) {
var subvaults = []; var subvaults = [];
if (!$scope.accessAllSubvaults) {
for (var subvaultId in $scope.selectedSubvaults) { for (var subvaultId in $scope.selectedSubvaults) {
if ($scope.selectedSubvaults.hasOwnProperty(subvaultId)) { if ($scope.selectedSubvaults.hasOwnProperty(subvaultId)) {
subvaults.push($scope.selectedSubvaults[subvaultId]); subvaults.push($scope.selectedSubvaults[subvaultId]);
} }
} }
}
$scope.submitPromise = apiService.organizationUsers.put({ orgId: $state.params.orgId, id: id }, { $scope.submitPromise = apiService.organizationUsers.put({ orgId: $state.params.orgId, id: id }, {
type: $scope.type, type: $scope.type,
subvaults: subvaults subvaults: subvaults,
accessAllSubvaults: $scope.accessAllSubvaults
}, function () { }, function () {
$uibModalInstance.close(); $uibModalInstance.close();
}).$promise; }).$promise;

View File

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

View File

@ -32,8 +32,23 @@
</div> </div>
</div> </div>
<h4>Subvault Access</h4> <h4>Subvault Access</h4>
<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 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 ng-show="!accessAllSubvaults">
<div ng-show="loading && !subvaults.length"> <div ng-show="loading && !subvaults.length">
Loading... Loading subvaults...
</div> </div>
<div ng-show="!loading && !subvaults.length"> <div ng-show="!loading && !subvaults.length">
<p>No subvaults for your organization.</p> <p>No subvaults for your organization.</p>
@ -76,6 +91,7 @@
</table> </table>
</div> </div>
</div> </div>
</div>
<div class="modal-footer"> <div class="modal-footer">
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="form.$loading"> <button type="submit" class="btn btn-primary btn-flat" ng-disabled="form.$loading">
<i class="fa fa-refresh fa-spin loading-icon" ng-show="form.$loading"></i>Submit <i class="fa fa-refresh fa-spin loading-icon" ng-show="form.$loading"></i>Submit

View File

@ -40,8 +40,23 @@
</div> </div>
</div> </div>
<h4>Subvault Access</h4> <h4>Subvault Access</h4>
<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 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 ng-show="!model.accessAllSubvaults">
<div ng-show="loading && !subvaults.length"> <div ng-show="loading && !subvaults.length">
Loading... Loading subvaults...
</div> </div>
<div ng-show="!loading && !subvaults.length"> <div ng-show="!loading && !subvaults.length">
<p>No subvaults for your organization.</p> <p>No subvaults for your organization.</p>
@ -84,6 +99,7 @@
</table> </table>
</div> </div>
</div> </div>
</div>
<div class="modal-footer"> <div class="modal-footer">
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="inviteForm.$loading"> <button type="submit" class="btn btn-primary btn-flat" ng-disabled="inviteForm.$loading">
<i class="fa fa-refresh fa-spin loading-icon" ng-show="inviteForm.$loading"></i>Send Invite <i class="fa fa-refresh fa-spin loading-icon" ng-show="inviteForm.$loading"></i>Send Invite