Administration Panel

  

Device Control

Device Admin

User Control

User Admin

Maintenance

Action :
Debug :
[Reset]
    

Admin Log

<& SELF:show_log &>

Type:    Entries: [Reset]

Note: <%args> $entries => 20 @type => () <%shared> my ($arg_entries,$logs); my $user = $m->session->{user}; my $is_admin = $m->session->{user_admin}; my $secure = &is_secure; my $domain = $netdisco::CONFIG{domain}; my %actions = ( # action => [longname, confirm action?] 'expire_ips' => ['Database Cleanup - Expire IPs [-I]',1], 'graph' => ['Regenerate Graph',1], 'backup' => ['Run Nightly Backup',1], 'clean_nodes' => ['Database Cleanup - Nodes [-K]',1], 'clean_alias' => ['Database Cleanup - Aliases [-k]',1] ); my %log_events = ( 'user_add' => 'User Added', 'user_change' => 'User Changed', 'user_del' => 'User Deleted', 'login' => 'Login', 'http_login' => 'Login via HTTP', 'logout' => 'Logout', 'login_failure' => 'Login Failed', 'pw_change' => 'Passwd Changed', ); <%init> $arg_entries = $entries; # Send to https if not secure. unless ($secure){ my $url = url_secure($r->uri); $m->redirect($url); } # Send to login if not admin. unless ($is_admin) { my $url = $m->interp->apply_escapes( $r->uri, 'u' ); $m->redirect("login.html?done=$url"); } # Get names of events in db my $events = sql_column('user_log',['distinct(event)','true']); # Limit by Type my $where = {}; foreach my $this_type (@type){ next unless defined $this_type and $this_type; push (@{$where->{event}},$this_type); } # Fetch Admin Log Entries # TODO: this is going to get slower and slower, so I need to use the DB to limit it. $logs = sql_rows('user_log',['username','userip','event','details', 'extract(epoch from creation) as creation'], $where,1); %# %# show_log() - Barfs out contents of @$logs %# <%method show_log> % my $count = 0; % foreach my $log (sort {$b->{creation} <=> $a->{creation} }@$logs){ % my $event = $log_events{$log->{event}} || $log->{event}; % $count++; last if ($arg_entries ne 'All' and $count >= $arg_entries); %}
Date User Event IP Log

<%scalar localtime($log->{creation})%> <%$log->{username}%> <%$event%> <%$log->{userip}%> <%$log->{details}|h%>
<%method title> - Administration Panel \ %# $Id: admin.html,v 1.17 2006/03/09 00:05:35 fenner Exp $ %# vim:syntax=mason