Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Basic user/ip search for staff

  • Loading branch information...
commit eda48fa5fd839679a5e4af819ac154e7d5133c50 1 parent e239242
Ask Bjørn Hansen abh authored
10 apache/sites/manage.tmpl
View
@@ -21,6 +21,11 @@
[% PH %] NTPPool::Control::Manage->super
</Location>
+ <Location /scores/>
+ SetHandler perl-script
+ [% PH %] NTPPool::Control::Scores->super
+ </Location>
+
<Location /manage/vendor>
SetHandler perl-script
[% PH %] NTPPool::Control::Vendor->super
@@ -31,6 +36,11 @@
[% PH %] NTPPool::Control::Manage::Equipment->super
</Location>
+ <Location /api>
+ SetHandler perl-script
+ [% PH %] NTPPool::Control::API->super
+ </Location>
+
<Location /static>
SetHandler perl-script
[% PH %] NTPPool::Control::Basic->super
8 docs/ntppool/tpl/server.html → docs/shared/tpl/server.html
View
@@ -31,10 +31,12 @@
[% END %]
[% IF server.admin.public_profile
- OR combust.user.id == server.admin.id
- OR combust.user.privileges.see_all_user_profiles %]
+ OR combust.user.id == server.admin.id
+ OR combust.user.is_staff %]
Server admin: <a href="/user/[% (server.admin.username || server.admin.id) | html | uri %]"
->[% server.admin.username || server.admin.email %]</a><br/>
+>[% server.admin.username || server.admin.email %]</a>
+(<a href="mailto:[% server.admin.email |uri%]">[% server.admin.email |html %]</a>)
+<br/>
[% END %]
[% "Zones:" | l %]
[% FOR zone = server.zones_display %]
1  docs/shared/tpl/style/default.html
View
@@ -7,6 +7,7 @@
<link rel="shortcut icon" href="[% combust.static_url('/images/favicon.ico') %]" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="[% combust.static_url("/css/reset-fonts-grids.css") %]">
+
<link rel="stylesheet" href="[% combust.static_url("/css/master.css") %]" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="[% combust.static_url("/css/content.css") %]" type="text/css" media="screen" charset="utf-8" />
<link rel="icon" href="[% combust.static_url("/images/favicon.ico") %]" type="image/x-icon" />
6 lib/NP/Model/User.pm
View
@@ -4,6 +4,12 @@ use Net::IP;
sub BAD_SERVER_THRESHOLD { -15 }
+sub is_staff {
+ my $self = shift;
+ my $privileges = $self->privileges;
+ return $privileges->see_all_servers or $privileges->see_all_user_profiles or $privileges->support_staff;
+}
+
sub who {
my $self = shift;
$self->username || $self->email;
7 lib/NTPPool/Control.pm
View
@@ -191,7 +191,12 @@ sub _url {
$uri->scheme('https');
}
if ($args) {
- $uri->query($args);
+ if (ref $args) {
+ $uri->query_form(%$args);
+ }
+ else {
+ $uri->query($args);
+ }
}
return $uri->as_string;
}
11 lib/NTPPool/Control/Manage.pm
View
@@ -83,7 +83,16 @@ sub manage_dispatch {
return $self->handle_delete
if $self->request->uri =~ m!^/manage/server/delete!;
return $self->show_manage if $self->request->uri =~ m!^/manage/servers!;
- return $self->redirect('/manage/servers');
+
+ return $self->redirect('/manage/servers')
+ unless $self->user->is_staff;
+
+ return $self->show_staff;
+}
+
+sub show_staff {
+ my $self = shift;
+ return OK, $self->evaluate_template('tpl/staff.html');
}
sub show_manage {
14 lib/NTPPool/Control/Scores.pm
View
@@ -15,7 +15,16 @@ BEGIN {
sub render {
my $self = shift;
- $self->cache_control('s-maxage=1800');
+ my $public = $self->site->name eq 'ntppool' ? 1 : 0;
+ $self->cache_control('s-maxage=1800') if $public;
+
+ unless ($public or $self->user) {
+ $self->redirect( $self->www_url( $self->request->uri, $self->request->query_parameters ));
+ }
+
+ if (!$public) {
+ $self->tpl_param('manage_site', 1);
+ }
return $self->redirect('/scores/') if ($self->request->uri =~ m!^/s/?$!);
@@ -206,5 +215,8 @@ sub _calc_y {
(($h->score - 20) * -1) + 1;
}
+sub bc_user_class { NP::Model->user }
+sub bc_info_required { 'username,email' }
+
1;
Please sign in to comment.
Something went wrong with that request. Please try again.