Commit d2caf8c9 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

wip(frontend): small fixes suggested by @gloriarodriguez

- sort attributes
- remove default after delete the last restriction
- set last to true by default on new

issue #916
parent 235966c8
......@@ -375,6 +375,7 @@
$scope.ldap_attribute = '';
$scope.ldap_attribute_value = '';
$scope.ldap_attribute_allowed=true;
$scope.ldap_attribute_last=true;
$http.get('/list_ldap_access/'+$scope.showmachine.id).then(function(response) {
$scope.ldap_attributes_domain = response.data.list;
$scope.ldap_attributes_default = response.data.default;
......
......@@ -651,7 +651,7 @@ get '/list_ldap_attributes/(#cn)' => sub {
return $c->render(json => []) if !$user;
$c->session(ldap_attributes_cn => $cn) if $user;
return $c->render(json => {attributes => [$user->attributes]});
return $c->render(json => {attributes => [sort $user->attributes]});
};
get '/count_ldap_entries/(#attribute)/(#value)' => sub {
......@@ -726,6 +726,12 @@ get '/delete_ldap_access/(#id_domain)/(#id_access)' => sub {
$domain->delete_ldap_access($c->stash('id_access'));
# delete default if it is the only one left
my @ldap_access = $domain->list_ldap_access();
if (scalar @ldap_access == 1 && $ldap_access[0]->{value} eq '*') {
$domain->delete_ldap_access($ldap_access[0]->{id});
}
return $c->render(json => { ok => 1 });
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment