Skip to content

Commit

Permalink
fix device registration role handling
Browse files Browse the repository at this point in the history
fixes #2674
fixes #2670
fixes #2669
  • Loading branch information
julsemaan committed Oct 6, 2017
1 parent 7c9f10c commit 10223d7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,10 @@ has_field 'description' =>
has_field 'category' =>
(
type => 'Select',
multiple => 1,
label => 'Roles',
label => 'Role',
options_method => \&options_roles,
element_class => ['chzn-deselect'],
element_attr => {'data-placeholder' => 'Click to add a role'},
tags => { after_element => \&help,
help => 'Nodes with the selected roles will be affected' },
help => 'The role to assign to devices registered from the specific portal. If none is specified, the role of the registrant is used.' },
);

has_field 'allowed_devices' =>
Expand All @@ -66,7 +63,7 @@ has_block definition =>
sub options_roles {
my $self = shift;
my @roles = map { $_->{name} => $_->{name} } @{$self->form->roles} if ($self->form->roles);
return @roles;
return ('' => '', @roles);
}

=head2 ACCEPT_CONTEXT
Expand Down
2 changes: 1 addition & 1 deletion lib/pf/ConfigStore/DeviceRegistration.pm
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ sub cleanupBeforeCommit {
=cut

sub _fields_expanded {
return qw(category allowed_devices);
return qw(allowed_devices);
}

=head1 AUTHOR
Expand Down
2 changes: 1 addition & 1 deletion lib/pfconfig/namespaces/config/DeviceRegistration.pm
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ sub build_child {

sub cleanup_after_read {
my ( $self, $id, $data ) = @_;
$self->expand_list( $data, qw(category allowed_devices) );
$self->expand_list( $data, qw(allowed_devices) );
}

=head1 AUTHOR
Expand Down

0 comments on commit 10223d7

Please sign in to comment.