This commit is contained in:
kevgliss 2016-11-17 12:16:30 -08:00 committed by GitHub
parent d54a11ad11
commit d11f254476
1 changed files with 14 additions and 14 deletions

View File

@ -37,7 +37,20 @@ angular.module('lemur')
.controller('AuthorityCreateController', function ($scope, $uibModalInstance, AuthorityService, AuthorityApi, LemurRestangular, RoleService, PluginService, WizardHandler, toaster) {
$scope.authority = LemurRestangular.restangularizeElement(null, {}, 'authorities');
// set the defaults
AuthorityService.getDefaults($scope.authority);
AuthorityService.getDefaults($scope.authority).then(function () {
PluginService.getByType('issuer').then(function (plugins) {
$scope.plugins = plugins;
if ($scope.authority.defaultIssuerPlugin) {
plugins.forEach(function(plugin) {
if (plugin.slug === $scope.authority.defaultIssuerPlugin) {
$scope.authority.plugin = plugin;
}
});
} else {
$scope.authority.plugin = plugins[0];
}
});
});
$scope.getAuthoritiesByName = function (value) {
return AuthorityService.findAuthorityByName(value).then(function (authorities) {
@ -71,19 +84,6 @@ angular.module('lemur')
});
};
PluginService.getByType('issuer').then(function (plugins) {
$scope.plugins = plugins;
if ($scope.authority.defaultIssuerPlugin) {
plugins.forEach(function(plugin) {
if (plugin.slug === $scope.authority.defaultIssuerPlugin) {
$scope.authority.plugin = plugin;
}
});
} else {
$scope.authority.plugin = plugins[0];
}
});
$scope.roleService = RoleService;
$scope.authorityService = AuthorityService;