forked from lix-project/hydra
Add create-user action that was mostly present already.
This commit is contained in:
parent
90c9b5dd60
commit
396a356198
|
@ -99,9 +99,27 @@ sub create_user : Chained('admin') PathPart('create-user') Args(0) {
|
||||||
|
|
||||||
requireAdmin($c);
|
requireAdmin($c);
|
||||||
|
|
||||||
error($c, "Not implemented yet!"); # FIXME
|
$c->stash->{template} = 'user.tt';
|
||||||
|
$c->stash->{edit} = 1;
|
||||||
|
$c->stash->{create} = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub create_user_submit : Chained('admin') PathPart('create-user/submit') Args(0) {
|
||||||
|
my ($self, $c) = @_;
|
||||||
|
|
||||||
|
my $username = trim $c->request->params->{username};
|
||||||
|
|
||||||
|
txn_do($c->model('DB')->schema, sub {
|
||||||
|
my $user = $c->model('DB::Users')->create(
|
||||||
|
{username => $username, emailaddress => "", password => ""});
|
||||||
|
updateUser($c, $user);
|
||||||
|
});
|
||||||
|
|
||||||
|
$c->res->redirect("/admin/users");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sub user : Chained('admin') PathPart('user') CaptureArgs(1) {
|
sub user : Chained('admin') PathPart('user') CaptureArgs(1) {
|
||||||
my ($self, $c, $username) = @_;
|
my ($self, $c, $username) = @_;
|
||||||
|
@ -314,7 +332,6 @@ sub machine_enable : Chained('machine') PathPart('enable') Args(0) {
|
||||||
$c->res->redirect("/admin/machines");
|
$c->res->redirect("/admin/machines");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub machine_disable : Chained('machine') PathPart('disable') Args(0) {
|
sub machine_disable : Chained('machine') PathPart('disable') Args(0) {
|
||||||
my ($self, $c) = @_;
|
my ($self, $c) = @_;
|
||||||
$c->stash->{machine}->update({ enabled => 0});
|
$c->stash->{machine}->update({ enabled => 0});
|
||||||
|
|
Loading…
Reference in a new issue