Ensure we render a useful string for access restriction users

This commit is contained in:
Johannes Zellner
2016-04-02 12:55:14 +02:00
parent 6dc17183ee
commit f6547c9b71
2 changed files with 18 additions and 5 deletions

View File

@@ -49,7 +49,7 @@
<label class="control-label">User</label>
<p>
This is a single user application.<br/><br/>
Access is granted to <b>{{appConfigure.app.accessRestriction.users[0]}}</b>.
Access is granted to <b>{{ renderAccessRestrictionUser(appConfigure.app.accessRestriction.users[0]) }}</b>.
</p>
</div>
<div class="form-group" ng-hide="appConfigure.app.manifest.singleUser">

View File

@@ -408,6 +408,15 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
});
};
$scope.renderAccessRestrictionUser = function (userId) {
var user = $scope.users.filter(function (u) { return u.id === userId; })[0];
// user not found
if (!user) return userId;
return user.username ? user.username : user.email;
};
$scope.cancel = function () {
window.history.back();
};
@@ -434,10 +443,14 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
});
}
if ($scope.user.admin) {
fetchUsers();
fetchGroups();
}
Client.refreshUserInfo(function (error) {
if (error) return console.error(error);
if ($scope.user.admin) {
fetchUsers();
fetchGroups();
}
});
// setup all the dialog focus handling
['appConfigureModal', 'appUninstallModal', 'appUpdateModal', 'appRestoreModal'].forEach(function (id) {