Skip to content

Commit afc2707

Browse files
Only show registered nodes
1 parent 69e6863 commit afc2707

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

html/captive-portal/lib/captiveportal/PacketFence/Controller/Status.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ sub is_lost_stolen {
9393
sub userIsAuthenticated : Private {
9494
my ( $self, $c ) = @_;
9595
my $pid = $c->user_session->{"username"} // $c->{_session}->{username};
96-
my @person_nodes = person_nodes($pid);
96+
my @person_nodes = person_reg_nodes($pid);
9797
my @nodes;
9898
foreach my $person_node (@person_nodes) {
9999
my $node = node_view($person_node->{mac});

lib/pf/person.pm

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ BEGIN {
3737
person_view_simple
3838
person_modify
3939
person_nodes
40+
person_reg_nodes
4041
person_security_events
4142
person_cleanup
4243
persons_without_nodes
@@ -282,6 +283,27 @@ sub person_nodes {
282283
return @{$iter->all // []};
283284
}
284285

286+
sub person_reg_nodes {
287+
my ($pid) = @_;
288+
my ($status, $iter) = pf::dal::node->search(
289+
-where => {
290+
pid => $pid,
291+
},
292+
-columns => [qw(mac pid notes regdate unregdate status user_agent computername device_class time_balance bandwidth_balance)],
293+
#To avoid join
294+
-from => pf::dal::node->table,
295+
-with_class => undef,
296+
-where => {
297+
status => "reg",
298+
},
299+
);
300+
if (is_error($status)) {
301+
return;
302+
}
303+
304+
return @{$iter->all // []};
305+
}
306+
285307
=head2 person_unassign_nodes
286308
287309
unassign the nodes of a person

0 commit comments

Comments
 (0)