diff --git a/src/Hydra/hydra.conf b/src/Hydra/hydra.conf index e6501c82..ce065328 100644 --- a/src/Hydra/hydra.conf +++ b/src/Hydra/hydra.conf @@ -1 +1,19 @@ name Hydra + + + default_realm dbic + + + + class Password + password_field password + password_type hashed + password_hash_type SHA-1 + + + class DBIx::Class + user_class DB::Users + + + + diff --git a/src/Hydra/lib/Hydra.pm b/src/Hydra/lib/Hydra.pm index 1c8b98d6..8728caab 100644 --- a/src/Hydra/lib/Hydra.pm +++ b/src/Hydra/lib/Hydra.pm @@ -10,6 +10,10 @@ use Catalyst qw/-Debug ConfigLoader Static::Simple StackTrace + Authentication + Session + Session::Store::FastMmap + Session::State::Cookie /; our $VERSION = '0.01'; diff --git a/src/Hydra/lib/Hydra/Controller/Root.pm b/src/Hydra/lib/Hydra/Controller/Root.pm index 838a83c5..669bad8b 100644 --- a/src/Hydra/lib/Hydra/Controller/Root.pm +++ b/src/Hydra/lib/Hydra/Controller/Root.pm @@ -61,8 +61,45 @@ sub index :Path :Args(0) { } +sub login :Local { + my ($self, $c) = @_; + + my $username = $c->request->params->{username} || ""; + my $password = $c->request->params->{password} || ""; + + if ($username && $password) { + if ($c->authenticate({username => $username, password => $password})) { + $c->response->redirect( + defined $c->flash->{afterLogin} + ? $c->flash->{afterLogin} + : $c->uri_for('/')); + $c->flash->{afterLogin} = undef; + return; + } + $c->stash->{errorMsg} = "Bad username or password."; + } + + $c->stash->{template} = 'login.tt'; +} + + +sub logout :Local { + my ($self, $c) = @_; + $c->logout; + $c->response->redirect($c->uri_for('/')); +} + + +sub requireLogin { + my ($c) = @_; + $c->flash->{afterLogin} = $c->request->uri; + $c->response->redirect($c->uri_for('/login')); +} + + sub queue :Local { - my ($self, $c) = @_; + my ($self, $c) = @_; + return requireLogin($c) if !$c->user_exists; $c->stash->{template} = 'queue.tt'; $c->stash->{queue} = [$c->model('DB::Builds')->search( {finished => 0}, {join => 'schedulingInfo', order_by => ["priority DESC", "timestamp"]})]; diff --git a/src/Hydra/lib/Hydra/Schema.pm b/src/Hydra/lib/Hydra/Schema.pm index a0569e34..285200a0 100644 --- a/src/Hydra/lib/Hydra/Schema.pm +++ b/src/Hydra/lib/Hydra/Schema.pm @@ -8,8 +8,8 @@ use base 'DBIx::Class::Schema'; __PACKAGE__->load_classes; -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Pcp+OvDPqTvMftKcbkPkjA +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 20:02:52 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:jK/9VMZBot2RJwtlHA6QIg # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Buildinputs.pm b/src/Hydra/lib/Hydra/Schema/Buildinputs.pm index 3ebcc9b0..3dee83d1 100644 --- a/src/Hydra/lib/Hydra/Schema/Buildinputs.pm +++ b/src/Hydra/lib/Hydra/Schema/Buildinputs.pm @@ -36,8 +36,8 @@ __PACKAGE__->belongs_to("build", "Hydra::Schema::Builds", { id => "build" }); __PACKAGE__->belongs_to("dependency", "Hydra::Schema::Builds", { id => "dependency" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LXmRVGbyhgP5UGYK5ekbog +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 20:02:52 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LRcAsbLWbetVw+DCDnv/9w # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Buildproducts.pm b/src/Hydra/lib/Hydra/Schema/Buildproducts.pm index 3e886224..90bfab84 100644 --- a/src/Hydra/lib/Hydra/Schema/Buildproducts.pm +++ b/src/Hydra/lib/Hydra/Schema/Buildproducts.pm @@ -33,8 +33,8 @@ __PACKAGE__->set_primary_key("build", "productnr"); __PACKAGE__->belongs_to("build", "Hydra::Schema::Builds", { id => "build" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ai10FDZA/INuvAMu+1mvWw +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 20:02:52 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Pu6gWxltfVJJ+9DBiC9bYg # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Buildresultinfo.pm b/src/Hydra/lib/Hydra/Schema/Buildresultinfo.pm index 31c3d364..0a640825 100644 --- a/src/Hydra/lib/Hydra/Schema/Buildresultinfo.pm +++ b/src/Hydra/lib/Hydra/Schema/Buildresultinfo.pm @@ -29,8 +29,8 @@ __PACKAGE__->set_primary_key("id"); __PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KLmCZNoPd+vFmAj7XNtLMQ +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 20:02:52 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:X5GXZRLAaCMl8OKBGjtztw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Builds.pm b/src/Hydra/lib/Hydra/Schema/Builds.pm index 1ff5e317..05537fd6 100644 --- a/src/Hydra/lib/Hydra/Schema/Builds.pm +++ b/src/Hydra/lib/Hydra/Schema/Builds.pm @@ -70,8 +70,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hm/IA7ESnKT9gls0lw1Daw +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 20:02:52 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:h32zqOEGcpXQy7pshiWVMA __PACKAGE__->has_many(dependents => 'Hydra::Schema::Buildinputs', 'dependency'); diff --git a/src/Hydra/lib/Hydra/Schema/Buildschedulinginfo.pm b/src/Hydra/lib/Hydra/Schema/Buildschedulinginfo.pm index bc6f8a39..3b4e4697 100644 --- a/src/Hydra/lib/Hydra/Schema/Buildschedulinginfo.pm +++ b/src/Hydra/lib/Hydra/Schema/Buildschedulinginfo.pm @@ -23,8 +23,8 @@ __PACKAGE__->set_primary_key("id"); __PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:d/8LOVy+FfKFEo7iFbP3Gw +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 20:02:52 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:egegc7kFKTt9cEGuomi0cQ # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Buildsteps.pm b/src/Hydra/lib/Hydra/Schema/Buildsteps.pm index 67cb704c..3818f0ab 100644 --- a/src/Hydra/lib/Hydra/Schema/Buildsteps.pm +++ b/src/Hydra/lib/Hydra/Schema/Buildsteps.pm @@ -35,8 +35,8 @@ __PACKAGE__->set_primary_key("id", "stepnr"); __PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:a/DM38J4HR2LBDTeXvt4uA +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 20:02:52 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kFD90OFRM1aqVVCBCh/geA # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Cachedpathinputs.pm b/src/Hydra/lib/Hydra/Schema/Cachedpathinputs.pm index f8f630f8..030b8b70 100644 --- a/src/Hydra/lib/Hydra/Schema/Cachedpathinputs.pm +++ b/src/Hydra/lib/Hydra/Schema/Cachedpathinputs.pm @@ -22,8 +22,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("srcpath", "sha256hash"); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Pnefs6s7Y0i3YRE+BoWdDg +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 20:02:52 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:r/3GaLIIWaX1fh8kfuQp+w # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Cachedsubversioninputs.pm b/src/Hydra/lib/Hydra/Schema/Cachedsubversioninputs.pm index db92f0b3..02f818bd 100644 --- a/src/Hydra/lib/Hydra/Schema/Cachedsubversioninputs.pm +++ b/src/Hydra/lib/Hydra/Schema/Cachedsubversioninputs.pm @@ -20,8 +20,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("uri", "revision"); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gmw8LSLTRV00vCYDKiuZOw +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 20:02:52 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:yTp1XcBSQ+6OJvVLugRh1w # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Jobsetinputalts.pm b/src/Hydra/lib/Hydra/Schema/Jobsetinputalts.pm index 3f50ad5e..e9466924 100644 --- a/src/Hydra/lib/Hydra/Schema/Jobsetinputalts.pm +++ b/src/Hydra/lib/Hydra/Schema/Jobsetinputalts.pm @@ -33,8 +33,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:R26KAvuQZHKAyG/hEaB6Gw +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 20:02:52 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:lYdNLENxLW2mtZ2w+jou8w # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Jobsetinputs.pm b/src/Hydra/lib/Hydra/Schema/Jobsetinputs.pm index ccf2dc7c..1e5d24ef 100644 --- a/src/Hydra/lib/Hydra/Schema/Jobsetinputs.pm +++ b/src/Hydra/lib/Hydra/Schema/Jobsetinputs.pm @@ -43,8 +43,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:quDswVe6ApUm4cYVVijAEw +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 20:02:52 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Bk/vLWpBjR3ZU0p1KN7KfA # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Jobsets.pm b/src/Hydra/lib/Hydra/Schema/Jobsets.pm index b19c8578..a01e1843 100644 --- a/src/Hydra/lib/Hydra/Schema/Jobsets.pm +++ b/src/Hydra/lib/Hydra/Schema/Jobsets.pm @@ -50,8 +50,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nDI28mE5gmZwDozOG/0fnw +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 20:02:52 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9xvvQg/H0oibycB6B45V5A # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Projects.pm b/src/Hydra/lib/Hydra/Schema/Projects.pm index 5001393e..0c9ea455 100644 --- a/src/Hydra/lib/Hydra/Schema/Projects.pm +++ b/src/Hydra/lib/Hydra/Schema/Projects.pm @@ -30,8 +30,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SKZ/imJK1fjPbBEXde23Og +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 20:02:52 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3YMBhMqCjtpUjoTx4JLTOw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Systemtypes.pm b/src/Hydra/lib/Hydra/Schema/Systemtypes.pm index 858dc770..78b0f262 100644 --- a/src/Hydra/lib/Hydra/Schema/Systemtypes.pm +++ b/src/Hydra/lib/Hydra/Schema/Systemtypes.pm @@ -16,8 +16,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("system"); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/NVhmxcHU6YWCXDX9sO8mA +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 20:02:52 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SSKVFeg7ieeLJcF+s1uWWw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Users.pm b/src/Hydra/lib/Hydra/Schema/Users.pm new file mode 100644 index 00000000..47df1922 --- /dev/null +++ b/src/Hydra/lib/Hydra/Schema/Users.pm @@ -0,0 +1,28 @@ +package Hydra::Schema::Users; + +use strict; +use warnings; + +use base 'DBIx::Class'; + +__PACKAGE__->load_components("Core"); +__PACKAGE__->table("Users"); +__PACKAGE__->add_columns( + "username", + { data_type => "text", is_nullable => 0, size => undef }, + "fullname", + { data_type => "text", is_nullable => 0, size => undef }, + "emailaddress", + { data_type => "text", is_nullable => 0, size => undef }, + "password", + { data_type => "text", is_nullable => 0, size => undef }, +); +__PACKAGE__->set_primary_key("username"); + + +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 20:02:52 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BgF6FK+9d7+cc72sp6pfCQ + + +# You can replace this text with custom content, and it will be preserved on regeneration +1; diff --git a/src/Hydra/root/build.tt b/src/Hydra/root/build.tt index 56a85c79..7f13a438 100644 --- a/src/Hydra/root/build.tt +++ b/src/Hydra/root/build.tt @@ -17,7 +17,7 @@

Information

- +
diff --git a/src/Hydra/root/layout.tt b/src/Hydra/root/layout.tt index 4adf8d8b..94bac755 100644 --- a/src/Hydra/root/layout.tt +++ b/src/Hydra/root/layout.tt @@ -109,8 +109,12 @@
  • Admin
  • @@ -121,6 +125,9 @@ diff --git a/src/Hydra/root/project.tt b/src/Hydra/root/project.tt index cb97a04d..3c4398e1 100644 --- a/src/Hydra/root/project.tt +++ b/src/Hydra/root/project.tt @@ -74,7 +74,7 @@

    Information

    -
    Build ID: [% build.id %]
    +
    [% IF edit %] @@ -148,7 +148,7 @@

    General information

    -
    Identifier:
    +
    [% IF edit %] @@ -258,7 +258,7 @@

    Statistics

    -
    Identifier:
    +
    diff --git a/src/Hydra/root/static/css/hydra.css b/src/Hydra/root/static/css/hydra.css index 4763510f..ef3745fc 100644 --- a/src/Hydra/root/static/css/hydra.css +++ b/src/Hydra/root/static/css/hydra.css @@ -29,6 +29,10 @@ table { margin-bottom: 1em; } +.layoutTable td, .layoutTable th { + border-style: none; +} + th { text-align: center; font-weight: bold; diff --git a/src/hydra.sql b/src/hydra.sql index 04cc1864..d9a1c443 100644 --- a/src/hydra.sql +++ b/src/hydra.sql @@ -261,3 +261,11 @@ create table SystemTypes ( system text primary key not null, maxConcurrent integer not null default 2 ); + + +create table Users ( + userName text primary key not null, + fullName text, + emailAddress text not null, + password text not null -- sha256 hash +);
    Finished builds: [% finishedBuilds %]