Skip to content

Commit

Permalink
wip(frontend): small fixes suggested by @gloriarodriguez
Browse files Browse the repository at this point in the history
- sort attributes
- remove default after delete the last restriction
- set last to true by default on new

issue UPC#916
  • Loading branch information
frankiejol committed Nov 13, 2018
1 parent 235966c commit d2caf8c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions public/js/ravada.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 7 additions & 1 deletion rvd_front.pl
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@
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 {
Expand Down Expand Up @@ -726,6 +726,12 @@ ($c, $domain, $allowed)

$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 });
};

Expand Down

0 comments on commit d2caf8c

Please sign in to comment.