clean
[sgn.git] / lib / SGN / Controller / SiteStatus.pm
blob76fc8c7b9380b063ac1cafe5e1997da12cc69099
2 package SGN::Controller::SiteStatus;
4 use Moose;
6 BEGIN { extends 'Catalyst::Controller'; }
9 sub login_status :Path('/about/status/logins') Args(0) {
10 my $self = shift;
11 my $c = shift;
13 if (! ($c->user())) {
14 $c->res->redirect('/solpeople/login.pl');
15 return;
17 if (!$c->user()->check_roles("curator")) {
18 $c->stash->{template} = '/generic_message.mas';
19 $c->stash->{message} = 'You do not have the required privileges to view this page';
20 return;
23 my $login = CXGN::Login->new($c->dbc->dbh());
25 my %logins = $login->get_login_status();
27 my $summary = {};
28 foreach my $user_type (qw/curator submitter user/){
29 my $count = $logins{$_};
30 $count = 0 if $count eq "none";
31 $summary->{$user_type}=$count;
33 $c->stash->{logins} = \%logins;
34 my $detailed = "";
35 my @usernames;
37 foreach my $user_type (keys %{$logins{detailed}}) {
39 @usernames = (keys %{$logins{detailed}->{$user_type}});
44 $c->stash->{usernames} = \@usernames;
45 $c->stash->{template} = '/site/status.mas';