1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-23 11:56:00 +01:00

cleanup and model changes

This commit is contained in:
Kyle Spearrin 2017-05-11 10:32:39 -04:00
parent 12096a8fb3
commit 96a91b97e9
4 changed files with 13 additions and 14 deletions

View File

@ -80,13 +80,13 @@
}); });
}; };
$scope.edit = function (id) { $scope.edit = function (orgUser) {
var modal = $uibModal.open({ var modal = $uibModal.open({
animation: true, animation: true,
templateUrl: 'app/organization/views/organizationPeopleEdit.html', templateUrl: 'app/organization/views/organizationPeopleEdit.html',
controller: 'organizationPeopleEditController', controller: 'organizationPeopleEditController',
resolve: { resolve: {
id: function () { return id; } orgUser: function () { return orgUser; }
} }
}); });

View File

@ -1,8 +1,8 @@
angular angular
.module('bit.organization') .module('bit.organization')
.controller('organizationPeopleEditController', function ($scope, $state, $uibModalInstance, apiService, cipherService, id, .controller('organizationPeopleEditController', function ($scope, $state, $uibModalInstance, apiService, cipherService,
$analytics) { orgUser, $analytics) {
$analytics.eventTrack('organizationPeopleEditController', { category: 'Modal' }); $analytics.eventTrack('organizationPeopleEditController', { category: 'Modal' });
$scope.loading = true; $scope.loading = true;
@ -15,17 +15,17 @@
$scope.loading = false; $scope.loading = false;
}); });
apiService.organizationUsers.get({ orgId: $state.params.orgId, id: id }, function (user) { apiService.organizationUsers.get({ orgId: $state.params.orgId, id: orgUser.id }, function (user) {
var collections = {}; var collections = {};
if (user && user.Collections) { if (user && user.Collections) {
for (var i = 0; i < user.Collections.Data.length; i++) { for (var i = 0; i < user.Collections.length; i++) {
collections[user.Collections.Data[i].Id] = { collections[user.Collections[i].Id] = {
collectionId: user.Collections.Data[i].Id, collectionId: user.Collections[i].Id,
readOnly: user.Collections.Data[i].ReadOnly readOnly: user.Collections[i].ReadOnly
}; };
} }
} }
$scope.email = user.Email; $scope.email = orgUser.email;
$scope.type = user.Type; $scope.type = user.Type;
$scope.accessAll = user.AccessAll; $scope.accessAll = user.AccessAll;
$scope.selectedCollections = collections; $scope.selectedCollections = collections;
@ -87,7 +87,7 @@
$scope.submitPromise = apiService.organizationUsers.put( $scope.submitPromise = apiService.organizationUsers.put(
{ {
orgId: $state.params.orgId, orgId: $state.params.orgId,
id: id id: orgUser.id
}, { }, {
type: $scope.type, type: $scope.type,
collections: collections, collections: collections,

View File

@ -37,7 +37,7 @@
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li> <li>
<a href="javascript:void(0)" ng-click="edit(user.id)"> <a href="javascript:void(0)" ng-click="edit(user)">
<i class="fa fa-fw fa-pencil"></i> Edit <i class="fa fa-fw fa-pencil"></i> Edit
</a> </a>
</li> </li>
@ -68,7 +68,7 @@
<letter-avatar data="{{user.name || user.email}}"></letter-avatar> <letter-avatar data="{{user.name || user.email}}"></letter-avatar>
</td> </td>
<td> <td>
<a href="javascript:void(0)" ng-click="edit(user.id)">{{user.email}}</a> <a href="javascript:void(0)" ng-click="edit(user)">{{user.email}}</a>
<i class="fa fa-unlock text-muted" ng-show="user.accessAll" <i class="fa fa-unlock text-muted" ng-show="user.accessAll"
title="Can Access All Items"></i> title="Can Access All Items"></i>
<div ng-if="user.name"><small class="text-muted">{{user.name}}</small></div> <div ng-if="user.name"><small class="text-muted">{{user.name}}</small></div>

View File

@ -153,7 +153,6 @@
<script src="app/organization/organizationGroupsAddController.js"></script> <script src="app/organization/organizationGroupsAddController.js"></script>
<script src="app/organization/organizationGroupsEditController.js"></script> <script src="app/organization/organizationGroupsEditController.js"></script>
<script src="app/organization/organizationGroupsUsersController.js"></script> <script src="app/organization/organizationGroupsUsersController.js"></script>
<script src="app/organization/organizationCollectionsGroupsController.js"></script>
<script src="app/settings/settingsModule.js"></script> <script src="app/settings/settingsModule.js"></script>
<script src="app/settings/settingsController.js"></script> <script src="app/settings/settingsController.js"></script>