1 package Test::LDAP::Controller::User;
3 use namespace::autoclean;
5 BEGIN {extends 'Catalyst::Controller::HTML::FormFu'; }
9 Test::LDAP::Controller::User - Catalyst Controller
24 sub base :Chained('/') :PathPart('user') :CaptureArgs(0) {
28 sub user :Chained('base') :PathPart('') :CaptureArgs(2) {
36 if ($_ =~ /^$/) { $noargs = 1 }
41 $c->res->body("No Args");
47 # Store div stuff for use in templates.
52 resultset => { $id => $c->model('LDAP')->user("etk") }
56 # Do we have any entries?
57 if ( $ou !~ /^\*$/ ) {
58 if (not defined $c->stash->{resultset}->{$id}->{$ou}) {
61 $c->stash->{result}->{$id}->{$ou} = $c->stash->{resultset}->{$id}->{$ou}
64 if ($c->model('LDAP')->mesg->count == 0) {
67 $c->stash->{result} = $c->stash->{resultset};
72 $c->res->body("No results");
77 sub view :Chained('user') :PathPart('view') :Args(0) {
80 $c->res->body("Results");
83 sub edit :Chained('user') :PathPart('edit') :Args(0) {
84 my ( $self, $c ) = @_;
86 # Check if the loc that is specified is a wildcard, do an error if it's true
87 if ($c->stash->{ou} =~ /^\*/) {
88 $c->res->body("You cannot use '*' as an OU / Location when editing a user!");
89 $c->res->status("500");
96 Check if the user is authenicated, if not we just forward to the login page.
100 my ( $self, $c ) = @_;
102 if (!$c->user_exists) {
103 $c->log->debug('*** $c->controller::auto User not found, forwarding to auth');
105 $c->response->redirect( $c->uri_for( $c->controller("Auth")->action_for("index") ) );
120 This library is free software. You can redistribute it and/or modify
121 it under the same terms as Perl itself.
125 __PACKAGE__->meta->make_immutable;